From a46ac63bb81ba8422c527aa0c77c0ce46d201aa4 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Wed, 30 Sep 2020 03:02:31 -0400 Subject: [PATCH] fix(linter): remove duplicate migration of disabling explicit-module-boundary-types --- .../update-eslint-builder-and-config.spec.ts | 10 ------- .../update-eslint-builder-and-config.ts | 26 +++---------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/packages/linter/src/migrations/update-10-3-0/update-eslint-builder-and-config.spec.ts b/packages/linter/src/migrations/update-10-3-0/update-eslint-builder-and-config.spec.ts index 6f76f752b294ea..888ef947169573 100644 --- a/packages/linter/src/migrations/update-10-3-0/update-eslint-builder-and-config.spec.ts +++ b/packages/linter/src/migrations/update-10-3-0/update-eslint-builder-and-config.spec.ts @@ -109,16 +109,6 @@ describe('Update eslint builder and config for 10.3.0', () => { ); }); - it('should disable the @typescript-eslint/explicit-module-boundary-types rule in the root ESLint config', async () => { - await runMigration('update-eslint-builder-and-config', {}, tree); - - const json = readJsonInTree(tree, '.eslintrc'); - - expect( - json.rules['@typescript-eslint/explicit-module-boundary-types'] - ).toEqual('off'); - }); - it('should migrate the lint builder usage to the new eslint builder', async () => { await runMigration('update-eslint-builder-and-config', {}, tree); diff --git a/packages/linter/src/migrations/update-10-3-0/update-eslint-builder-and-config.ts b/packages/linter/src/migrations/update-10-3-0/update-eslint-builder-and-config.ts index 89bbd0e5a94cd8..8175e05925df4f 100644 --- a/packages/linter/src/migrations/update-10-3-0/update-eslint-builder-and-config.ts +++ b/packages/linter/src/migrations/update-10-3-0/update-eslint-builder-and-config.ts @@ -1,17 +1,12 @@ -import { - chain, - noop, - SchematicContext, - Tree, -} from '@angular-devkit/schematics'; +import { chain, Tree } from '@angular-devkit/schematics'; import { formatFiles, readJsonInTree, - updateJsonInTree, updatePackagesInPackageJson, updateWorkspace, } from '@nrwl/workspace'; import { join } from 'path'; +import { join as devkitJoin, normalize } from '@angular-devkit/core'; /** * When migrating projects we need to look up any relevant tsconfig files @@ -62,7 +57,7 @@ function updateESLintBuilder(host: Tree) { return [...(tsconfig.include || []), ...(tsconfig.files || [])]; }) .reduce((flat, val) => flat.concat(val), []) - .map((pattern) => join(project.root, pattern)); + .map((pattern) => devkitJoin(normalize(project.root), pattern)); lintTarget.options = { lintFilePatterns, @@ -71,24 +66,9 @@ function updateESLintBuilder(host: Tree) { }); } -/** - * As part of this migration we move to v3.x of @typescript-eslint, and this means that the - * @typescript-eslint/explicit-module-boundary-types rule is now included in the recommended - * config which we extend from. We generate code that would cause warnings from the rule so - * we disable it for all files by default. - */ -function updateRootESLintConfig() { - return updateJsonInTree('.eslintrc', (json) => { - json.rules = json.rules || {}; - json.rules['@typescript-eslint/explicit-module-boundary-types'] = 'off'; - return json; - }); -} - export default function () { return chain([ updateESLintBuilder, - updateRootESLintConfig, updatePackagesInPackageJson( join(__dirname, '../../../migrations.json'), '10.3.0'