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

fix: support TS 4.8 with Angular 14.2, update dependencies #1123

Merged
merged 1 commit into from Sep 8, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions README.md
Expand Up @@ -347,11 +347,6 @@ Let's take a look at full (but minimal), manual example of a config file (**alth

> If I wanted to include other source code related rules extends etc, such as extending from `eslint:recommended`, then I would include that in the `"extends": []` within the `*.ts` override block, NOT the root of the config object.

Our schematics already do the "right" thing for you automatically in this regard, but if you have to configure things manually for whatever reason, **a full reference configuration example** can be found in the manual integration test located within this monorepo. Check out the relevant configuration files:

- [packages/integration-tests/fixtures/v1123-multi-project-manual-config/.eslintrc.json](./packages/integration-tests/fixtures/v1123-multi-project-manual-config/.eslintrc.json)
- [packages/integration-tests/fixtures/v1123-multi-project-manual-config/angular.json](./packages/integration-tests/fixtures/v1123-multi-project-manual-config/angular.json)

If you are looking for general help in migrating specific rules from TSLint to ESLint, you can check out this incredible project that we depend on in our conversion schematic: https://github.com/typescript-eslint/tslint-to-eslint-config

## Premade configs provided by this project
Expand Down Expand Up @@ -397,6 +392,8 @@ If for some reason you wanted to not include any of the premade recommended conf
}
```

Our schematics already do the "right" thing for you automatically in this regard, but if you have to configure things manually for whatever reason, **please always use the file based overrides as shown in all the examples above**.

<br>

## Notes for `eslint-plugin-prettier` users
Expand Down
54 changes: 28 additions & 26 deletions package.json
Expand Up @@ -53,43 +53,45 @@
"devDependencies": {
"@actions/core": "1.9.1",
"@actions/github": "5.0.3",
"@angular/cli": "14.1.3",
"@angular/compiler": "14.1.3",
"@commitlint/cli": "17.0.2",
"@commitlint/config-conventional": "17.0.2",
"@nrwl/devkit": "14.5.9",
"@nrwl/jest": "14.5.9",
"@nrwl/nx-cloud": "14.4.1",
"@nrwl/workspace": "14.5.9",
"@schematics/angular": "14.1.3",
"@types/eslint": "8.4.3",
"@types/eslint-scope": "3.7.3",
"@types/jest": "28.1.1",
"@angular/cli": "14.2.2",
"@angular/compiler": "14.2.1",
"@commitlint/cli": "17.1.2",
"@commitlint/config-conventional": "17.1.0",
"@nrwl/devkit": "14.6.5",
"@nrwl/jest": "14.6.5",
"@nrwl/nx-cloud": "14.6.2",
"@nrwl/workspace": "14.6.5",
"@schematics/angular": "14.2.2",
"@types/eslint": "8.4.6",
"@types/eslint-scope": "3.7.4",
"@types/jest": "28.1.8",
"@types/node": "16.11.41",
"@types/prettier": "2.6.3",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"@typescript-eslint/eslint-plugin": "5.36.2",
"@typescript-eslint/parser": "5.36.2",
"env-cmd": "10.1.0",
"eslint": "8.18.0",
"eslint": "8.23.0",
"eslint-config-prettier": "8.5.0",
"execa": "5.1.1",
"husky": "8.0.1",
"jest": "28.1.0",
"jest-preset-angular": "12.1.0",
"json-schema-to-typescript": "10.1.5",
"jest": "28.1.3",
"jest-environment-jsdom": "28.1.1",
"jest-preset-angular": "12.2.2",
"json-schema-to-typescript": "11.0.2",
"json-schema-traverse": "1.0.0",
"lerna": "5.1.4",
"lint-staged": "13.0.2",
"microbundle": "0.15.0",
"lerna": "5.5.0",
"lint-staged": "13.0.3",
"microbundle": "0.15.1",
"ncp": "2.0.0",
"nx": "14.5.9",
"nx": "14.6.5",
"prettier": "2.7.1",
"rimraf": "3.0.2",
"strip-ansi": "6.0.1",
"terser": "5.14.2",
"terser": "5.15.0",
"tree-kill": "1.2.2",
"ts-jest": "28.0.4",
"ts-jest": "28.0.8",
"ts-node": "10.9.1",
"typescript": "4.7.4"
}
"typescript": "4.8.2"
},
"dependencies": {}
}
4 changes: 2 additions & 2 deletions packages/builder/package.json
Expand Up @@ -19,8 +19,8 @@
],
"builders": "./builders.json",
"dependencies": {
"@nrwl/devkit": "^14.5.9",
"nx": "^14.5.9"
"@nrwl/devkit": "^14.6.5",
"nx": "^14.6.5"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/eslint-plugin-template/package.json
Expand Up @@ -18,8 +18,9 @@
],
"dependencies": {
"@angular-eslint/bundled-angular-compiler": "14.0.3",
"@typescript-eslint/utils": "5.29.0",
"aria-query": "5.0.0",
"@typescript-eslint/type-utils": "5.36.2",
"@typescript-eslint/utils": "5.36.2",
"aria-query": "5.0.2",
"axobject-query": "3.0.1"
},
"devDependencies": {
Expand Down
24 changes: 14 additions & 10 deletions packages/eslint-plugin-template/src/processors.ts
@@ -1,4 +1,5 @@
import { basename } from 'path';
import { getDecorators } from '@typescript-eslint/type-utils';
import ts from 'typescript';

const rangeMap = new Map();
Expand Down Expand Up @@ -66,7 +67,7 @@ export function preprocessComponentFile(

const classDeclarations = sourceFile.statements.filter((s) =>
ts.isClassDeclaration(s),
);
) as ts.ClassDeclaration[];
if (!classDeclarations || !classDeclarations.length) {
return noopResult;
}
Expand All @@ -76,15 +77,18 @@ export function preprocessComponentFile(
*/
const componentDecoratorNodes: ts.Decorator[] = [];
for (const classDeclaration of classDeclarations) {
if (classDeclaration.decorators) {
for (const decorator of classDeclaration.decorators) {
if (
ts.isCallExpression(decorator.expression) &&
ts.isIdentifier(decorator.expression.expression) &&
decorator.expression.expression.text === 'Component'
) {
componentDecoratorNodes.push(decorator);
}
// NOTE: Intentionally not using ts.getDecorators() as it did not exist prior to TS 4.8
const classDecorators = getDecorators(classDeclaration);
if (!classDecorators) {
continue;
}
for (const decorator of classDecorators) {
if (
ts.isCallExpression(decorator.expression) &&
ts.isIdentifier(decorator.expression.expression) &&
decorator.expression.expression.text === 'Component'
) {
componentDecoratorNodes.push(decorator);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Expand Up @@ -18,7 +18,7 @@
],
"dependencies": {
"@angular-eslint/utils": "14.0.3",
"@typescript-eslint/utils": "5.29.0"
"@typescript-eslint/utils": "5.36.2"
},
"peerDependencies": {
"eslint": "^7.0.0 || ^8.0.0",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.