Skip to content

Commit 792455d

Browse files
committed
build: update eslint monorepo to v10
See associated pull request for more information. Closes #32456 as a pr takeover
1 parent dfbbe2d commit 792455d

File tree

32 files changed

+212
-180
lines changed

32 files changed

+212
-180
lines changed

eslint.config.mjs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import js from '@eslint/js';
1212
import stylistic from '@stylistic/eslint-plugin';
1313
import typescriptEslint from '@typescript-eslint/eslint-plugin';
1414
import tsParser from '@typescript-eslint/parser';
15-
import header from 'eslint-plugin-header';
15+
import header from '@tony.ganchev/eslint-plugin-header';
1616
import _import from 'eslint-plugin-import';
1717
import globals from 'globals';
1818

@@ -22,9 +22,6 @@ const compat = new FlatCompat({
2222
allConfig: js.configs.all,
2323
});
2424

25-
// See: https://github.com/Stuk/eslint-plugin-header/issues/57
26-
header.rules.header.meta.schema = false;
27-
2825
export default [
2926
{
3027
ignores: [
@@ -59,7 +56,7 @@ export default [
5956
'@stylistic': stylistic,
6057
'@typescript-eslint': fixupPluginRules(typescriptEslint),
6158
import: fixupPluginRules(_import),
62-
header,
59+
'@tony.ganchev': header,
6360
},
6461

6562
languageOptions: {
@@ -106,7 +103,7 @@ export default [
106103
'@typescript-eslint/no-unused-expressions': 'error',
107104
curly: 'error',
108105

109-
'header/header': [
106+
'@tony.ganchev/header': [
110107
'error',
111108
'block',
112109
[

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@
6161
"@bazel/buildifier": "8.2.1",
6262
"@eslint/compat": "2.0.2",
6363
"@eslint/eslintrc": "3.3.3",
64-
"@eslint/js": "9.39.2",
64+
"@eslint/js": "10.0.1",
6565
"@rollup/plugin-alias": "^6.0.0",
6666
"@rollup/plugin-commonjs": "^29.0.0",
6767
"@rollup/plugin-json": "^6.1.0",
6868
"@rollup/plugin-node-resolve": "16.0.3",
6969
"@stylistic/eslint-plugin": "^5.0.0",
70+
"@tony.ganchev/eslint-plugin-header": "~3.2.4",
7071
"@types/babel__core": "7.20.5",
7172
"@types/babel__generator": "^7.6.8",
7273
"@types/browser-sync": "^2.27.0",
@@ -95,9 +96,8 @@
9596
"buffer": "6.0.3",
9697
"esbuild": "0.27.3",
9798
"esbuild-wasm": "0.27.3",
98-
"eslint": "9.39.2",
99+
"eslint": "10.0.2",
99100
"eslint-config-prettier": "10.1.8",
100-
"eslint-plugin-header": "3.1.1",
101101
"eslint-plugin-import": "2.32.0",
102102
"express": "5.2.1",
103103
"fast-glob": "3.3.3",

packages/angular/build/src/builders/karma/progress-reporter.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@ export function injectKarmaReporter(
5353
private startWatchingBuild() {
5454
void (async () => {
5555
// This is effectively "for await of but skip what's already consumed".
56-
let isDone = false; // to mark the loop condition as "not constant".
57-
while (!isDone) {
56+
while (true) {
5857
const { done, value: buildOutput } = await buildIterator.next();
5958
if (done) {
60-
isDone = true;
6159
break;
6260
}
6361

packages/angular/build/src/builders/unit-test/builder.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ async function loadTestRunner(runnerName: string): Promise<TestRunner> {
4545
} catch (e) {
4646
assertIsError(e);
4747
if (e.code === 'ERR_MODULE_NOT_FOUND') {
48-
throw new Error(`Unknown test runner "${runnerName}".`);
48+
throw new Error(`Unknown test runner "${runnerName}".`, { cause: e });
4949
}
5050
throw new Error(
51-
`Failed to load the '${runnerName}' test runner. The package may be corrupted or improperly installed.\n` +
52-
`Error: ${e.message}`,
51+
`Failed to load the '${runnerName}' test runner. The package may be corrupted or improperly installed.`,
52+
{ cause: e },
5353
);
5454
}
5555

@@ -370,7 +370,9 @@ async function transformNgPackagrOptions(
370370
ngPackageJson = JSON.parse(await readFile(ngPackagePath, 'utf-8'));
371371
} catch (e) {
372372
assertIsError(e);
373-
throw new Error(`Could not read ng-package.json at ${ngPackagePath}: ${e.message}`);
373+
throw new Error(`Could not read ng-package.json at ${ngPackagePath}`, {
374+
cause: e,
375+
});
374376
}
375377

376378
const lib = ngPackageJson['lib'] || {};

packages/angular/build/src/builders/unit-test/runners/vitest/executor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export class VitestExecutor implements TestExecutor {
185185
}
186186
throw new Error(
187187
'The `vitest` package was not found. Please install the package and rerun the test command.',
188+
{ cause: error },
188189
);
189190
}
190191
const { startVitest } = vitestNodeModule;

packages/angular/build/src/tools/esbuild/application-code-bundle.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,6 @@ function getEsBuildCommonPolyfillsOptions(
701701
cache: loadResultCache,
702702
loadContent: async (_, build) => {
703703
let polyfillPaths = polyfills;
704-
let warnings: PartialMessage[] | undefined;
705704

706705
if (tryToResolvePolyfillsAsRelative) {
707706
polyfillPaths = await Promise.all(
@@ -736,7 +735,6 @@ function getEsBuildCommonPolyfillsOptions(
736735
return {
737736
contents,
738737
loader: 'js',
739-
warnings,
740738
resolveDir: workspaceRoot,
741739
};
742740
},

packages/angular/build/src/tools/esbuild/i18n-inliner-worker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ async function transformWithBabel(
196196
// Which makes it hard to find the actual error message.
197197
const index = error.message.indexOf(')\n');
198198
const msg = index !== -1 ? error.message.slice(0, index + 1) : error.message;
199-
throw new Error(`${msg}\nAn error occurred inlining file "${options.filename}"`);
199+
throw new Error(`${msg}\nAn error occurred inlining file "${options.filename}"`, {
200+
cause: error,
201+
});
200202
}
201203

202204
if (!ast) {

packages/angular/build/src/utils/normalize-asset-patterns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function normalizeAssetPatterns(
4545
}
4646

4747
let glob: string, input: string;
48-
let isDirectory = false;
48+
let isDirectory: boolean;
4949

5050
try {
5151
isDirectory = statSync(resolvedAssetPath).isDirectory();

packages/angular/build/src/utils/service-worker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import type {
10-
Config,
11-
Filesystem,
12-
} from '@angular/service-worker/config' with { 'resolution-mode': 'import' };
9+
import type { Config, Filesystem } from '@angular/service-worker/config' with {
10+
'resolution-mode': 'import',
11+
};
1312
import * as crypto from 'node:crypto';
1413
import { existsSync, promises as fsPromises } from 'node:fs';
1514
import * as path from 'node:path';
@@ -149,6 +148,7 @@ export async function augmentAppWithServiceWorker(
149148
'Error: Expected to find an ngsw-config.json configuration file' +
150149
` in the ${appRoot} folder. Either provide one or` +
151150
' disable Service Worker in the angular.json configuration file.',
151+
{ cause: error },
152152
);
153153
} else {
154154
throw error;
@@ -200,7 +200,7 @@ export async function augmentAppWithServiceWorkerEsbuild(
200200
workspaceRoot,
201201
configPath,
202202
)}" could not be found.`;
203-
throw new Error(message);
203+
throw new Error(message, { cause: error });
204204
} else {
205205
throw error;
206206
}

packages/angular/cli/src/commands/mcp/tools/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export async function runBuild(input: BuildToolInput, context: McpToolContext) {
4747
const args = ['build', projectName, '-c', input.configuration ?? DEFAULT_CONFIGURATION];
4848

4949
let status: BuildStatus = 'success';
50-
let logs: string[] = [];
50+
let logs: string[];
5151
let outputPath: string | undefined;
5252

5353
try {

0 commit comments

Comments
 (0)