Skip to content

Commit aee920d

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[lint] Add debug logging
Bug: none Change-Id: Ifcca54e5a5330d6e8f745b9a7eb0a30212360d8e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6239894 Commit-Queue: Benedikt Meurer <[email protected]> Auto-Submit: Nikolay Vitkov <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]>
1 parent 9e0bf01 commit aee920d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

scripts/test/run_lint_check.mjs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,16 @@ if (flags.debug) {
5353
}
5454
const cacheLinters = !flags.debug;
5555

56+
function debugLogging(...args) {
57+
if (!flags.debug) {
58+
return;
59+
}
60+
61+
console.log(...args);
62+
}
63+
5664
async function runESLint(scriptFiles) {
65+
debugLogging('[lint]: Running EsLint...');
5766
const cli = new ESLint({
5867
cwd: join(import.meta.dirname, '..', '..'),
5968
fix: flags.fix,
@@ -111,6 +120,7 @@ async function runESLint(scriptFiles) {
111120
}
112121

113122
async function runStylelint(files) {
123+
debugLogging('[lint]: Running StyleLint...');
114124
const { report, errored } = await stylelint.lint({
115125
configFile: join(import.meta.dirname, '..', '..', '.stylelintrc.json'),
116126
ignorePath: join(import.meta.dirname, '..', '..', '.stylelintignore'),
@@ -137,6 +147,8 @@ async function runStylelint(files) {
137147
* @param {string[]} files the input files to analyze.
138148
*/
139149
async function runLitAnalyzer(files) {
150+
debugLogging('[lint]: Running LitAnalyzer...');
151+
140152
const readLitAnalyzerConfigFromCompilerOptions = () => {
141153
const { compilerOptions } = JSON.parse(
142154
readFileSync(tsconfigJsonPath(), 'utf-8'),
@@ -154,6 +166,11 @@ async function runLitAnalyzer(files) {
154166
};
155167

156168
const { rules } = readLitAnalyzerConfigFromCompilerOptions();
169+
/**
170+
*
171+
* @param {string[]} subsetFiles
172+
* @returns {{output: string, error: string, status:boolean}}
173+
*/
157174
const getLitAnalyzerResult = async subsetFiles => {
158175
const args = [
159176
litAnalyzerExecutablePath(),
@@ -217,7 +234,9 @@ async function runLitAnalyzer(files) {
217234
}),
218235
);
219236
for (const result of results) {
220-
if (result.output) {
237+
// Don't print if no problems are found
238+
// Mimics the other tools
239+
if (result.output && !result.output.includes('Found 0 problems')) {
221240
console.log(result.output);
222241
}
223242
if (result.error) {

0 commit comments

Comments
 (0)