Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Angular 18 #160

Merged
merged 14 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "Update to Angular 18",
"packageName": "@ni/eslint-config-angular",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Update version of @typescript-eslint/parser and @typescript-eslint/eslint-plugin",
"packageName": "@ni/eslint-config-typescript",
"email": "[email protected]",
"dependentChangeType": "patch"
}
7,674 changes: 2,163 additions & 5,511 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/eslint-config-angular/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ module.exports = {
https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.json
*/

'@angular-eslint/no-host-metadata-property': 'error',

/*
'@angular-eslint/no-input-rename' rule notes:
Disallow renaming directive inputs generally. Use an inline comment to disable the rule for exceptions where the
Expand Down Expand Up @@ -91,6 +93,8 @@ module.exports = {

'@angular-eslint/relative-url-prefix': 'error',

'@angular-eslint/runtime-localize': 'error',

/*
Generally not expected in practice to sort NgModule metadata arrays. Projects may enable if desired.
*/
Expand Down
10 changes: 5 additions & 5 deletions packages/eslint-config-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"!/tools"
],
"peerDependencies": {
"@angular-eslint/builder": "^17.5.2",
"@angular-eslint/eslint-plugin": "^17.5.2",
"@angular-eslint/eslint-plugin-template": "^17.5.2",
"@angular-eslint/schematics": "^17.5.2",
"@angular-eslint/template-parser": "^17.5.2",
"@angular-eslint/builder": "^18.4.3",
"@angular-eslint/eslint-plugin": "^18.4.3",
"@angular-eslint/eslint-plugin-template": "^18.4.3",
"@angular-eslint/schematics": "^18.4.3",
"@angular-eslint/template-parser": "^18.4.3",
"@ni/eslint-config-typescript": "^4.4.0"
}
}
16 changes: 11 additions & 5 deletions packages/eslint-config-typescript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
extends: [
'@ni/eslint-config-javascript',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:import/typescript',
'./lib/extensions'
],
Expand Down Expand Up @@ -29,8 +30,6 @@ module.exports = {

'@typescript-eslint/explicit-module-boundary-types': 'error',

'@typescript-eslint/no-explicit-any': 'error',

/*
[strict-null-checks]
With `stickNullChecks` disabled, non-null assertions are discouraged (this rule is configured as 'error')
Expand All @@ -40,6 +39,15 @@ module.exports = {
*/
'@typescript-eslint/no-non-null-assertion': 'error',

'valid-typeof': 'off',

/*
Overrides to TypeScript stylistic rules:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/stylistic.ts
*/

'@typescript-eslint/consistent-generic-constructors': 'off',

/*
Overrides to Typescript rules outside of the recommended configuration:
*/
Expand Down Expand Up @@ -200,8 +208,6 @@ module.exports = {

'@typescript-eslint/prefer-literal-enum-member': 'error',

'@typescript-eslint/prefer-optional-chain': 'error',

'@typescript-eslint/prefer-ts-expect-error': 'error',

/*
Expand All @@ -218,6 +224,6 @@ module.exports = {
*/
'@typescript-eslint/typedef': 'off',

'@typescript-eslint/unified-signatures': 'error'
'@typescript-eslint/unified-signatures': 'error',
}
};
4 changes: 2 additions & 2 deletions packages/eslint-config-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
],
"peerDependencies": {
"@ni/eslint-config-javascript": "^4.3.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^5.62.0"
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^7.18.0"
}
}
24 changes: 18 additions & 6 deletions packages/eslint-config-typescript/requiring-type-checking.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
module.exports = {
extends: [
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'./lib/extensions-requiring-type-checking'
],
parser: '@typescript-eslint/parser',
rules: {
/*
Overrides to TypeScript recommended rules:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts
https://github.com/typescript-eslint/typescript-eslint/tree/v7.18.0/packages/eslint-plugin/src/configs/recommended-type-checked.ts
*/

/*
Allow usage of String.prototype.match for regular expression matching.
*/
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/no-duplicate-enum-values': 'off',
'@typescript-eslint/no-duplicate-type-constituents': 'off',
'@typescript-eslint/no-loss-of-precision': 'off',
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',

/*
This rule can be confusing if you're not familiar with JavaScript's rules for binding `this`,
Expand Down Expand Up @@ -48,6 +51,13 @@ module.exports = {
*/
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],

/*
Overrides to TypeScript type-checked stylistic rules:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/stylistic-type-checked.ts
*/

'@typescript-eslint/prefer-regexp-exec': 'off',

/*
Overrides to Typescript rules outside of the recommended configuration:
*/
Expand Down Expand Up @@ -124,6 +134,8 @@ module.exports = {
*/
'@typescript-eslint/prefer-nullish-coalescing': 'off',

'@typescript-eslint/prefer-optional-chain': 'error',

'@typescript-eslint/prefer-readonly': 'error',

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// eslint-plugin-import doesn't know how to resolve entry points in commonjs modules that are
// declared using "export" rather than the old "main" syntax in package.json.
// See https://github.com/typescript-eslint/typescript-eslint/issues/7565
// and https://github.com/import-js/eslint-plugin-import/issues/2703
// eslint-disable-next-line import/no-unresolved
const plugin = require('@typescript-eslint/eslint-plugin');

const isTrue = val => val !== undefined && val !== false;
Expand Down
2 changes: 1 addition & 1 deletion tests/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@ni/eslint-config-angular": "*"
},
"dependencies": {
"@angular/core": "^17.3.12"
"@angular/core": "^18.2.13"
},
"devDependencies": {
"@types/jasmine": "^5.1.4"
Expand Down
2 changes: 1 addition & 1 deletion tests/print-evaluated-rules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"print-evaluated-rules:no-audit": "node index.js --no-audit"
},
"peerDependencies": {
"@angular-eslint/eslint-plugin": "^17.5.2",
"@angular-eslint/eslint-plugin": "^18.4.3",
"@ni/angular-test": "*",
"@ni/eslint-config-angular": "*",
"@ni/javascript-test": "*",
Expand Down