Skip to content

Commit da9a885

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[lint] Add debugging flag
Was messing around with creating rules for Lit formatting, and discovered that if not disable the second run does not run the custom rule. Bug: none Change-Id: I1cc38d1118560774527dfe52d5d1281e304491ad Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6216936 Auto-Submit: Nikolay Vitkov <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]>
1 parent 085d08c commit da9a885

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

scripts/test/run_lint_check.mjs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ const flags = yargs(hideBin(process.argv))
2424
default: true,
2525
describe: 'Automatically fix, where possible, problems reported by rules.',
2626
})
27+
.option('debug', {
28+
type: 'boolean',
29+
default: false,
30+
describe:
31+
'Disable cache validations during debugging, useful for custom rule creation/debugging.',
32+
})
2733
.usage('$0 [<files...>]', 'Run the linter on the provided files', yargs => {
2834
yargs.positional('files', {
2935
describe: 'File(s), glob(s), or directories',
@@ -37,17 +43,21 @@ const flags = yargs(hideBin(process.argv))
3743
],
3844
});
3945
})
40-
.parse();
46+
.parseSync();
4147

4248
if (!flags.fix) {
4349
console.log('[lint]: fix is disabled; no errors will be autofixed.');
4450
}
51+
if (flags.debug) {
52+
console.log('[lint]: Cache disabled, linting may take longer.');
53+
}
54+
const cacheLinters = !flags.debug;
4555

4656
async function runESLint(scriptFiles) {
4757
const cli = new ESLint({
4858
cwd: join(import.meta.dirname, '..', '..'),
4959
fix: flags.fix,
50-
cache: true,
60+
cache: cacheLinters,
5161
});
5262

5363
// We filter out certain files in the `eslint.config.mjs` `Ignore list` entry.
@@ -107,7 +117,7 @@ async function runStylelint(files) {
107117
fix: flags.fix,
108118
files,
109119
formatter: 'string',
110-
cache: true,
120+
cache: cacheLinters,
111121
allowEmptyInput: true,
112122
});
113123

0 commit comments

Comments
 (0)