@wix/origami-lint 1.34.39 → 1.34.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bi/stats.js
CHANGED
|
@@ -46,11 +46,11 @@ export function recordStats(run) {
|
|
|
46
46
|
}
|
|
47
47
|
for (const statsRow of rules) {
|
|
48
48
|
const row = run.recordRow('lint_rule', statsRow.rule, { item_type: statsRow.kind, item_id: statsRow.page, step_details: { violations: statsRow.violations } }, {
|
|
49
|
-
success: statsRow.violations === 0, duration_ms: statsRow.duration_ms,
|
|
49
|
+
success: statsRow.violations === 0, failure: statsRow.violations > 0 ? { error_name: 'lint_violations' } : undefined, duration_ms: statsRow.duration_ms,
|
|
50
50
|
});
|
|
51
51
|
for (const [check, violations] of Object.entries(statsRow.checks)) {
|
|
52
52
|
if (violations > 0)
|
|
53
|
-
run.recordRow('lint_rule', statsRow.rule, { item_type: statsRow.kind, item_id: statsRow.page, step_details: { check, violations } }, { success: false, duration_ms: 0 }, row);
|
|
53
|
+
run.recordRow('lint_rule', statsRow.rule, { item_type: statsRow.kind, item_id: statsRow.page, step_details: { check, violations } }, { success: false, failure: { error_name: 'lint_violations' }, duration_ms: 0 }, row);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
package/dist/lint.js
CHANGED
|
@@ -22,10 +22,10 @@ await run.trackCommand(async () => {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
const changedFiles = getChangedFiles();
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
row?.end(passed);
|
|
28
|
-
return
|
|
25
|
+
const projectResult = trackSync('step', 'run_project_rules', {}, row => {
|
|
26
|
+
const result = runProjectRules(changedFiles.all, { parentRow: row });
|
|
27
|
+
row?.end(result.passed, result.passed ? undefined : { error_name: result.crashed ? 'rule_crashed' : 'lint_violations' });
|
|
28
|
+
return result;
|
|
29
29
|
});
|
|
30
30
|
const pagesToLint = trackSync('step', 'find_pages_to_lint', {}, row => {
|
|
31
31
|
const pages = findPagesToLint(changedFiles);
|
|
@@ -35,19 +35,21 @@ await run.trackCommand(async () => {
|
|
|
35
35
|
});
|
|
36
36
|
if (run.enabled)
|
|
37
37
|
collectStats();
|
|
38
|
-
const
|
|
38
|
+
const pagesResult = await track('step', 'run_rules', { items_total: pagesToLint.length }, async (row) => {
|
|
39
39
|
const result = await runRules(pagesToLint);
|
|
40
40
|
if (run.enabled)
|
|
41
41
|
recordStats(run);
|
|
42
42
|
row?.update({ step_details: { outcome: result.outcome } });
|
|
43
|
-
row?.end(result.passed);
|
|
44
|
-
return result
|
|
43
|
+
row?.end(result.passed, result.passed ? undefined : { error_name: result.outcome === 'plugin_crash' ? 'rule_crashed' : 'lint_violations' });
|
|
44
|
+
return result;
|
|
45
45
|
});
|
|
46
|
-
const passed =
|
|
46
|
+
const passed = projectResult.passed && pagesResult.passed;
|
|
47
47
|
if (passed)
|
|
48
48
|
trackSync('step', 'mark_passing', {}, row => {
|
|
49
49
|
const outcome = markPassing(changedFiles);
|
|
50
50
|
row?.update({ step_details: { outcome } });
|
|
51
51
|
});
|
|
52
|
+
if (!passed)
|
|
53
|
+
run.commandRow.recordFailure({ error_name: projectResult.crashed || pagesResult.outcome === 'plugin_crash' ? 'rule_crashed' : 'lint_violations' });
|
|
52
54
|
await sendAndExit(passed ? 0 : 1);
|
|
53
55
|
});
|
|
@@ -4,10 +4,11 @@ import { projectRuleRegistry } from "../rules/project/index.js";
|
|
|
4
4
|
import { formatProblemLine, log } from "../shared/log.js";
|
|
5
5
|
import { ROOT } from "../shared/paths.js";
|
|
6
6
|
import { createProjectModel } from "../project-model/index.js";
|
|
7
|
-
/**
|
|
7
|
+
/** Reports whether the rules passed and whether any rule crashed. Logs how many rules run, and whether they passed. */
|
|
8
8
|
export function runProjectRules(files, { rules = projectRuleRegistry, readFile = readFromSite, print = console.log, parentRow } = {}) {
|
|
9
9
|
log(`${rules.length} project rules to run`);
|
|
10
10
|
let passed = true;
|
|
11
|
+
let crashed = false;
|
|
11
12
|
for (const rule of rules) {
|
|
12
13
|
const started = performance.now();
|
|
13
14
|
const details = { scope: 'project', severity: rule.severity ?? 'error' };
|
|
@@ -20,14 +21,15 @@ export function runProjectRules(files, { rules = projectRuleRegistry, readFile =
|
|
|
20
21
|
print(formatProblem({ name: rule.name }, { file: '.', message: `the rule couldn't finish, so this run can't pass: ${error instanceof Error ? error.message : String(error)}` }));
|
|
21
22
|
parentRow?.run.recordRow('lint_rule', rule.name, { item_type: 'site', step_details: details }, { success: false, failure: { error_name: 'rule_crashed' }, duration_ms: performance.now() - started });
|
|
22
23
|
passed = false;
|
|
24
|
+
crashed = true;
|
|
23
25
|
continue;
|
|
24
26
|
}
|
|
25
27
|
const duration = performance.now() - started;
|
|
26
|
-
const row = parentRow?.run.recordRow('lint_rule', rule.name, { item_type: 'site', step_details: { ...details, violations: problems.length } }, { success: problems.length === 0, duration_ms: duration });
|
|
28
|
+
const row = parentRow?.run.recordRow('lint_rule', rule.name, { item_type: 'site', step_details: { ...details, violations: problems.length } }, { success: problems.length === 0, failure: problems.length > 0 ? { error_name: 'lint_violations' } : undefined, duration_ms: duration });
|
|
27
29
|
for (const check of rule.checks) {
|
|
28
30
|
const violations = problems.filter(problem => problem.check === check).length;
|
|
29
31
|
if (violations > 0 && row)
|
|
30
|
-
row.run.recordRow('lint_rule', rule.name, { item_type: 'site', step_details: { ...details, check, violations } }, { success: false, duration_ms: 0 }, row);
|
|
32
|
+
row.run.recordRow('lint_rule', rule.name, { item_type: 'site', step_details: { ...details, check, violations } }, { success: false, failure: { error_name: 'lint_violations' }, duration_ms: 0 }, row);
|
|
31
33
|
}
|
|
32
34
|
for (const problem of problems) {
|
|
33
35
|
print(formatProblem(rule, problem));
|
|
@@ -36,7 +38,7 @@ export function runProjectRules(files, { rules = projectRuleRegistry, readFile =
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
log(passed ? 'project rules passed' : 'project rules failed');
|
|
39
|
-
return passed;
|
|
41
|
+
return { passed, crashed };
|
|
40
42
|
}
|
|
41
43
|
/** `file:line:1: error origami(name): message`, the shape the page rules' problems print in. */
|
|
42
44
|
export function formatProblem({ name, severity = 'error' }, { file, line = 1, message }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/origami-lint",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.40",
|
|
4
4
|
"description": "Offline lint for an exported Origami site: lints the pages that changed since the last passing run",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"eslint": "^10.12.0",
|
|
27
27
|
"postcss": "^8.5.3",
|
|
28
28
|
"typescript": "^5.8.3 || ~6.0.3",
|
|
29
|
-
"@wix/origami-bi": "0.
|
|
29
|
+
"@wix/origami-bi": "0.16.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.0.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
]
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
"falconPackageHash": "
|
|
57
|
+
"falconPackageHash": "9c6ab750e32b2a94bd49882a2a34c6242fba5eb6ba4bd879b9eced82"
|
|
58
58
|
}
|