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(linter): remove duplicate migration of disabling explicit-module-… #3837

Merged
merged 1 commit into from
Sep 30, 2020
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
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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()]);
}