Skip to content

Commit

Permalink
feat: update eslint to ^7.26.0, @typescript-eslint to 4.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed May 13, 2021
1 parent 33b7f7e commit 9e31c38
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 135 deletions.
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -67,9 +67,9 @@
"@types/jest": "^26.0.15",
"@types/node": "^10.12.2",
"@types/prettier": "^1.19.0",
"@typescript-eslint/eslint-plugin": "4.16.1",
"@typescript-eslint/parser": "4.16.1",
"eslint": "^7.6.0",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"eslint": "^7.26.0",
"eslint-config-prettier": "7.1.0",
"execa": "^3.4.0",
"husky": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-template/package.json
Expand Up @@ -24,7 +24,7 @@
"LICENSE"
],
"dependencies": {
"@typescript-eslint/experimental-utils": "4.16.1",
"@typescript-eslint/experimental-utils": "4.23.0",
"aria-query": "^4.2.2",
"axobject-query": "^2.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Expand Up @@ -24,7 +24,7 @@
"LICENSE"
],
"dependencies": {
"@typescript-eslint/experimental-utils": "4.16.1"
"@typescript-eslint/experimental-utils": "4.23.0"
},
"devDependencies": {
"@angular-eslint/utils": "12.0.0-alpha.4"
Expand Down
Expand Up @@ -12,9 +12,9 @@ Object {
"@angular/compiler-cli": "~12.0.0",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "4.16.1",
"@typescript-eslint/parser": "4.16.1",
"eslint": "^7.6.0",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"eslint": "^7.26.0",
"jasmine-core": "~3.7.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/schematics/package.json
Expand Up @@ -39,8 +39,8 @@
},
"devDependencies": {
"@types/tmp": "0.2.0",
"@typescript-eslint/experimental-utils": "4.16.1",
"eslint": "^7.6.0",
"@typescript-eslint/experimental-utils": "4.23.0",
"eslint": "^7.26.0",
"tslint-to-eslint-config": "^2.3.0"
},
"peerDependencies": {
Expand Down
Expand Up @@ -2,7 +2,13 @@ import type { Rule } from '@angular-devkit/schematics';
import { chain } from '@angular-devkit/schematics';
import { updateDependencies } from '../utils/dependencies';

const updatedAngularESLintVersion = 'next';
const updatedAngularESLintVersion = '^12.0.0';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJSON = require('../../../package.json');
const updatedTypeScriptESLintVersion =
packageJSON.devDependencies['@typescript-eslint/experimental-utils'];
const updatedESLintVersion = packageJSON.devDependencies['eslint'];

export default function migration(): Rule {
return chain([
Expand All @@ -23,6 +29,22 @@ export default function migration(): Rule {
packageName: '@angular-eslint/template-parser',
version: updatedAngularESLintVersion,
},
{
packageName: '@typescript-eslint/eslint-plugin',
version: updatedTypeScriptESLintVersion,
},
{
packageName: '@typescript-eslint/experimental-utils',
version: updatedTypeScriptESLintVersion,
},
{
packageName: '@typescript-eslint/parser',
version: updatedTypeScriptESLintVersion,
},
{
packageName: 'eslint',
version: updatedESLintVersion,
},
]),
]);
}
@@ -0,0 +1,70 @@
import {
SchematicTestRunner,
UnitTestTree,
} from '@angular-devkit/schematics/testing';
import * as path from 'path';
import { Tree } from '@angular-devkit/schematics';

const migrationSchematicRunner = new SchematicTestRunner(
'@angular-eslint/schematics',
path.join(__dirname, '../../../src/migrations.json'),
);

describe('update-12-0-0', () => {
let appTree: UnitTestTree;
beforeEach(() => {
appTree = new UnitTestTree(Tree.empty());
appTree.create(
'package.json',
JSON.stringify({
devDependencies: {
'@angular-eslint/builder': '4.3.0',
'@angular-eslint/eslint-plugin': '4.3.0',
'@angular-eslint/eslint-plugin-template': '4.3.0',
'@angular-eslint/template-parser': '4.3.0',
'@typescript-eslint/eslint-plugin': '4.16.1',
'@typescript-eslint/experimental-utils': '4.16.1',
'@typescript-eslint/parser': '4.16.1',
eslint: '^7.6.0',
},
}),
);
appTree.create(
'angular.json',
JSON.stringify({
$schema: './node_modules/@angular/cli/lib/config/schema.json',
version: 1,
newProjectRoot: 'projects',
projects: {
foo: {
root: 'projects/foo',
},
bar: {
root: 'projects/bar',
},
},
}),
);
});

it('should update relevant @angular-eslint, @typescript-eslint and eslint dependencies', async () => {
const tree = await migrationSchematicRunner
.runSchematicAsync('update-12-0-0', {}, appTree)
.toPromise();
const packageJSON = JSON.parse(tree.readContent('/package.json'));
expect(packageJSON).toMatchInlineSnapshot(`
Object {
"devDependencies": Object {
"@angular-eslint/builder": "^12.0.0",
"@angular-eslint/eslint-plugin": "^12.0.0",
"@angular-eslint/eslint-plugin-template": "^12.0.0",
"@angular-eslint/template-parser": "^12.0.0",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/experimental-utils": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"eslint": "^7.26.0",
},
}
`);
});
});
2 changes: 1 addition & 1 deletion packages/utils/package.json
Expand Up @@ -21,6 +21,6 @@
"typescript": "*"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "4.16.1"
"@typescript-eslint/experimental-utils": "4.23.0"
}
}

0 comments on commit 9e31c38

Please sign in to comment.