From fc77c6038157c968634e8625b667a951cf6df3a2 Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Wed, 28 Sep 2022 11:29:41 +0100 Subject: [PATCH] cleanup(repo): remove tslint --- docs/generated/packages/cypress.json | 2 +- docs/generated/packages/detox.json | 2 +- docs/generated/packages/expo.json | 4 +- docs/generated/packages/next.json | 4 +- docs/generated/packages/node.json | 4 +- docs/generated/packages/react-native.json | 4 +- docs/generated/packages/react.json | 4 +- docs/generated/packages/storybook.json | 4 +- package.json | 1 - .../application/lib/normalized-schema.ts | 5 +- .../src/generators/application/schema.d.ts | 4 +- .../angular/src/generators/host/schema.d.ts | 4 +- .../angular/src/generators/init/schema.d.ts | 2 +- .../library/lib/normalized-schema.ts | 4 +- .../src/generators/library/schema.d.ts | 4 +- .../angular/src/generators/remote/schema.d.ts | 4 +- .../storybook-configuration/schema.d.ts | 2 +- .../cypress-project.spec.ts.snap | 65 ++++++------- .../cypress-project/cypress-project.spec.ts | 10 +- .../generators/cypress-project/schema.json | 2 +- .../application/lib/add-linting.spec.ts | 21 ----- .../generators/application/lib/add-linting.ts | 8 +- .../src/generators/application/schema.json | 2 +- .../src/generators/application/schema.json | 2 +- .../expo/src/generators/library/schema.json | 2 +- packages/expo/src/utils/add-linting.spec.ts | 16 ---- packages/expo/src/utils/add-linting.ts | 8 +- packages/linter/package.json | 1 - .../init/__snapshots__/init.spec.ts.snap | 93 ------------------- .../linter/src/generators/init/init.spec.ts | 10 -- packages/linter/src/generators/init/init.ts | 90 +----------------- .../__snapshots__/lint-project.spec.ts.snap | 13 --- .../lint-project/lint-project.spec.ts | 44 +-------- .../generators/lint-project/lint-project.ts | 49 +++------- .../linter/src/generators/utils/linter.ts | 1 - packages/linter/src/utils/versions.ts | 1 - .../application/application.spec.ts | 27 +----- .../src/generators/application/schema.json | 2 +- .../next/src/generators/library/schema.json | 2 +- .../src/generators/application/schema.json | 2 +- .../node/src/generators/library/schema.json | 2 +- .../src/generators/application/schema.json | 2 +- .../component-story/component-story.spec.ts | 21 ++--- .../src/generators/library/schema.json | 2 +- .../src/utils/add-linting.spec.ts | 15 --- .../react-native/src/utils/add-linting.ts | 8 +- .../src/generators/application/schema.json | 2 +- .../component-story/component-story.spec.ts | 21 ++--- .../react/src/generators/library/library.ts | 6 +- .../react/src/generators/library/schema.json | 2 +- .../generators/configuration/configuration.ts | 2 +- .../src/generators/configuration/schema.json | 2 +- .../configuration/util-functions.ts | 2 +- .../generators/cypress-project/schema.json | 2 +- .../src/generators/library/library.spec.ts | 60 +----------- 55 files changed, 115 insertions(+), 563 deletions(-) diff --git a/docs/generated/packages/cypress.json b/docs/generated/packages/cypress.json index a2912f7b01ab8..a74de8310370d 100644 --- a/docs/generated/packages/cypress.json +++ b/docs/generated/packages/cypress.json @@ -85,7 +85,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint", "none"], + "enum": ["eslint", "none"], "default": "eslint" }, "js": { diff --git a/docs/generated/packages/detox.json b/docs/generated/packages/detox.json index 58adf81b024cd..4988301c19fb0 100644 --- a/docs/generated/packages/detox.json +++ b/docs/generated/packages/detox.json @@ -73,7 +73,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint", "none"], + "enum": ["eslint", "none"], "default": "eslint" }, "js": { diff --git a/docs/generated/packages/expo.json b/docs/generated/packages/expo.json index 306076a63425e..58790c874f16b 100644 --- a/docs/generated/packages/expo.json +++ b/docs/generated/packages/expo.json @@ -87,7 +87,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { @@ -163,7 +163,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/docs/generated/packages/next.json b/docs/generated/packages/next.json index 17b9ecf0342c9..5c1c0ec61fa61 100644 --- a/docs/generated/packages/next.json +++ b/docs/generated/packages/next.json @@ -131,7 +131,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "skipFormat": { @@ -481,7 +481,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/docs/generated/packages/node.json b/docs/generated/packages/node.json index c8e4b924e60fd..b0b3126583b50 100644 --- a/docs/generated/packages/node.json +++ b/docs/generated/packages/node.json @@ -86,7 +86,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { @@ -175,7 +175,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/docs/generated/packages/react-native.json b/docs/generated/packages/react-native.json index a274fceefbcb1..5275bf95a16e9 100644 --- a/docs/generated/packages/react-native.json +++ b/docs/generated/packages/react-native.json @@ -102,7 +102,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { @@ -180,7 +180,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/docs/generated/packages/react.json b/docs/generated/packages/react.json index 01604a3a9f580..c44e9ef1bb6ea 100644 --- a/docs/generated/packages/react.json +++ b/docs/generated/packages/react.json @@ -136,7 +136,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "routing": { @@ -304,7 +304,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/docs/generated/packages/storybook.json b/docs/generated/packages/storybook.json index 810d7e00e25bc..2a5be42bcf645 100644 --- a/docs/generated/packages/storybook.json +++ b/docs/generated/packages/storybook.json @@ -161,7 +161,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint", "none"], + "enum": ["eslint", "none"], "default": "eslint" }, "js": { @@ -225,7 +225,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint", "none"], + "enum": ["eslint", "none"], "default": "eslint" }, "standaloneConfig": { diff --git a/package.json b/package.json index dfc885c9adbe0..a35abdc639f9d 100644 --- a/package.json +++ b/package.json @@ -235,7 +235,6 @@ "ts-node": "10.9.1", "tsconfig-paths": "^3.9.0", "tsconfig-paths-webpack-plugin": "3.5.2", - "tslint": "6.1.3", "tslint-to-eslint-config": "^2.13.0", "typedoc": "0.22.9", "typedoc-plugin-markdown": "3.11.6", diff --git a/packages/angular/src/generators/application/lib/normalized-schema.ts b/packages/angular/src/generators/application/lib/normalized-schema.ts index 27e2e03f6a4b3..2a6fb1ed6bf46 100644 --- a/packages/angular/src/generators/application/lib/normalized-schema.ts +++ b/packages/angular/src/generators/application/lib/normalized-schema.ts @@ -1,8 +1,9 @@ import { E2eTestRunner, UnitTestRunner } from '../../../utils/test-runners'; -import type { AngularLinter, Schema } from '../schema'; +import type { Schema } from '../schema'; +import { Linter } from '@nrwl/linter'; export interface NormalizedSchema extends Schema { - linter: AngularLinter; + linter: Linter; unitTestRunner: UnitTestRunner; e2eTestRunner: E2eTestRunner; prefix: string; diff --git a/packages/angular/src/generators/application/schema.d.ts b/packages/angular/src/generators/application/schema.d.ts index 3ae6a81bf7b07..1e2a287bb17eb 100644 --- a/packages/angular/src/generators/application/schema.d.ts +++ b/packages/angular/src/generators/application/schema.d.ts @@ -2,8 +2,6 @@ import { Linter } from '@nrwl/linter'; import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners'; import type { Styles } from '../utils/types'; -type AngularLinter = Exclude; - export interface Schema { name: string; addTailwind?: boolean; @@ -17,7 +15,7 @@ export interface Schema { skipTests?: boolean; directory?: string; tags?: string; - linter?: AngularLinter; + linter?: Linter; unitTestRunner?: UnitTestRunner; e2eTestRunner?: E2eTestRunner; backendProject?: string; diff --git a/packages/angular/src/generators/host/schema.d.ts b/packages/angular/src/generators/host/schema.d.ts index b103fd3b53104..1fe10f32e6466 100644 --- a/packages/angular/src/generators/host/schema.d.ts +++ b/packages/angular/src/generators/host/schema.d.ts @@ -2,8 +2,6 @@ import { Linter } from '@nrwl/linter'; import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners'; import type { Styles } from '../utils/types'; -type AngularLinter = Exclude; - export interface Schema { name: string; remotes?: string[]; @@ -17,7 +15,7 @@ export interface Schema { skipTests?: boolean; directory?: string; tags?: string; - linter?: AngularLinter; + linter?: Linter; unitTestRunner?: UnitTestRunner; e2eTestRunner?: E2eTestRunner; backendProject?: string; diff --git a/packages/angular/src/generators/init/schema.d.ts b/packages/angular/src/generators/init/schema.d.ts index b093cbf6da74c..5b248839e8306 100644 --- a/packages/angular/src/generators/init/schema.d.ts +++ b/packages/angular/src/generators/init/schema.d.ts @@ -8,7 +8,7 @@ export interface Schema { skipFormat?: boolean; skipInstall?: boolean; style?: Styles; - linter?: Exclude; + linter?: Linter; skipPackageJson?: boolean; skipPostInstall?: boolean; } diff --git a/packages/angular/src/generators/library/lib/normalized-schema.ts b/packages/angular/src/generators/library/lib/normalized-schema.ts index c431f37b85980..18b7dea389eca 100644 --- a/packages/angular/src/generators/library/lib/normalized-schema.ts +++ b/packages/angular/src/generators/library/lib/normalized-schema.ts @@ -1,5 +1,5 @@ import { UnitTestRunner } from '../../../utils/test-runners'; -import type { AngularLinter } from '../schema'; +import type { Linter } from '@nrwl/linter'; export interface NormalizedSchema { libraryOptions: { @@ -28,7 +28,7 @@ export interface NormalizedSchema { skipPackageJson?: boolean; skipPostInstall?: boolean; standalone?: boolean; - linter: AngularLinter; + linter: Linter; unitTestRunner: UnitTestRunner; prefix: string; fileName: string; diff --git a/packages/angular/src/generators/library/schema.d.ts b/packages/angular/src/generators/library/schema.d.ts index 3791c31df1daf..18e641c09e99d 100644 --- a/packages/angular/src/generators/library/schema.d.ts +++ b/packages/angular/src/generators/library/schema.d.ts @@ -1,8 +1,6 @@ import { UnitTestRunner } from '../../utils/test-runners'; import { Linter } from '@nrwl/linter'; -type AngularLinter = Exclude; - export interface Schema { name: string; addTailwind?: boolean; @@ -24,7 +22,7 @@ export interface Schema { parentModule?: string; tags?: string; strict?: boolean; - linter?: AngularLinter; + linter?: Linter; unitTestRunner?: UnitTestRunner; compilationMode?: 'full' | 'partial'; setParserOptionsProject?: boolean; diff --git a/packages/angular/src/generators/remote/schema.d.ts b/packages/angular/src/generators/remote/schema.d.ts index db0a39d951b63..51a2aae188c97 100644 --- a/packages/angular/src/generators/remote/schema.d.ts +++ b/packages/angular/src/generators/remote/schema.d.ts @@ -2,8 +2,6 @@ import { Linter } from '@nrwl/linter'; import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners'; import type { Styles } from '../utils/types'; -type AngularLinter = Exclude; - export interface Schema { name: string; host?: string; @@ -16,7 +14,7 @@ export interface Schema { skipTests?: boolean; directory?: string; tags?: string; - linter?: AngularLinter; + linter?: Linter; unitTestRunner?: UnitTestRunner; e2eTestRunner?: E2eTestRunner; backendProject?: string; diff --git a/packages/angular/src/generators/storybook-configuration/schema.d.ts b/packages/angular/src/generators/storybook-configuration/schema.d.ts index d02b1453d4fa8..a0d3e99507dc7 100644 --- a/packages/angular/src/generators/storybook-configuration/schema.d.ts +++ b/packages/angular/src/generators/storybook-configuration/schema.d.ts @@ -4,7 +4,7 @@ export interface StorybookConfigurationOptions { configureCypress: boolean; generateCypressSpecs: boolean; generateStories: boolean; - linter: Exclude; + linter: Linter; name: string; cypressDirectory?: string; tsConfiguration?: boolean; diff --git a/packages/cypress/src/generators/cypress-project/__snapshots__/cypress-project.spec.ts.snap b/packages/cypress/src/generators/cypress-project/__snapshots__/cypress-project.spec.ts.snap index 37158030b760c..96d46aa11dd44 100644 --- a/packages/cypress/src/generators/cypress-project/__snapshots__/cypress-project.spec.ts.snap +++ b/packages/cypress/src/generators/cypress-project/__snapshots__/cypress-project.spec.ts.snap @@ -49,16 +49,15 @@ Object { }, }, "lint": Object { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@nrwl/linter:eslint", "options": Object { - "exclude": Array [ - "**/node_modules/**", - "!apps/my-dir/my-app-e2e/**/*", - ], - "tsConfig": Array [ - "apps/my-dir/my-app-e2e/tsconfig.json", + "lintFilePatterns": Array [ + "apps/my-dir/my-app-e2e/**/*.{js,ts}", ], }, + "outputs": Array [ + "{options.outputFile}", + ], }, } `; @@ -96,16 +95,15 @@ Object { }, }, "lint": Object { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@nrwl/linter:eslint", "options": Object { - "exclude": Array [ - "**/node_modules/**", - "!apps/my-dir/my-app-e2e/**/*", - ], - "tsConfig": Array [ - "apps/my-dir/my-app-e2e/tsconfig.json", + "lintFilePatterns": Array [ + "apps/my-dir/my-app-e2e/**/*.{js,ts}", ], }, + "outputs": Array [ + "{options.outputFile}", + ], }, } `; @@ -122,16 +120,15 @@ Object { }, }, "lint": Object { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@nrwl/linter:eslint", "options": Object { - "exclude": Array [ - "**/node_modules/**", - "!apps/my-app-e2e/**/*", - ], - "tsConfig": Array [ - "apps/my-app-e2e/tsconfig.json", + "lintFilePatterns": Array [ + "apps/my-app-e2e/**/*.{js,ts}", ], }, + "outputs": Array [ + "{options.outputFile}", + ], }, } `; @@ -153,16 +150,15 @@ Object { }, }, "lint": Object { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@nrwl/linter:eslint", "options": Object { - "exclude": Array [ - "**/node_modules/**", - "!apps/my-app-e2e/**/*", - ], - "tsConfig": Array [ - "apps/my-app-e2e/tsconfig.json", + "lintFilePatterns": Array [ + "apps/my-app-e2e/**/*.{js,ts}", ], }, + "outputs": Array [ + "{options.outputFile}", + ], }, } `; @@ -184,16 +180,15 @@ Object { }, }, "lint": Object { - "builder": "@angular-devkit/build-angular:tslint", + "builder": "@nrwl/linter:eslint", "options": Object { - "exclude": Array [ - "**/node_modules/**", - "!apps/my-app-e2e/**/*", - ], - "tsConfig": Array [ - "apps/my-app-e2e/tsconfig.json", + "lintFilePatterns": Array [ + "apps/my-app-e2e/**/*.{js,ts}", ], }, + "outputs": Array [ + "{options.outputFile}", + ], }, } `; diff --git a/packages/cypress/src/generators/cypress-project/cypress-project.spec.ts b/packages/cypress/src/generators/cypress-project/cypress-project.spec.ts index b9057f780c30b..1fa119a4be94d 100644 --- a/packages/cypress/src/generators/cypress-project/cypress-project.spec.ts +++ b/packages/cypress/src/generators/cypress-project/cypress-project.spec.ts @@ -323,7 +323,7 @@ describe('Cypress Project', () => { await cypressProjectGenerator(tree, { name: 'my-app-e2e', project: 'my-app', - linter: Linter.TsLint, + linter: Linter.EsLint, standaloneConfig: false, }); const workspaceJson = readJson(tree, 'workspace.json'); @@ -339,7 +339,7 @@ describe('Cypress Project', () => { name: 'my-app-e2e', project: 'my-app', baseUrl: 'http://localhost:3000', - linter: Linter.TsLint, + linter: Linter.EsLint, standaloneConfig: false, }); const workspaceJson = readJson(tree, 'workspace.json'); @@ -359,7 +359,7 @@ describe('Cypress Project', () => { await cypressProjectGenerator(tree, { name: 'my-app-e2e', project: 'my-app', - linter: Linter.TsLint, + linter: Linter.EsLint, standaloneConfig: false, }); const workspaceJson = readJson(tree, 'workspace.json'); @@ -376,7 +376,7 @@ describe('Cypress Project', () => { name: 'my-app-e2e', project: 'my-dir-my-app', directory: 'my-dir', - linter: Linter.TsLint, + linter: Linter.EsLint, standaloneConfig: false, }); const projectConfig = readJson(tree, 'workspace.json').projects[ @@ -413,7 +413,7 @@ describe('Cypress Project', () => { await cypressProjectGenerator(tree, { name: 'my-dir/my-app-e2e', project: 'my-dir-my-app', - linter: Linter.TsLint, + linter: Linter.EsLint, standaloneConfig: false, }); }); diff --git a/packages/cypress/src/generators/cypress-project/schema.json b/packages/cypress/src/generators/cypress-project/schema.json index 1c3b11e993487..18ede4e4bd3d5 100644 --- a/packages/cypress/src/generators/cypress-project/schema.json +++ b/packages/cypress/src/generators/cypress-project/schema.json @@ -33,7 +33,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint", "none"], + "enum": ["eslint", "none"], "default": "eslint" }, "js": { diff --git a/packages/detox/src/generators/application/lib/add-linting.spec.ts b/packages/detox/src/generators/application/lib/add-linting.spec.ts index c914dda505efe..6c4147d0e3bb0 100644 --- a/packages/detox/src/generators/application/lib/add-linting.spec.ts +++ b/packages/detox/src/generators/application/lib/add-linting.spec.ts @@ -42,27 +42,6 @@ describe('Add Linting', () => { expect(project.targets.lint.executor).toEqual('@nrwl/linter:eslint'); }); - it('should add update `workspace.json` file properly when tslint is passed', () => { - addLinting(tree, { - name: 'my-app-e2e', - projectName: 'my-app-e2e', - projectDirectory: 'apps', - projectRoot: 'apps/my-app-e2e', - project: 'my-app', - appFileName: 'my-app', - appClassName: 'MyApp', - appDisplayName: 'MyApp', - linter: Linter.TsLint, - framework: 'react-native', - }); - const project = readProjectConfiguration(tree, 'my-app-e2e'); - - expect(project.targets.lint).toBeDefined(); - expect(project.targets.lint.executor).toEqual( - '@angular-devkit/build-angular:tslint' - ); - }); - it('should not add lint target when "none" is passed', async () => { addLinting(tree, { name: 'my-app-e2e', diff --git a/packages/detox/src/generators/application/lib/add-linting.ts b/packages/detox/src/generators/application/lib/add-linting.ts index fe45376b9b330..f82fa3c454418 100644 --- a/packages/detox/src/generators/application/lib/add-linting.ts +++ b/packages/detox/src/generators/application/lib/add-linting.ts @@ -3,10 +3,10 @@ import { Linter, lintProjectGenerator } from '@nrwl/linter'; import { addDependenciesToPackageJson, joinPathFragments, - updateJson, Tree, + updateJson, } from '@nrwl/devkit'; -import { extraEslintDependencies, createReactEslintJson } from '@nrwl/react'; +import { createReactEslintJson, extraEslintDependencies } from '@nrwl/react'; import { NormalizedSchema } from './normalize-options'; export async function addLinting(host: Tree, options: NormalizedSchema) { @@ -24,10 +24,6 @@ export async function addLinting(host: Tree, options: NormalizedSchema) { skipFormat: true, }); - if (options.linter === Linter.TsLint) { - return () => {}; - } - const reactEslintJson = createReactEslintJson( options.projectRoot, options.setParserOptionsProject diff --git a/packages/detox/src/generators/application/schema.json b/packages/detox/src/generators/application/schema.json index e9f5129ed7ac4..5bf230d7b70d2 100644 --- a/packages/detox/src/generators/application/schema.json +++ b/packages/detox/src/generators/application/schema.json @@ -34,7 +34,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint", "none"], + "enum": ["eslint", "none"], "default": "eslint" }, "js": { diff --git a/packages/expo/src/generators/application/schema.json b/packages/expo/src/generators/application/schema.json index 90b56af00b4a2..144f56dcf0bd0 100644 --- a/packages/expo/src/generators/application/schema.json +++ b/packages/expo/src/generators/application/schema.json @@ -41,7 +41,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/packages/expo/src/generators/library/schema.json b/packages/expo/src/generators/library/schema.json index a0a4002403ae7..0afef6e7dca1d 100644 --- a/packages/expo/src/generators/library/schema.json +++ b/packages/expo/src/generators/library/schema.json @@ -29,7 +29,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/packages/expo/src/utils/add-linting.spec.ts b/packages/expo/src/utils/add-linting.spec.ts index 129978de7689e..4ed670d7ec7b1 100644 --- a/packages/expo/src/utils/add-linting.spec.ts +++ b/packages/expo/src/utils/add-linting.spec.ts @@ -29,22 +29,6 @@ describe('Add Linting', () => { expect(project.targets.lint.executor).toEqual('@nrwl/linter:eslint'); }); - it('should add update `project configuration` file properly when tslint is passed', () => { - addLinting( - tree, - 'my-lib', - 'libs/my-lib', - ['libs/my-lib/tsconfig.lib.json'], - Linter.TsLint - ); - const project = readProjectConfiguration(tree, 'my-lib'); - - expect(project.targets.lint).toBeDefined(); - expect(project.targets.lint.executor).toEqual( - '@angular-devkit/build-angular:tslint' - ); - }); - it('should not add lint target when "none" is passed', async () => { addLinting( tree, diff --git a/packages/expo/src/utils/add-linting.ts b/packages/expo/src/utils/add-linting.ts index a2cdb656546ec..c0c12ef7abdea 100644 --- a/packages/expo/src/utils/add-linting.ts +++ b/packages/expo/src/utils/add-linting.ts @@ -3,10 +3,10 @@ import { Linter, lintProjectGenerator } from '@nrwl/linter'; import { addDependenciesToPackageJson, joinPathFragments, - updateJson, Tree, + updateJson, } from '@nrwl/devkit'; -import { extraEslintDependencies, createReactEslintJson } from '@nrwl/react'; +import { createReactEslintJson, extraEslintDependencies } from '@nrwl/react'; import type { Linter as ESLintLinter } from 'eslint'; export async function addLinting( @@ -29,10 +29,6 @@ export async function addLinting( skipFormat: true, }); - if (linter === Linter.TsLint) { - return () => {}; - } - const reactEslintJson = createReactEslintJson( appProjectRoot, setParserOptionsProject diff --git a/packages/linter/package.json b/packages/linter/package.json index e9d54f14ae407..a34a04085f3a9 100644 --- a/packages/linter/package.json +++ b/packages/linter/package.json @@ -12,7 +12,6 @@ "Monorepo", "Web", "Lint", - "TSLint", "ESLint", "CLI" ], diff --git a/packages/linter/src/generators/init/__snapshots__/init.spec.ts.snap b/packages/linter/src/generators/init/__snapshots__/init.spec.ts.snap index fc2c19b861042..f9700629813f7 100644 --- a/packages/linter/src/generators/init/__snapshots__/init.spec.ts.snap +++ b/packages/linter/src/generators/init/__snapshots__/init.spec.ts.snap @@ -59,96 +59,3 @@ exports[`@nrwl/linter:init --linter eslint should generate the global eslint con } " `; - -exports[`@nrwl/linter:init --linter tslint should generate the global tslint config 1`] = ` -"{ - \\"rulesDirectory\\": [ - \\"node_modules/@nrwl/workspace/src/tslint\\" - ], - \\"linterOptions\\": { - \\"exclude\\": [ - \\"**/*\\" - ] - }, - \\"rules\\": { - \\"arrow-return-shorthand\\": true, - \\"callable-types\\": true, - \\"class-name\\": true, - \\"deprecation\\": { - \\"severity\\": \\"warn\\" - }, - \\"forin\\": true, - \\"import-blacklist\\": [ - true, - \\"rxjs/Rx\\" - ], - \\"interface-over-type-literal\\": true, - \\"member-access\\": false, - \\"member-ordering\\": [ - true, - { - \\"order\\": [ - \\"static-field\\", - \\"instance-field\\", - \\"static-method\\", - \\"instance-method\\" - ] - } - ], - \\"no-arg\\": true, - \\"no-bitwise\\": true, - \\"no-console\\": [ - true, - \\"debug\\", - \\"info\\", - \\"time\\", - \\"timeEnd\\", - \\"trace\\" - ], - \\"no-construct\\": true, - \\"no-debugger\\": true, - \\"no-duplicate-super\\": true, - \\"no-empty\\": false, - \\"no-empty-interface\\": true, - \\"no-eval\\": true, - \\"no-inferrable-types\\": [ - true, - \\"ignore-params\\" - ], - \\"no-misused-new\\": true, - \\"no-non-null-assertion\\": true, - \\"no-shadowed-variable\\": true, - \\"no-string-literal\\": false, - \\"no-string-throw\\": true, - \\"no-switch-case-fall-through\\": true, - \\"no-unnecessary-initializer\\": true, - \\"no-unused-expression\\": true, - \\"no-var-keyword\\": true, - \\"object-literal-sort-keys\\": false, - \\"prefer-const\\": true, - \\"radix\\": true, - \\"triple-equals\\": [ - true, - \\"allow-null-check\\" - ], - \\"unified-signatures\\": true, - \\"variable-name\\": false, - \\"nx-enforce-module-boundaries\\": [ - true, - { - \\"enforceBuildableLibDependency\\": true, - \\"allow\\": [], - \\"depConstraints\\": [ - { - \\"sourceTag\\": \\"*\\", - \\"onlyDependOnLibsWithTags\\": [ - \\"*\\" - ] - } - ] - } - ] - } -} -" -`; diff --git a/packages/linter/src/generators/init/init.spec.ts b/packages/linter/src/generators/init/init.spec.ts index a2281f0d979dd..229eb4df4b153 100644 --- a/packages/linter/src/generators/init/init.spec.ts +++ b/packages/linter/src/generators/init/init.spec.ts @@ -40,15 +40,5 @@ describe('@nrwl/linter:init', () => { expect(tree.exists('.eslintrc.json')).toBe(false); }); }); - - describe('tslint', () => { - it('should generate the global tslint config', async () => { - await lintInitGenerator(tree, { - linter: Linter.TsLint, - }); - - expect(tree.read('tslint.json', 'utf-8')).toMatchSnapshot(); - }); - }); }); }); diff --git a/packages/linter/src/generators/init/init.ts b/packages/linter/src/generators/init/init.ts index b4db914407471..d3675f26906c4 100644 --- a/packages/linter/src/generators/init/init.ts +++ b/packages/linter/src/generators/init/init.ts @@ -8,11 +8,9 @@ import { writeJson, } from '@nrwl/devkit'; import { - buildAngularVersion, eslintConfigPrettierVersion, eslintVersion, nxVersion, - tslintVersion, typescriptESLintVersion, } from '../../utils/versions'; @@ -26,70 +24,6 @@ export interface LinterInitOptions { skipPackageJson?: boolean; } -const globalTsLintConfiguration = { - rulesDirectory: ['node_modules/@nrwl/workspace/src/tslint'], - linterOptions: { - exclude: ['**/*'], - }, - rules: { - 'arrow-return-shorthand': true, - 'callable-types': true, - 'class-name': true, - deprecation: { - severity: 'warn', - }, - forin: true, - 'import-blacklist': [true, 'rxjs/Rx'], - 'interface-over-type-literal': true, - 'member-access': false, - 'member-ordering': [ - true, - { - order: [ - 'static-field', - 'instance-field', - 'static-method', - 'instance-method', - ], - }, - ], - 'no-arg': true, - 'no-bitwise': true, - 'no-console': [true, 'debug', 'info', 'time', 'timeEnd', 'trace'], - 'no-construct': true, - 'no-debugger': true, - 'no-duplicate-super': true, - 'no-empty': false, - 'no-empty-interface': true, - 'no-eval': true, - 'no-inferrable-types': [true, 'ignore-params'], - 'no-misused-new': true, - 'no-non-null-assertion': true, - 'no-shadowed-variable': true, - 'no-string-literal': false, - 'no-string-throw': true, - 'no-switch-case-fall-through': true, - 'no-unnecessary-initializer': true, - 'no-unused-expression': true, - 'no-var-keyword': true, - 'object-literal-sort-keys': false, - 'prefer-const': true, - radix: true, - 'triple-equals': [true, 'allow-null-check'], - 'unified-signatures': true, - 'variable-name': false, - - 'nx-enforce-module-boundaries': [ - true, - { - enforceBuildableLibDependency: true, - allow: [], - depConstraints: [{ sourceTag: '*', onlyDependOnLibsWithTags: ['*'] }], - }, - ], - }, -}; - const getGlobalEsLintConfiguration = (unitTestRunner?: string) => { const config: ESLint.ConfigData = { root: true, @@ -164,24 +98,6 @@ const getGlobalEsLintConfiguration = (unitTestRunner?: string) => { return config; }; -function initTsLint(tree: Tree, options: LinterInitOptions): GeneratorCallback { - if (tree.exists('/tslint.json')) { - return () => {}; - } - writeJson(tree, 'tslint.json', globalTsLintConfiguration); - - return !options.skipPackageJson - ? addDependenciesToPackageJson( - tree, - {}, - { - tslint: tslintVersion, - '@angular-devkit/build-angular': buildAngularVersion, - } - ) - : () => {}; -} - function addTargetDefaults(tree: Tree) { const workspaceConfiguration = readWorkspaceConfiguration(tree); @@ -249,9 +165,5 @@ function initEsLint(tree: Tree, options: LinterInitOptions): GeneratorCallback { } export function lintInitGenerator(tree: Tree, options: LinterInitOptions) { - if (!options.linter || options.linter === Linter.EsLint) { - return initEsLint(tree, options); - } else if (options.linter === Linter.TsLint) { - return initTsLint(tree, options); - } + return initEsLint(tree, options); } diff --git a/packages/linter/src/generators/lint-project/__snapshots__/lint-project.spec.ts.snap b/packages/linter/src/generators/lint-project/__snapshots__/lint-project.spec.ts.snap index 6f961ef85b50a..fd96b0de82605 100644 --- a/packages/linter/src/generators/lint-project/__snapshots__/lint-project.spec.ts.snap +++ b/packages/linter/src/generators/lint-project/__snapshots__/lint-project.spec.ts.snap @@ -73,16 +73,3 @@ exports[`@nrwl/linter:lint-project --linter eslint should generate a eslint conf } " `; - -exports[`@nrwl/linter:lint-project --linter tslint should generate a tslint config 1`] = ` -"{ - \\"extends\\": \\"../../tslint.json\\", - \\"linterOptions\\": { - \\"exclude\\": [ - \\"!**/*\\" - ] - }, - \\"rules\\": {} -} -" -`; diff --git a/packages/linter/src/generators/lint-project/lint-project.spec.ts b/packages/linter/src/generators/lint-project/lint-project.spec.ts index 059f99ed21539..7827017e01e5a 100644 --- a/packages/linter/src/generators/lint-project/lint-project.spec.ts +++ b/packages/linter/src/generators/lint-project/lint-project.spec.ts @@ -1,7 +1,7 @@ import { - Tree, addProjectConfiguration, readProjectConfiguration, + Tree, } from '@nrwl/devkit'; import { Linter } from '../utils/linter'; @@ -80,47 +80,5 @@ describe('@nrwl/linter:lint-project', () => { ).toMatchSnapshot(); }); }); - - describe('tslint', () => { - it('should generate a tslint config', async () => { - await lintProjectGenerator(tree, { - ...defaultOptions, - linter: Linter.TsLint, - tsConfigPaths: ['tsconfig.json'], - project: 'test-lib', - setParserOptionsProject: false, - }); - - expect( - tree.read('libs/test-lib/tslint.json', 'utf-8') - ).toMatchSnapshot(); - }); - - it('should configure the target in project configuration', async () => { - await lintProjectGenerator(tree, { - ...defaultOptions, - linter: Linter.TsLint, - tsConfigPaths: ['tsconfig.json'], - project: 'test-lib', - setParserOptionsProject: false, - }); - - const projectConfig = readProjectConfiguration(tree, 'test-lib'); - expect(projectConfig.targets.lint).toMatchInlineSnapshot(` - Object { - "executor": "@angular-devkit/build-angular:tslint", - "options": Object { - "exclude": Array [ - "**/node_modules/**", - "!libs/test-lib/**/*", - ], - "tsConfig": Array [ - "tsconfig.json", - ], - }, - } - `); - }); - }); }); }); diff --git a/packages/linter/src/generators/lint-project/lint-project.ts b/packages/linter/src/generators/lint-project/lint-project.ts index 83839f770bc18..534fd379a3f38 100644 --- a/packages/linter/src/generators/lint-project/lint-project.ts +++ b/packages/linter/src/generators/lint-project/lint-project.ts @@ -23,20 +23,6 @@ interface LintProjectOptions { unitTestRunner?: string; } -function createTsLintConfiguration( - tree: Tree, - projectConfig: ProjectConfiguration -) { - writeJson(tree, join(projectConfig.root, `tslint.json`), { - extends: `${offsetFromRoot(projectConfig.root)}tslint.json`, - // Include project files to be linted since the global one excludes all files. - linterOptions: { - exclude: ['!**/*'], - }, - rules: {}, - }); -} - function createEsLintConfiguration( tree: Tree, projectConfig: ProjectConfiguration, @@ -99,29 +85,18 @@ export async function lintProjectGenerator( }); const projectConfig = readProjectConfiguration(tree, options.project); - if (options.linter === Linter.EsLint) { - projectConfig.targets['lint'] = { - executor: '@nrwl/linter:eslint', - outputs: ['{options.outputFile}'], - options: { - lintFilePatterns: options.eslintFilePatterns, - }, - }; - createEsLintConfiguration( - tree, - projectConfig, - options.setParserOptionsProject - ); - } else { - projectConfig.targets['lint'] = { - executor: '@angular-devkit/build-angular:tslint', - options: { - tsConfig: options.tsConfigPaths, - exclude: ['**/node_modules/**', `!${projectConfig.root}/**/*`], - }, - }; - createTsLintConfiguration(tree, projectConfig); - } + projectConfig.targets['lint'] = { + executor: '@nrwl/linter:eslint', + outputs: ['{options.outputFile}'], + options: { + lintFilePatterns: options.eslintFilePatterns, + }, + }; + createEsLintConfiguration( + tree, + projectConfig, + options.setParserOptionsProject + ); updateProjectConfiguration(tree, options.project, projectConfig); diff --git a/packages/linter/src/generators/utils/linter.ts b/packages/linter/src/generators/utils/linter.ts index d766289a0bc32..21f02ed6199b4 100644 --- a/packages/linter/src/generators/utils/linter.ts +++ b/packages/linter/src/generators/utils/linter.ts @@ -1,5 +1,4 @@ export enum Linter { EsLint = 'eslint', - TsLint = 'tslint', None = 'none', } diff --git a/packages/linter/src/utils/versions.ts b/packages/linter/src/utils/versions.ts index 2112ece68e3b5..da8d229a8f57a 100644 --- a/packages/linter/src/utils/versions.ts +++ b/packages/linter/src/utils/versions.ts @@ -1,6 +1,5 @@ export const nxVersion = require('../../package.json').version; -export const tslintVersion = '~6.1.0'; export const tslintToEslintConfigVersion = '^2.13.0'; export const buildAngularVersion = '~14.2.0'; diff --git a/packages/next/src/generators/application/application.spec.ts b/packages/next/src/generators/application/application.spec.ts index 656bd5fa931f0..137a170302ab7 100644 --- a/packages/next/src/generators/application/application.spec.ts +++ b/packages/next/src/generators/application/application.spec.ts @@ -1,6 +1,5 @@ -import { Linter } from '@nrwl/linter'; import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing'; -import { getProjects, readJson, NxJsonConfiguration, Tree } from '@nrwl/devkit'; +import { getProjects, NxJsonConfiguration, readJson, Tree } from '@nrwl/devkit'; import { applicationGenerator } from './application'; @@ -403,30 +402,6 @@ describe('app', () => { `); }); }); - - describe('tslint', () => { - it('should generate files', async () => { - await applicationGenerator(tree, { - name: 'myApp', - style: 'css', - linter: Linter.TsLint, - standaloneConfig: false, - }); - - const tslintJson = readJson(tree, 'apps/my-app/tslint.json'); - expect(tslintJson).toMatchInlineSnapshot(` - Object { - "extends": "../../tslint.json", - "linterOptions": Object { - "exclude": Array [ - "!**/*", - ], - }, - "rules": Object {}, - } - `); - }); - }); }); describe('--js', () => { diff --git a/packages/next/src/generators/application/schema.json b/packages/next/src/generators/application/schema.json index 3df88fe28bb32..883f9a6f3bc3f 100644 --- a/packages/next/src/generators/application/schema.json +++ b/packages/next/src/generators/application/schema.json @@ -71,7 +71,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "skipFormat": { diff --git a/packages/next/src/generators/library/schema.json b/packages/next/src/generators/library/schema.json index 918a019187891..8d8b10f9f22db 100644 --- a/packages/next/src/generators/library/schema.json +++ b/packages/next/src/generators/library/schema.json @@ -75,7 +75,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/packages/node/src/generators/application/schema.json b/packages/node/src/generators/application/schema.json index 5171d0b667c68..46b617010860e 100644 --- a/packages/node/src/generators/application/schema.json +++ b/packages/node/src/generators/application/schema.json @@ -32,7 +32,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/packages/node/src/generators/library/schema.json b/packages/node/src/generators/library/schema.json index 2ad3588e0e4e8..d0100170fa4ae 100644 --- a/packages/node/src/generators/library/schema.json +++ b/packages/node/src/generators/library/schema.json @@ -34,7 +34,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/packages/react-native/src/generators/application/schema.json b/packages/react-native/src/generators/application/schema.json index 2130a3413219a..6f542af6475b7 100644 --- a/packages/react-native/src/generators/application/schema.json +++ b/packages/react-native/src/generators/application/schema.json @@ -42,7 +42,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/packages/react-native/src/generators/component-story/component-story.spec.ts b/packages/react-native/src/generators/component-story/component-story.spec.ts index c5116819cecad..f754f4ba5d1f7 100644 --- a/packages/react-native/src/generators/component-story/component-story.spec.ts +++ b/packages/react-native/src/generators/component-story/component-story.spec.ts @@ -15,7 +15,7 @@ describe('react-native:component-story', () => { describe('default setup', () => { beforeEach(async () => { - appTree = await createTestUILib('test-ui-lib', true); + appTree = await createTestUILib('test-ui-lib'); }); describe('when file does not contain a component', () => { @@ -376,7 +376,7 @@ describe('react-native:component-story', () => { describe('using eslint', () => { beforeEach(async () => { - appTree = await createTestUILib('test-ui-lib', false); + appTree = await createTestUILib('test-ui-lib'); await componentGenerator(appTree, { name: 'test-ui-lib', project: 'test-ui-lib', @@ -404,16 +404,13 @@ describe('react-native:component-story', () => { }); }); -export async function createTestUILib( - libName: string, - useEsLint = false -): Promise { +export async function createTestUILib(libName: string): Promise { let appTree = createTreeWithEmptyWorkspace(); appTree.write('.gitignore', ''); await libraryGenerator(appTree, { name: libName, - linter: useEsLint ? Linter.EsLint : Linter.TsLint, + linter: Linter.EsLint, skipFormat: true, skipTsConfig: false, unitTestRunner: 'jest', @@ -425,14 +422,12 @@ export async function createTestUILib( export: true, }); - if (useEsLint) { - const currentWorkspaceJson = getProjects(appTree); + const currentWorkspaceJson = getProjects(appTree); - const projectConfig = currentWorkspaceJson.get(libName); - projectConfig.targets.lint.options.linter = 'eslint'; + const projectConfig = currentWorkspaceJson.get(libName); + projectConfig.targets.lint.options.linter = 'eslint'; - updateProjectConfiguration(appTree, libName, projectConfig); - } + updateProjectConfiguration(appTree, libName, projectConfig); return appTree; } diff --git a/packages/react-native/src/generators/library/schema.json b/packages/react-native/src/generators/library/schema.json index a86bfd2f6ef51..78f0ca9b6bd22 100644 --- a/packages/react-native/src/generators/library/schema.json +++ b/packages/react-native/src/generators/library/schema.json @@ -30,7 +30,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/packages/react-native/src/utils/add-linting.spec.ts b/packages/react-native/src/utils/add-linting.spec.ts index bf56bc0341288..0a74ee3824fdf 100644 --- a/packages/react-native/src/utils/add-linting.spec.ts +++ b/packages/react-native/src/utils/add-linting.spec.ts @@ -28,21 +28,6 @@ describe('Add Linting', () => { expect(project.targets.lint.executor).toEqual('@nrwl/linter:eslint'); }); - it('should add update `workspace.json` file properly when tslint is passed', () => { - addLinting(tree, { - projectName: 'my-lib', - linter: Linter.TsLint, - tsConfigPaths: ['libs/my-lib/tsconfig.lib.json'], - projectRoot: 'libs/my-lib', - }); - const project = readProjectConfiguration(tree, 'my-lib'); - - expect(project.targets.lint).toBeDefined(); - expect(project.targets.lint.executor).toEqual( - '@angular-devkit/build-angular:tslint' - ); - }); - it('should not add lint target when "none" is passed', async () => { addLinting(tree, { projectName: 'my-lib', diff --git a/packages/react-native/src/utils/add-linting.ts b/packages/react-native/src/utils/add-linting.ts index 3519c866ba116..5b9b0ca011b34 100644 --- a/packages/react-native/src/utils/add-linting.ts +++ b/packages/react-native/src/utils/add-linting.ts @@ -3,10 +3,10 @@ import { Linter, lintProjectGenerator } from '@nrwl/linter'; import { addDependenciesToPackageJson, joinPathFragments, - updateJson, Tree, + updateJson, } from '@nrwl/devkit'; -import { extraEslintDependencies, createReactEslintJson } from '@nrwl/react'; +import { createReactEslintJson, extraEslintDependencies } from '@nrwl/react'; import type { Linter as ESLintLinter } from 'eslint'; interface NormalizedSchema { @@ -30,10 +30,6 @@ export async function addLinting(host: Tree, options: NormalizedSchema) { skipFormat: true, }); - if (options.linter === Linter.TsLint) { - return () => {}; - } - const reactEslintJson = createReactEslintJson( options.projectRoot, options.setParserOptionsProject diff --git a/packages/react/src/generators/application/schema.json b/packages/react/src/generators/application/schema.json index 6a15950112328..94d423846506b 100644 --- a/packages/react/src/generators/application/schema.json +++ b/packages/react/src/generators/application/schema.json @@ -82,7 +82,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "routing": { diff --git a/packages/react/src/generators/component-story/component-story.spec.ts b/packages/react/src/generators/component-story/component-story.spec.ts index b287a819b1baf..1b06ad2a37894 100644 --- a/packages/react/src/generators/component-story/component-story.spec.ts +++ b/packages/react/src/generators/component-story/component-story.spec.ts @@ -12,7 +12,7 @@ describe('react:component-story', () => { describe('default setup', () => { beforeEach(async () => { - appTree = await createTestUILib('test-ui-lib', true); + appTree = await createTestUILib('test-ui-lib'); }); describe('when file does not contain a component', () => { @@ -677,7 +677,7 @@ describe('react:component-story', () => { describe('using eslint', () => { beforeEach(async () => { - appTree = await createTestUILib('test-ui-lib', false); + appTree = await createTestUILib('test-ui-lib'); await componentStoryGenerator(appTree, { componentPath: 'lib/test-ui-lib.tsx', project: 'test-ui-lib', @@ -705,14 +705,11 @@ describe('react:component-story', () => { }); }); -export async function createTestUILib( - libName: string, - useEsLint = false -): Promise { +export async function createTestUILib(libName: string): Promise { let appTree = createTreeWithEmptyV1Workspace(); await libraryGenerator(appTree, { name: libName, - linter: useEsLint ? Linter.EsLint : Linter.TsLint, + linter: Linter.EsLint, component: true, skipFormat: true, skipTsConfig: false, @@ -721,14 +718,12 @@ export async function createTestUILib( standaloneConfig: false, }); - if (useEsLint) { - const currentWorkspaceJson = getProjects(appTree); + const currentWorkspaceJson = getProjects(appTree); - const projectConfig = currentWorkspaceJson.get(libName); - projectConfig.targets.lint.options.linter = 'eslint'; + const projectConfig = currentWorkspaceJson.get(libName); + projectConfig.targets.lint.options.linter = 'eslint'; - updateProjectConfiguration(appTree, libName, projectConfig); - } + updateProjectConfiguration(appTree, libName, projectConfig); return appTree; } diff --git a/packages/react/src/generators/library/library.ts b/packages/react/src/generators/library/library.ts index c23024950db1f..af6ae69139495 100644 --- a/packages/react/src/generators/library/library.ts +++ b/packages/react/src/generators/library/library.ts @@ -19,7 +19,7 @@ import { import { getImportPath } from 'nx/src/utils/path'; import { jestProjectGenerator } from '@nrwl/jest'; import { swcCoreVersion } from '@nrwl/js/src/utils/versions'; -import { Linter, lintProjectGenerator } from '@nrwl/linter'; +import { lintProjectGenerator } from '@nrwl/linter'; import { runTasksInSerial } from '@nrwl/workspace/src/utilities/run-tasks-in-serial'; import { getRelativePathToRootTsConfig, @@ -152,10 +152,6 @@ async function addLinting(host: Tree, options: NormalizedSchema) { skipFormat: true, }); - if (options.linter === Linter.TsLint) { - return; - } - const reactEslintJson = createReactEslintJson( options.projectRoot, options.setParserOptionsProject diff --git a/packages/react/src/generators/library/schema.json b/packages/react/src/generators/library/schema.json index 8da59cea89d33..48978afda93b7 100644 --- a/packages/react/src/generators/library/schema.json +++ b/packages/react/src/generators/library/schema.json @@ -75,7 +75,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint"], + "enum": ["eslint"], "default": "eslint" }, "unitTestRunner": { diff --git a/packages/storybook/src/generators/configuration/configuration.ts b/packages/storybook/src/generators/configuration/configuration.ts index 9bdd602f4cde9..62766dbbfea3e 100644 --- a/packages/storybook/src/generators/configuration/configuration.ts +++ b/packages/storybook/src/generators/configuration/configuration.ts @@ -135,7 +135,7 @@ function normalizeSchema( ): StorybookConfigureSchema { const defaults = { configureCypress: true, - linter: Linter.TsLint, + linter: Linter.EsLint, js: false, }; return { diff --git a/packages/storybook/src/generators/configuration/schema.json b/packages/storybook/src/generators/configuration/schema.json index e64b810a8cf8c..4365ed1a29a5b 100644 --- a/packages/storybook/src/generators/configuration/schema.json +++ b/packages/storybook/src/generators/configuration/schema.json @@ -44,7 +44,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint", "none"], + "enum": ["eslint", "none"], "default": "eslint" }, "js": { diff --git a/packages/storybook/src/generators/configuration/util-functions.ts b/packages/storybook/src/generators/configuration/util-functions.ts index 100e2aacbfb8f..0fb15d4242fdf 100644 --- a/packages/storybook/src/generators/configuration/util-functions.ts +++ b/packages/storybook/src/generators/configuration/util-functions.ts @@ -262,7 +262,7 @@ export function normalizeSchema( ): StorybookConfigureSchema { const defaults = { configureCypress: true, - linter: Linter.TsLint, + linter: Linter.EsLint, js: false, }; return { diff --git a/packages/storybook/src/generators/cypress-project/schema.json b/packages/storybook/src/generators/cypress-project/schema.json index fa85a557b8937..6a72f16eb4f96 100644 --- a/packages/storybook/src/generators/cypress-project/schema.json +++ b/packages/storybook/src/generators/cypress-project/schema.json @@ -29,7 +29,7 @@ "linter": { "description": "The tool to use for running lint checks.", "type": "string", - "enum": ["eslint", "tslint", "none"], + "enum": ["eslint", "none"], "default": "eslint" }, "standaloneConfig": { diff --git a/packages/workspace/src/generators/library/library.spec.ts b/packages/workspace/src/generators/library/library.spec.ts index 9a8abbf763d48..847f895706a8d 100644 --- a/packages/workspace/src/generators/library/library.spec.ts +++ b/packages/workspace/src/generators/library/library.spec.ts @@ -1,7 +1,7 @@ import { - readProjectConfiguration, getProjects, readJson, + readProjectConfiguration, Tree, updateJson, } from '@nrwl/devkit'; @@ -496,64 +496,6 @@ describe('lib', () => { }); }); }); - - describe('tslint', () => { - it('should add tslint dependencies', async () => { - await libraryGenerator(tree, { - ...defaultOptions, - name: 'myLib', - linter: 'tslint', - }); - - const packageJson = readJson(tree, 'package.json'); - expect(packageJson.devDependencies['tslint']).toBeDefined(); - expect( - packageJson.devDependencies['@angular-devkit/build-angular'] - ).toBeDefined(); - }); - - it('should update workspace.json', async () => { - await libraryGenerator(tree, { - ...defaultOptions, - name: 'myLib', - directory: 'myDir', - linter: 'tslint', - }); - - const workspaceJson = readJson(tree, 'workspace.json'); - expect(workspaceJson.projects['my-dir-my-lib'].architect.lint).toEqual({ - builder: '@angular-devkit/build-angular:tslint', - options: { - exclude: ['**/node_modules/**', '!libs/my-dir/my-lib/**/*'], - tsConfig: [ - 'libs/my-dir/my-lib/tsconfig.lib.json', - 'libs/my-dir/my-lib/tsconfig.spec.json', - ], - }, - }); - }); - - it('should create a local tslint.json', async () => { - await libraryGenerator(tree, { - ...defaultOptions, - name: 'myLib', - directory: 'myDir', - linter: 'tslint', - }); - const tslintJson = readJson(tree, 'libs/my-dir/my-lib/tslint.json'); - expect(tslintJson).toMatchInlineSnapshot(` - Object { - "extends": "../../../tslint.json", - "linterOptions": Object { - "exclude": Array [ - "!**/*", - ], - }, - "rules": Object {}, - } - `); - }); - }); }); describe('--unit-test-runner none', () => {