mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[CLEANUP] update prettier to v2.0.4
This commit is contained in:
@@ -20,7 +20,7 @@ debugOwl(owl, {});
|
||||
test("can log full lifecycle", async () => {
|
||||
const steps: string[] = [];
|
||||
const log = console.log;
|
||||
console.log = arg => steps.push(arg);
|
||||
console.log = (arg) => steps.push(arg);
|
||||
|
||||
class Child extends Component {
|
||||
static template = xml`<div>child</div>`;
|
||||
@@ -51,7 +51,7 @@ test("can log full lifecycle", async () => {
|
||||
"[OWL_DEBUG] Child<id=2> rendering template",
|
||||
"[OWL_DEBUG] Parent<id=1> willPatch",
|
||||
"[OWL_DEBUG] Child<id=2> mounted",
|
||||
"[OWL_DEBUG] Parent<id=1> patched"
|
||||
"[OWL_DEBUG] Parent<id=1> patched",
|
||||
]);
|
||||
console.log = log;
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ debugOwl(owl, { logScheduler: true });
|
||||
test("can log scheduler start and stop", async () => {
|
||||
const steps: string[] = [];
|
||||
const log = console.log;
|
||||
console.log = arg => steps.push(arg);
|
||||
console.log = (arg) => steps.push(arg);
|
||||
|
||||
class Child extends Component {
|
||||
static template = xml`<div>child</div>`;
|
||||
@@ -44,7 +44,7 @@ test("can log scheduler start and stop", async () => {
|
||||
"[OWL_DEBUG] Child<id=2> rendering template",
|
||||
"[OWL_DEBUG] Child<id=2> mounted",
|
||||
"[OWL_DEBUG] Parent<id=1> mounted",
|
||||
"[OWL_DEBUG] scheduler: stop running tasks queue"
|
||||
"[OWL_DEBUG] scheduler: stop running tasks queue",
|
||||
]);
|
||||
console.log = log;
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ debugOwl(owl, { logScheduler: true });
|
||||
test("log a specific message for render method calls if component is not mounted", async () => {
|
||||
const steps: string[] = [];
|
||||
const log = console.log;
|
||||
console.log = arg => steps.push(arg);
|
||||
console.log = (arg) => steps.push(arg);
|
||||
|
||||
class Parent extends Component {
|
||||
static template = xml`<div><t t-esc="state.value"/></div>`;
|
||||
@@ -40,7 +40,7 @@ test("log a specific message for render method calls if component is not mounted
|
||||
"[OWL_DEBUG] Parent<id=1> mounted",
|
||||
"[OWL_DEBUG] scheduler: stop running tasks queue",
|
||||
"[OWL_DEBUG] Parent<id=1> willUnmount",
|
||||
"[OWL_DEBUG] Parent<id=1> render (warning: component is not mounted, this render has no effect)"
|
||||
"[OWL_DEBUG] Parent<id=1> render (warning: component is not mounted, this render has no effect)",
|
||||
]);
|
||||
console.log = log;
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ debugOwl(owl, { logScheduler: true });
|
||||
test("log a sub component with non stringifiable props", async () => {
|
||||
const steps: string[] = [];
|
||||
const log = console.log;
|
||||
console.log = arg => steps.push(arg);
|
||||
console.log = (arg) => steps.push(arg);
|
||||
|
||||
class Child extends Component {
|
||||
static template = xml`<span><t t-esc="props.obj.val"/></span>`;
|
||||
@@ -51,7 +51,7 @@ test("log a sub component with non stringifiable props", async () => {
|
||||
"[OWL_DEBUG] Parent<id=1> mounted",
|
||||
"[OWL_DEBUG] scheduler: stop running tasks queue",
|
||||
"[OWL_DEBUG] Parent<id=1> willUnmount",
|
||||
"[OWL_DEBUG] Child<id=2> willUnmount"
|
||||
"[OWL_DEBUG] Child<id=2> willUnmount",
|
||||
]);
|
||||
console.log = log;
|
||||
});
|
||||
|
||||
@@ -60,14 +60,14 @@ function getFiles(path: string[] = []): FileData[] {
|
||||
if (path.length === 0) {
|
||||
const baseFiles: FileData[] = [
|
||||
{ name: "README.md", path: [], links: [], sections: [], fullName: "README.md" },
|
||||
{ name: "roadmap.md", path: [], links: [], sections: [], fullName: "roadmap.md" }
|
||||
{ name: "roadmap.md", path: [], links: [], sections: [], fullName: "roadmap.md" },
|
||||
];
|
||||
const rest = getFiles(["doc"]);
|
||||
const result = baseFiles.concat(rest);
|
||||
result.forEach(addMardownData);
|
||||
return result;
|
||||
}
|
||||
const files = fs.readdirSync(path.join("/"), { withFileTypes: true }).map(f => {
|
||||
const files = fs.readdirSync(path.join("/"), { withFileTypes: true }).map((f) => {
|
||||
if (f.isDirectory()) {
|
||||
return getFiles(path.concat(f.name));
|
||||
}
|
||||
@@ -78,8 +78,8 @@ function getFiles(path: string[] = []): FileData[] {
|
||||
path,
|
||||
links: [],
|
||||
sections: [],
|
||||
fullName
|
||||
}
|
||||
fullName,
|
||||
},
|
||||
];
|
||||
});
|
||||
return Array.prototype.concat(...files);
|
||||
@@ -127,7 +127,7 @@ export function isLinkValid(link: MarkDownLink, current: FileData, files: FileDa
|
||||
}
|
||||
|
||||
// Step 4: check if there is a matching file
|
||||
let target: FileData | undefined = files.find(f => f.fullName === linkFullName);
|
||||
let target: FileData | undefined = files.find((f) => f.fullName === linkFullName);
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ export function isLinkValid(link: MarkDownLink, current: FileData, files: FileDa
|
||||
// Step 5: if necessary, check if there is a corresponding link inside the target
|
||||
// link name
|
||||
if (hash) {
|
||||
if (!target.sections.find(s => s.slug === hash)) {
|
||||
if (!target.sections.find((s) => s.slug === hash)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ function slugify(str) {
|
||||
.toLowerCase()
|
||||
.replace(/\//g, "") // remove /
|
||||
.replace(/\s+/g, "-") // Replace spaces with -
|
||||
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
|
||||
.replace(p, (c) => b.charAt(a.indexOf(c))) // Replace special characters
|
||||
.replace(/&/g, "-and-") // Replace & with ‘and’
|
||||
.replace(/[^\w\-]+/g, "") // Remove all non-word characters
|
||||
.replace(/\-\-+/g, "-") // Replace multiple - with single -
|
||||
|
||||
Reference in New Issue
Block a user