Skip to content

Commit db14bd1

Browse files
wycatsNullVoxPopuli
authored andcommitted
Apply formatting and linting fixes
Run pnpm lint:fix to address CI verify job failures. This includes: - ESLint fixes for consistent code style - Prettier formatting for quotes and spacing - Updated metadata.json from repo:update:metadata - TypeScript config cleanup
1 parent 1e1c370 commit db14bd1

File tree

17 files changed

+97
-67
lines changed

17 files changed

+97
-67
lines changed

bin/ci-checks.mts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,14 @@ class CIChecker {
7676
await this.runCommand('pnpm', ['test:lint'], 'ESLint validation');
7777

7878
this.log(chalk.bold.yellow('🔧 Build Verification'));
79-
await this.runCommand('node', ['./bin/build-verify.mjs'], 'Checking for forbidden code in builds');
79+
await this.runCommand(
80+
'node',
81+
['./bin/build-verify.mjs'],
82+
'Checking for forbidden code in builds'
83+
);
8084

8185
// Note: Full TypeScript checking is done via Turbo in CI
8286
// This script focuses on fast pre-push validation
83-
8487
} catch {
8588
this.log(`\n${chalk.bold.red('💥 Essential Checks FAILED')}`);
8689
this.printSummary();
@@ -119,4 +122,4 @@ try {
119122
} catch (error: unknown) {
120123
console.error('Failed to run essential CI checks:', error);
121124
throw error;
122-
}
125+
}

bin/fixes/apply-eslint-suggestions.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { ESLint } from 'eslint';
44
import { readFileSync, writeFileSync } from 'fs';
55

6-
const [,, filePath, ruleFilter] = process.argv;
6+
const [, , filePath, ruleFilter] = process.argv;
77

