From 513e1f67d9e02217c16222dcb87378a04d6e509b 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 | 43 +++---------------- 2 files changed, 5 insertions(+), 48 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 6f76f752b294e..888ef94716957 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 89bbd0e5a94cd..c01c54e38ab1d 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,6 @@ -import { - chain, - noop, - SchematicContext, - Tree, -} from '@angular-devkit/schematics'; -import { - formatFiles, - readJsonInTree, - updateJsonInTree, - updatePackagesInPackageJson, - updateWorkspace, -} from '@nrwl/workspace'; -import { join } from 'path'; +import { chain, Tree } from '@angular-devkit/schematics'; +import { formatFiles, readJsonInTree, updateWorkspace } from '@nrwl/workspace'; +import { join, normalize } from '@angular-devkit/core'; /** * When migrating projects we need to look up any relevant tsconfig files @@ -62,7 +51,7 @@ function updateESLintBuilder(host: Tree) { return [...(tsconfig.include || []), ...(tsconfig.files || [])]; }) .reduce((flat, val) => flat.concat(val), []) - .map((pattern) => join(project.root, pattern)); + .map((pattern) => join(normalize(project.root), pattern)); lintTarget.options = { lintFilePatterns, @@ -71,28 +60,6 @@ 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' - ), - formatFiles(), - ]); + return chain([updateESLintBuilder, formatFiles()]); }