Skip to content

Commit cd5440f

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[lint] Fix Stylelint not running
Node syncSpawn can be promisified, and never runs the following scripts, but it somehow closes the process afterwards. Marking no presubmit as it fails on windows if you change lint rules No-Presubmit: true Bug: none Change-Id: I08fdc3174fe542a5f824239b085d3433e5a24573 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5999261 Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Alex Rudenko <[email protected]> Auto-Submit: Nikolay Vitkov <[email protected]> Reviewed-by: Mathias Bynens <[email protected]>
1 parent d2cc89e commit cd5440f

File tree

10 files changed

+74
-35
lines changed

10 files changed

+74
-35
lines changed

front_end/models/persistence/editFileSystemView.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
}
1919
}
2020

21-
.exclude-subfolders-text, .file-system-list-empty {
21+
.exclude-subfolders-text,
22+
.file-system-list-empty {
2223
padding: 0 var(--sys-size-6);
2324
height: var(--sys-size-13);
2425
}

front_end/models/persistence/workspaceSettingsTab.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* found in the LICENSE file.
55
*/
66

7-
.mappings-info, .folder-exclude-pattern {
7+
.mappings-info,
8+
.folder-exclude-pattern {
89
height: var(--settings-single-item-height);
910
}
1011

front_end/panels/freestyler/components/userActionRow.css

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,23 @@
100100

101101
.scroll-button-container.left {
102102
left: 0;
103-
background: linear-gradient(
104-
90deg,
105-
var(--sys-color-cdt-base-container) 0%,
106-
var(--sys-color-cdt-base-container) 50%,
107-
transparent
108-
);
103+
background:
104+
linear-gradient(
105+
90deg,
106+
var(--sys-color-cdt-base-container) 0%,
107+
var(--sys-color-cdt-base-container) 50%,
108+
transparent
109+
);
109110
}
110111

111112
.scroll-button-container.right {
112113
right: 0;
113-
background: linear-gradient(
114-
90deg,
115-
transparent,
116-
var(--sys-color-cdt-base-container) 50%
117-
);
114+
background:
115+
linear-gradient(
116+
90deg,
117+
transparent,
118+
var(--sys-color-cdt-base-container) 50%
119+
);
118120
justify-content: flex-end;
119121
}
120122
}

front_end/panels/mobile_throttling/throttlingSettingsTab.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* found in the LICENSE file.
55
*/
66

7-
87
.add-conditions-button {
98
border: none;
109
}

front_end/panels/security/sidebar.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
.security-main-view-reload-message,
4444
.tree-outline li.security-sidebar-origins,
4545
.tree-outline li.security-group-list-item,
46-
.tree-outline span {
47-
46+
.tree-outline span {
4847
font: var(--sys-typescale-body4-medium);
4948

5049
&:hover:not(:has(span[is="dt-checkbox"])) .selection {

front_end/panels/sensors/locationsSettingsTab.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* found in the LICENSE file.
55
*/
66

7-
87
.add-locations-button {
98
border: none;
109
}

front_end/panels/settings/frameworkIgnoreListSettingsTab.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
flex: 0 1 auto;
2929
}
3030

31-
.enable-ignore-listing, .ignore-list-item, .general-exclusion-group {
31+
.enable-ignore-listing,
32+
.ignore-list-item,
33+
.general-exclusion-group {
3234
padding-left: var(--sys-size-4);
3335
}
3436

front_end/panels/settings/keybindsSettingsTab.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111

1212
.keybinds-key {
13-
display:flex;
13+
display: flex;
1414
align-items: center;
1515
justify-content: center;
1616
height: var(--sys-size-11);
@@ -19,14 +19,14 @@
1919
white-space: nowrap;
2020
border-radius: var(--sys-shape-corner-small);
2121
background: var(--sys-color-tonal-container);
22-
padding: 0px var(--sys-size-4);
22+
padding: 0 var(--sys-size-4);
2323
}
2424

2525
.keybinds-list-item {
2626
margin: 0 var(--sys-size-6);
2727
padding: var(--sys-size-4) 0;
2828
display: grid;
29-
grid-template-rows: 1fr ;
29+
grid-template-rows: 1fr;
3030
grid-template-columns: 1fr 30px 2fr 30px 30px;
3131
}
3232

front_end/panels/timeline/components/sidebarInsightsTab.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
details:first-child & {
5050
border-top: 1px solid var(--sys-color-divider);
5151
}
52-
}
5352
}
53+
}
5454

5555
.zoom-button {
5656
margin-left: auto;

scripts/test/run_lint_check.js

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ const {extname, join} = require('path');
1111
const globby = require('globby');
1212
const yargs = require('yargs/yargs');
1313
const {hideBin} = require('yargs/helpers');
14-
const childProcess = require('child_process');
15-
const {promisify} = require('util');
14+
const {spawn} = require('child_process');
1615
const {readFileSync} = require('fs');
17-
const spawnAsync = promisify(childProcess.spawnSync);
1816

1917
const {
2018
devtoolsRootPath,
@@ -102,11 +100,17 @@ async function runStylelint(files) {
102100
*/
103101
async function runLitAnalyzer(files) {
104102
const readLitAnalyzerConfigFromCompilerOptions = () => {
105-
const {compilerOptions} = JSON.parse(readFileSync(tsconfigJsonPath(), 'utf-8'));
103+
const {compilerOptions} = JSON.parse(
104+
readFileSync(tsconfigJsonPath(), 'utf-8'),
105+
);
106106
const {plugins} = compilerOptions;
107-
const tsLitPluginOptions = plugins.find(plugin => plugin.name === 'ts-lit-plugin');
107+
const tsLitPluginOptions = plugins.find(
108+
plugin => plugin.name === 'ts-lit-plugin',
109+
);
108110
if (tsLitPluginOptions === null) {
109-
throw new Error(`Failed to find ts-lit-plugin options in ${tsconfigJsonPath()}`);
111+
throw new Error(
112+
`Failed to find ts-lit-plugin options in ${tsconfigJsonPath()}`,
113+
);
110114
}
111115
return tsLitPluginOptions;
112116
};
@@ -118,12 +122,36 @@ async function runLitAnalyzer(files) {
118122
...Object.entries(rules).flatMap(([k, v]) => [`--rules.${k}`, v]),
119123
...subsetFiles,
120124
];
121-
const result = await spawnAsync(nodePath(), args, {
122-
encoding: 'utf-8',
123-
cwd: devtoolsRootPath(),
124-
stdio: 'inherit',
125+
126+
const result = {
127+
output: '',
128+
error: '',
129+
status: false,
130+
};
131+
132+
return await new Promise(resolve => {
133+
const litAnalyzerProcess = spawn(nodePath(), args, {
134+
encoding: 'utf-8',
135+
cwd: devtoolsRootPath(),
136+
});
137+
138+
litAnalyzerProcess.stdout.on('data', data => {
139+
result.output += `\n${data.toString()}`;
140+
});
141+
litAnalyzerProcess.stderr.on('data', data => {
142+
result.error += `\n${data.toString()}`;
143+
});
144+
145+
litAnalyzerProcess.on('error', message => {
146+
result.error += `\n${message}`;
147+
resolve(result);
148+
});
149+
150+
litAnalyzerProcess.on('exit', code => {
151+
result.status = code === 0;
152+
resolve(result);
153+
});
125154
});
126-
return result.status === 0;
127155
};
128156

129157
const getSplitFiles = filesToSplit => {
@@ -145,13 +173,21 @@ async function runLitAnalyzer(files) {
145173
return splitFiles;
146174
};
147175

148-
const result = await Promise.all(
176+
const results = await Promise.all(
149177
getSplitFiles(files).map(filesBatch => {
150178
return getLitAnalyzerResult(filesBatch);
151179
}),
152180
);
181+
for (const result of results) {
182+
if (result.output) {
183+
console.log(result.output);
184+
}
185+
if (result.error) {
186+
console.log(result.error);
187+
}
188+
}
153189

154-
return result.every(r => r);
190+
return results.every(r => r.status);
155191
}
156192

157193
async function run() {

0 commit comments

Comments
 (0)