88
if (!filePath) {
99
console.error('Usage: node apply-eslint-suggestions.js <file-path> [rule-id]');
@@ -20,8 +20,8 @@ if (!result || !result.messages.length) {
2020

2121
let content = readFileSync(filePath, 'utf-8');
2222
const messages = result.messages
23-
.filter(m => !ruleFilter || m.ruleId === ruleFilter)
24-
.filter(m => m.suggestions?.length)
23+
.filter((m) => !ruleFilter || m.ruleId === ruleFilter)
24+
.filter((m) => m.suggestions?.length)
2525
.sort((a, b) => {
2626
const aFix = a.suggestions?.[0]?.fix;
2727
const bFix = b.suggestions?.[0]?.fix;
@@ -36,7 +36,7 @@ for (const message of messages) {
3636
if (!suggestion?.fix) continue;
3737
const { fix } = suggestion;
3838
console.log(`Fixing ${message.ruleId} at line ${message.line}`);
39-
39+
4040
content = content.slice(0, fix.range[0]) + fix.text + content.slice(fix.range[1]);
4141
changesMade++;
4242
}
@@ -46,4 +46,4 @@ if (changesMade > 0) {
4646
console.log(`Applied ${changesMade} fixes`);
4747
} else {
4848
console.log('No applicable suggestions found');
49-
}
49+
}

bin/fixes/apply-suggestions.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ try {
1919
execSync(`node apply-eslint-suggestions.js "${filePath}"`, { stdio: 'inherit' });
2020
console.log();
2121
}
22-
22+
2323
if (type === 'ts' || type === 'all') {
2424
console.log('=== Applying TypeScript code fixes ===');
2525
execSync(`node apply-ts-codefixes.js "${filePath}"`, { stdio: 'inherit' });
2626
console.log();
2727
}
28-
28+
2929
console.log('Done!');
3030
} catch (error) {
31-
console.error('Error applying suggestions:', error instanceof Error ? error.message : String(error));
31+
console.error(
32+
'Error applying suggestions:',
33+
error instanceof Error ? error.message : String(error)
34+
);
3235
process.exit(1);
33-
}
36+
}

bin/fixes/apply-ts-codefixes.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ts from 'typescript';
44
import { readFileSync, writeFileSync } from 'fs';
55
import { resolve, dirname } from 'path';
66

7-
const [,, fileName, errorCode] = process.argv;
7+
const [, , fileName, errorCode] = process.argv;
88

99
if (!fileName) {
1010
console.error('Usage: node apply-ts-codefixes.js <file-path> [error-code]');
@@ -33,8 +33,8 @@ if (!sourceFile) {
3333

3434
const diagnostics = [
3535
...program.getSemanticDiagnostics(sourceFile),
36-
...program.getSyntacticDiagnostics(sourceFile)
37-
].filter(d => !errorCode || d.code === parseInt(errorCode));
36+
...program.getSyntacticDiagnostics(sourceFile),
37+
].filter((d) => !errorCode || d.code === parseInt(errorCode));
3838

3939
if (!diagnostics.length) {
4040
console.log('No applicable TypeScript diagnostics found');
@@ -46,8 +46,10 @@ const languageService = ts.createLanguageService({
4646
getCompilationSettings: () => options,
4747
getScriptFileNames: () => [resolvedFileName],
4848
getScriptVersion: () => '1',
49-
getScriptSnapshot: (name) => name === resolvedFileName ?
50-
ts.ScriptSnapshot.fromString(readFileSync(name, 'utf-8')) : undefined,
49+
getScriptSnapshot: (name) =>
50+
name === resolvedFileName
51+
? ts.ScriptSnapshot.fromString(readFileSync(name, 'utf-8'))
52+
: undefined,
5153
getCurrentDirectory: () => process.cwd(),
5254
getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options),
5355
readFile: ts.sys.readFile,
@@ -67,12 +69,12 @@ for (const diagnostic of diagnostics) {
6769
{},
6870
{}
6971
);
70-
72+
7173
if (fixes.length > 0) {
7274
console.log(`Found fix for TS${diagnostic.code}: ${diagnostic.messageText}`);
7375
console.log(` Fix: ${fixes[0]?.description}`);
74-
75-
allChanges.push(...(fixes[0]?.changes.flatMap(c => c.textChanges) || []));
76+
77+
allChanges.push(...(fixes[0]?.changes.flatMap((c) => c.textChanges) || []));
7678
}
7779
}
7880
}
@@ -86,11 +88,12 @@ if (!allChanges.length) {
8688
let content = readFileSync(resolvedFileName, 'utf-8');
8789
allChanges
8890
.sort((a, b) => b.span.start - a.span.start)
89-
.forEach(change => {
90-
content = content.slice(0, change.span.start) +
91-
change.newText +
92-
content.slice(change.span.start + change.span.length);
91+
.forEach((change) => {
92+
content =
93+
content.slice(0, change.span.start) +
94+
change.newText +
95+
content.slice(change.span.start + change.span.length);
9396
});
9497

9598
writeFileSync(resolvedFileName, content);
96-
console.log(`Applied ${allChanges.length} TypeScript code fixes`);
99+
console.log(`Applied ${allChanges.length} TypeScript code fixes`);

bin/fixes/list-available-fixes.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,47 @@ import { ESLint } from 'eslint';
55
async function listESLintFixes(filePath) {
66
const eslint = new ESLint();
77
const results = await eslint.lintFiles([filePath]);
8-
8+
99
console.log('=== ESLint Issues with Available Fixes ===\n');
10-
10+
1111
for (const result of results) {
1212
const messages = result.messages;
13-
13+
1414
if (messages.length === 0) {
1515
console.log('No ESLint issues found');
1616
continue;
1717
}
18-
19-
const fixableByAutoFix = messages.filter(m => m.fix);
20-
const fixableBySuggestions = messages.filter(m => m.suggestions && m.suggestions.length > 0);
21-
const notFixable = messages.filter(m => !m.fix && (!m.suggestions || m.suggestions.length === 0));
22-
18+
19+
const fixableByAutoFix = messages.filter((m) => m.fix);
20+
const fixableBySuggestions = messages.filter((m) => m.suggestions && m.suggestions.length > 0);
21+
const notFixable = messages.filter(
22+
(m) => !m.fix && (!m.suggestions || m.suggestions.length === 0)
23+
);
24+
2325
console.log(`Total issues: ${messages.length}`);
2426
console.log(` - Auto-fixable (--fix): ${fixableByAutoFix.length}`);
2527
console.log(` - Fixable by suggestions: ${fixableBySuggestions.length}`);
2628
console.log(` - Not auto-fixable: ${notFixable.length}\n`);
27-
29+
2830
if (fixableByAutoFix.length > 0) {
2931
console.log('Auto-fixable issues:');
3032
for (const msg of fixableByAutoFix) {
3133
console.log(` - Line ${msg.line}:${msg.column} - ${msg.ruleId}: ${msg.message}`);
3234
}
3335
console.log();
3436
}
35-
37+
3638
if (fixableBySuggestions.length > 0) {
3739
console.log('Issues with suggestions:');
3840
for (const msg of fixableBySuggestions) {
3941
console.log(` - Line ${msg.line}:${msg.column} - ${msg.ruleId}: ${msg.message}`);
40-
for (const suggestion of (msg.suggestions || [])) {
42+
for (const suggestion of msg.suggestions || []) {
4143
console.log(` → ${suggestion.desc}`);
4244
}
4345
}
4446
console.log();
4547
}
46-
48+
4749
if (notFixable.length > 0) {
4850
console.log('Not auto-fixable:');
4951
for (const msg of notFixable) {
@@ -59,4 +61,4 @@ if (!filePath) {
5961
process.exit(1);
6062
}
6163

62-
listESLintFixes(filePath).catch(console.error);
64+
listESLintFixes(filePath).catch(console.error);

packages/@glimmer-workspace/build/lib/config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,7 @@ export class Package {
464464
module: ts.ModuleKind.ESNext,
465465
target: ts.ScriptTarget.ESNext,
466466
strict: true,
467-
types: [
468-
...(this.#package.devDependencies['@types/node'] ? ['node'] : []),
469-
],
467+
types: [...(this.#package.devDependencies['@types/node'] ? ['node'] : [])],
470468
},
471469
}),
472470
],
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
pre {
22
line-height: 1.2;
3-
font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', 'Noto Sans Mono', monospace;
4-
}
3+
font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", "Noto Sans Mono", monospace;
4+
}

packages/@glimmer-workspace/integration-tests/lib/modes/jit/delegate.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ export class JitRenderDelegate implements RenderDelegate {
209209

210210
let { env } = this.context;
211211

212-
213212
return renderTemplate(
214213
template,
215214
this.context,

packages/@glimmer-workspace/integration-tests/lib/test-decorator.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ export function test(...args: any[]) {
3939
}
4040

4141
let [target, name, descriptor] = args;
42-
setTestKind({ callee: 'test', target, value: descriptor.value, kind: (...args) => QUnit.test(...args), name });
42+
setTestKind({
43+
callee: 'test',
44+
target,
45+
value: descriptor.value,
46+
kind: (...args) => QUnit.test(...args),
47+
name,
48+
});
4349
return descriptor;
4450
}
4551

@@ -48,12 +54,24 @@ test.skip = <T extends TypedPropertyDescriptor>(
4854
name: string,
4955
descriptor: T
5056
) => {
51-
setTestKind({ callee: 'test.skip', target, value: descriptor.value, kind: (...args) => QUnit.skip(...args), name });
57+
setTestKind({
58+
callee: 'test.skip',
59+
target,
60+
value: descriptor.value,
61+
kind: (...args) => QUnit.skip(...args),
62+
name,
63+
});
5264
return descriptor;
5365
};
5466

5567
test.todo = (target: IBasicTest, name: string, descriptor: PropertyDescriptor) => {
56-
setTestKind({ callee: 'test.todo', target, value: descriptor.value, kind: (...args) => QUnit.todo(...args), name });
68+
setTestKind({
69+
callee: 'test.todo',
70+
target,
71+
value: descriptor.value,
72+
kind: (...args) => QUnit.todo(...args),
73+
name,
74+
});
5775
return descriptor;
5876
};
5977

packages/@glimmer/compiler/lib/wire-format-debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export default class WireFormatDebugger {
287287
return [`( <resolve:helper> )`, this.formatOpcode(opcode[1])];
288288

289289
case Op.ResolveAsComponentCallee:
290-
return [`< resolve:component >`, this.formatOpcode(opcode[1])]
290+
return [`< resolve:component >`, this.formatOpcode(opcode[1])];
291291

292292
default:
293293
exhausted(opcode);

0 commit comments

Comments
 (0)