Skip to content

Commit e2b46ef

Browse files
committed
feat!: switch to angular v20
1 parent 2ff0e50 commit e2b46ef

27 files changed

+936
-408
lines changed

.nx/workflows/agents.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
launch-templates:
22
custom-linux-medium-plus-js:
33
resourceClass: 'docker_linux_amd64/medium+'
4-
image: 'ubuntu22.04-node20.11-v7'
4+
image: 'ubuntu22.04-node20.19-v2'
55
init-steps:
66
- name: checkout repo
77
uses: 'nrwl/nx-cloud-workflows/v4/workflow-steps/checkout/main.yaml'

e2e/src/__snapshots__/eslint-8--inline-template-fixer.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ export class TestComponent {}
1717
1818
exports[`eslint-8--inline-template-fixer should generate the expected inline template fixer result 2`] = `
1919
{
20-
"@angular-devkit/build-angular": "^19.X.X",
2120
"@angular-eslint/builder": "0.0.0-e2e",
2221
"@angular-eslint/eslint-plugin": "0.0.0-e2e",
2322
"@angular-eslint/eslint-plugin-template": "0.0.0-e2e",
2423
"@angular-eslint/schematics": "0.0.0-e2e",
2524
"@angular-eslint/template-parser": "0.0.0-e2e",
26-
"@angular/cli": "^19.X.X",
27-
"@angular/compiler-cli": "^19.X.X",
25+
"@angular/build": "^20.X.X",
26+
"@angular/cli": "^20.X.X",
27+
"@angular/compiler-cli": "^20.X.X",
2828
"@types/jasmine": "~5.1.0",
2929
"@typescript-eslint/eslint-plugin": "7.11.0",
3030
"@typescript-eslint/parser": "7.11.0",
3131
"eslint": "8.57.1",
32-
"jasmine-core": "~5.6.0",
32+
"jasmine-core": "~5.7.0",
3333
"karma": "~6.4.0",
3434
"karma-chrome-launcher": "~3.2.0",
3535
"karma-coverage": "~2.2.0",

e2e/src/__snapshots__/eslint-8--new-workspace-create-application-false-ng-add-then-project.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
exports[`eslint-8--new-workspace-create-application-false-ng-add-then-project should pass linting when running ng-add before creating any projects 1`] = `
44
{
5-
"@angular-devkit/build-angular": "^19.X.X",
65
"@angular-eslint/builder": "0.0.0-e2e",
76
"@angular-eslint/eslint-plugin": "0.0.0-e2e",
87
"@angular-eslint/eslint-plugin-template": "0.0.0-e2e",
98
"@angular-eslint/schematics": "0.0.0-e2e",
109
"@angular-eslint/template-parser": "0.0.0-e2e",
11-
"@angular/cli": "^19.X.X",
12-
"@angular/compiler-cli": "^19.X.X",
10+
"@angular/build": "^20.X.X",
11+
"@angular/cli": "^20.X.X",
12+
"@angular/compiler-cli": "^20.X.X",
1313
"@types/jasmine": "~5.1.0",
1414
"@typescript-eslint/eslint-plugin": "7.11.0",
1515
"@typescript-eslint/parser": "7.11.0",
1616
"eslint": "8.57.1",
17-
"jasmine-core": "~5.6.0",
17+
"jasmine-core": "~5.7.0",
1818
"karma": "~6.4.0",
1919
"karma-chrome-launcher": "~3.2.0",
2020
"karma-coverage": "~2.2.0",

e2e/src/__snapshots__/eslint-8--new-workspace-create-application-false-project-then-ng-add.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
exports[`eslint-8--new-workspace-create-application-false-project-then-ng-add should pass linting when adding a project before running ng-add 1`] = `
44
{
5-
"@angular-devkit/build-angular": "^19.X.X",
65
"@angular-eslint/builder": "0.0.0-e2e",
76
"@angular-eslint/eslint-plugin": "0.0.0-e2e",
87
"@angular-eslint/eslint-plugin-template": "0.0.0-e2e",
98
"@angular-eslint/schematics": "0.0.0-e2e",
109
"@angular-eslint/template-parser": "0.0.0-e2e",
11-
"@angular/cli": "^19.X.X",
12-
"@angular/compiler-cli": "^19.X.X",
10+
"@angular/build": "^20.X.X",
11+
"@angular/cli": "^20.X.X",
12+
"@angular/compiler-cli": "^20.X.X",
1313
"@types/jasmine": "~5.1.0",
1414
"@typescript-eslint/eslint-plugin": "7.11.0",
1515
"@typescript-eslint/parser": "7.11.0",
1616
"eslint": "8.57.1",
17-
"jasmine-core": "~5.6.0",
17+
"jasmine-core": "~5.7.0",
1818
"karma": "~6.4.0",
1919
"karma-chrome-launcher": "~3.2.0",
2020
"karma-coverage": "~2.2.0",

e2e/src/__snapshots__/eslint-8--new-workspace.test.ts.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
exports[`eslint-8--new-workspace should pass linting after creating a new workspace from scratch using angular-eslint 1`] = `
44
{
5-
"@angular-devkit/build-angular": "^19.X.X",
65
"@angular-eslint/builder": "0.0.0-e2e",
76
"@angular-eslint/eslint-plugin": "0.0.0-e2e",
87
"@angular-eslint/eslint-plugin-template": "0.0.0-e2e",
98
"@angular-eslint/schematics": "0.0.0-e2e",
109
"@angular-eslint/template-parser": "0.0.0-e2e",
11-
"@angular/cli": "^19.X.X",
12-
"@angular/compiler-cli": "^19.X.X",
10+
"@angular/build": "^20.X.X",
11+
"@angular/cli": "^20.X.X",
12+
"@angular/compiler-cli": "^20.X.X",
1313
"@types/jasmine": "~5.1.0",
1414
"@typescript-eslint/eslint-plugin": "7.11.0",
1515
"@typescript-eslint/parser": "7.11.0",
1616
"eslint": "8.57.1",
17-
"jasmine-core": "~5.6.0",
17+
"jasmine-core": "~5.7.0",
1818
"karma": "~6.4.0",
1919
"karma-chrome-launcher": "~3.2.0",
2020
"karma-coverage": "~2.2.0",
2121
"karma-jasmine": "~5.1.0",
2222
"karma-jasmine-html-reporter": "~2.1.0",
23-
"ng-packagr": "^19.X.X",
23+
"ng-packagr": "^20.X.X",
2424
"typescript": "~5.X.X"
2525
}
2626
`;

e2e/src/__snapshots__/inline-template-fixer.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ export class TestComponent {}
1717
1818
exports[`inline-template-fixer should generate the expected inline template fixer result 2`] = `
1919
{
20-
"@angular-devkit/build-angular": "^19.X.X",
21-
"@angular/cli": "^19.X.X",
22-
"@angular/compiler-cli": "^19.X.X",
20+
"@angular/build": "^20.X.X",
21+
"@angular/cli": "^20.X.X",
22+
"@angular/compiler-cli": "^20.X.X",
2323
"@types/jasmine": "~5.1.0",
2424
"angular-eslint": "0.0.0-e2e",
2525
"eslint": "^9.28.0",
26-
"jasmine-core": "~5.6.0",
26+
"jasmine-core": "~5.7.0",
2727
"karma": "~6.4.0",
2828
"karma-chrome-launcher": "~3.2.0",
2929
"karma-coverage": "~2.2.0",

e2e/src/__snapshots__/new-workspace-create-application-false-ng-add-then-project.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
exports[`new-workspace-create-application-false-ng-add-then-project should pass linting when running ng-add before creating any projects 1`] = `
44
{
5-
"@angular-devkit/build-angular": "^19.X.X",
6-
"@angular/cli": "^19.X.X",
7-
"@angular/compiler-cli": "^19.X.X",
5+
"@angular/build": "^20.X.X",
6+
"@angular/cli": "^20.X.X",
7+
"@angular/compiler-cli": "^20.X.X",
88
"@types/jasmine": "~5.1.0",
99
"angular-eslint": "0.0.0-e2e",
1010
"eslint": "^9.28.0",
11-
"jasmine-core": "~5.6.0",
11+
"jasmine-core": "~5.7.0",
1212
"karma": "~6.4.0",
1313
"karma-chrome-launcher": "~3.2.0",
1414
"karma-coverage": "~2.2.0",

e2e/src/__snapshots__/new-workspace-create-application-false-project-then-ng-add.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
exports[`new-workspace-create-application-false-project-then-ng-add should pass linting when adding a project before running ng-add 1`] = `
44
{
5-
"@angular-devkit/build-angular": "^19.X.X",
6-
"@angular/cli": "^19.X.X",
7-
"@angular/compiler-cli": "^19.X.X",
5+
"@angular/build": "^20.X.X",
6+
"@angular/cli": "^20.X.X",
7+
"@angular/compiler-cli": "^20.X.X",
88
"@types/jasmine": "~5.1.0",
99
"angular-eslint": "0.0.0-e2e",
1010
"eslint": "^9.28.0",
11-
"jasmine-core": "~5.6.0",
11+
"jasmine-core": "~5.7.0",
1212
"karma": "~6.4.0",
1313
"karma-chrome-launcher": "~3.2.0",
1414
"karma-coverage": "~2.2.0",

e2e/src/__snapshots__/new-workspace-type-module.test.ts.snap

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
exports[`new-workspace-type-module should pass linting after creating a new workspace from scratch using @angular-eslint 1`] = `
44
{
5-
"@angular-devkit/build-angular": "^19.X.X",
6-
"@angular/cli": "^19.X.X",
7-
"@angular/compiler-cli": "^19.X.X",
5+
"@angular/build": "^20.X.X",
6+
"@angular/cli": "^20.X.X",
7+
"@angular/compiler-cli": "^20.X.X",
88
"@types/jasmine": "~5.1.0",
99
"angular-eslint": "0.0.0-e2e",
1010
"eslint": "^9.28.0",
11-
"jasmine-core": "~5.6.0",
11+
"jasmine-core": "~5.7.0",
1212
"karma": "~6.4.0",
1313
"karma-chrome-launcher": "~3.2.0",
1414
"karma-coverage": "~2.2.0",
1515
"karma-jasmine": "~5.1.0",
1616
"karma-jasmine-html-reporter": "~2.1.0",
17-
"ng-packagr": "^19.X.X",
17+
"ng-packagr": "^20.X.X",
1818
"typescript": "~5.X.X",
1919
"typescript-eslint": "8.33.1"
2020
}
@@ -191,11 +191,6 @@ All files pass linting.
191191
192192
Linting \\"another-lib\\"...
193193
194-
__ROOT__//new-workspace-type-module/projects/another-lib/src/lib/another-lib.service.ts
195-
8:17 error Unexpected empty constructor @typescript-eslint/no-empty-function
196-
197-
✖ 1 problem (1 error, 0 warnings)
198-
199-
Lint errors found in the listed files.
194+
All files pass linting.
200195
"
201196
`;

e2e/src/__snapshots__/new-workspace-typescript-config.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ All files pass linting.
1111
exports[`new-workspace with TypeScript config should show an error when linting using a TypeScript config before the user installs jiti 1`] = `
1212
"
1313
Linting \\"new-workspace-typescript-config\\"...
14-
Error when running ESLint: You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features."
14+
Error when running ESLint: The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it."
1515
`;

e2e/src/__snapshots__/new-workspace.test.ts.snap

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
exports[`new-workspace should pass linting after creating a new workspace from scratch using @angular-eslint 1`] = `
44
{
5-
"@angular-devkit/build-angular": "^19.X.X",
6-
"@angular/cli": "^19.X.X",
7-
"@angular/compiler-cli": "^19.X.X",
5+
"@angular/build": "^20.X.X",
6+
"@angular/cli": "^20.X.X",
7+
"@angular/compiler-cli": "^20.X.X",
88
"@types/jasmine": "~5.1.0",
99
"angular-eslint": "0.0.0-e2e",
1010
"eslint": "^9.28.0",
11-
"jasmine-core": "~5.6.0",
11+
"jasmine-core": "~5.7.0",
1212
"karma": "~6.4.0",
1313
"karma-chrome-launcher": "~3.2.0",
1414
"karma-coverage": "~2.2.0",
1515
"karma-jasmine": "~5.1.0",
1616
"karma-jasmine-html-reporter": "~2.1.0",
17-
"ng-packagr": "^19.X.X",
17+
"ng-packagr": "^20.X.X",
1818
"typescript": "~5.X.X",
1919
"typescript-eslint": "8.33.1"
2020
}
@@ -191,11 +191,6 @@ All files pass linting.
191191
192192
Linting \\"another-lib\\"...
193193
194-
__ROOT__//new-workspace/projects/another-lib/src/lib/another-lib.service.ts
195-
8:17 error Unexpected empty constructor @typescript-eslint/no-empty-function
196-
197-
✖ 1 problem (1 error, 0 warnings)
198-
199-
Lint errors found in the listed files.
194+
All files pass linting.
200195
"
201196
`;

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"private": true,
44
"description": "The tooling which enables ESLint to work with Angular projects",
55
"volta": {
6-
"node": "20.19.2"
6+
"node": "22.16.0"
77
},
88
"packageManager": "pnpm@10.11.1",
99
"contributors": [
@@ -48,8 +48,8 @@
4848
]
4949
},
5050
"devDependencies": {
51-
"@angular/cli": "19.2.14",
52-
"@angular/compiler": "19.2.14",
51+
"@angular/cli": "20.0.0",
52+
"@angular/compiler": "20.0.0",
5353
"@commitlint/cli": "19.8.1",
5454
"@commitlint/config-conventional": "19.8.1",
5555
"@mdn/browser-compat-data": "6.0.20",
@@ -61,7 +61,7 @@
6161
"@nx/js": "21.1.2",
6262
"@nx/plugin": "21.1.2",
6363
"@nx/workspace": "21.1.2",
64-
"@schematics/angular": "19.2.14",
64+
"@schematics/angular": "20.0.0",
6565
"@swc-node/register": "1.10.10",
6666
"@swc/cli": "0.7.7",
6767
"@swc/core": "1.11.31",

packages/angular-eslint/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"typescript-eslint": "^8.0.0"
2424
},
2525
"dependencies": {
26-
"@angular-devkit/core": ">= 19.0.0 < 20.0.0",
27-
"@angular-devkit/schematics": ">= 19.0.0 < 20.0.0",
26+
"@angular-devkit/core": ">= 20.0.0 < 21.0.0",
27+
"@angular-devkit/schematics": ">= 20.0.0 < 21.0.0",
2828
"@angular-eslint/builder": "workspace:*",
2929
"@angular-eslint/eslint-plugin": "workspace:*",
3030
"@angular-eslint/eslint-plugin-template": "workspace:*",

packages/builder/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"builders.json"
2020
],
2121
"dependencies": {
22-
"@angular-devkit/architect": ">= 0.1900.0 < 0.2000.0",
23-
"@angular-devkit/core": ">= 19.0.0 < 20.0.0"
22+
"@angular-devkit/architect": ">= 0.2000.0 < 0.2100.0",
23+
"@angular-devkit/core": ">= 20.0.0 < 21.0.0"
2424
},
2525
"peerDependencies": {
2626
"eslint": "^8.57.0 || ^9.0.0",

packages/builder/src/lint.impl.spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,6 @@ describe('Linter Builder', () => {
157157
},
158158
},
159159
"success": false,
160-
"target": Object {
161-
"configuration": undefined,
162-
"project": undefined,
163-
"target": undefined,
164-
},
165160
}
166161
`);
167162
});

packages/eslint-plugin-template/src/rules/conditional-complexity.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from '@angular-eslint/bundled-angular-compiler';
1414
import { ensureTemplateParser } from '@angular-eslint/utils';
1515
import { createESLintRule } from '../utils/create-eslint-rule';
16+
import { unwrapParenthesizedExpression } from '../utils/unwrap-parenthesized-expression';
1617

1718
export type Options = [{ maxComplexity: number }];
1819
export type MessageIds = 'conditionalComplexity';
@@ -105,7 +106,8 @@ export default createESLintRule<Options, MessageIds>({
105106
});
106107

107108
function extractPossibleBinaryOrConditionalFrom(node: AST): AST {
108-
return node instanceof BindingPipe ? node.exp : node;
109+
const unwrapped = unwrapParenthesizedExpression(node);
110+
return unwrapped instanceof BindingPipe ? unwrapped.exp : unwrapped;
109111
}
110112

111113
let parser: Parser | null = null;
@@ -130,11 +132,24 @@ function getTotalComplexity(ast: AST): number {
130132
let total = 1;
131133

132134
if (possibleBinaryOrConditional instanceof Binary) {
133-
if (possibleBinaryOrConditional.left instanceof Binary) {
135+
const leftUnwrapped = unwrapParenthesizedExpression(
136+
possibleBinaryOrConditional.left,
137+
);
138+
const rightUnwrapped = unwrapParenthesizedExpression(
139+
possibleBinaryOrConditional.right,
140+
);
141+
142+
if (
143+
leftUnwrapped instanceof Binary ||
144+
leftUnwrapped instanceof Conditional
145+
) {
134146
total += getTotalComplexity(possibleBinaryOrConditional.left);
135147
}
136148

137-
if (possibleBinaryOrConditional.right instanceof Binary) {
149+
if (
150+
rightUnwrapped instanceof Binary ||
151+
rightUnwrapped instanceof Conditional
152+
) {
138153
total += getTotalComplexity(possibleBinaryOrConditional.right);
139154
}
140155
}

0 commit comments

Comments
 (0)