feat(linter): remove tslint support (#12279)
This commit is contained in:
parent
56957cc292
commit
09c6ccb266
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<Linter, Linter.TsLint>;
|
||||
|
||||
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;
|
||||
|
||||
@ -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<Linter, Linter.TsLint>;
|
||||
|
||||
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;
|
||||
|
||||
@ -8,7 +8,7 @@ export interface Schema {
|
||||
skipFormat?: boolean;
|
||||
skipInstall?: boolean;
|
||||
style?: Styles;
|
||||
linter?: Exclude<Linter, Linter.TsLint>;
|
||||
linter?: Linter;
|
||||
skipPackageJson?: boolean;
|
||||
skipPostInstall?: boolean;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import { UnitTestRunner } from '../../utils/test-runners';
|
||||
import { Linter } from '@nrwl/linter';
|
||||
|
||||
type AngularLinter = Exclude<Linter, Linter.TsLint>;
|
||||
|
||||
export interface Schema {
|
||||
name: string;
|
||||
addTailwind?: boolean;
|
||||
@ -24,7 +22,7 @@ export interface Schema {
|
||||
parent?: string;
|
||||
tags?: string;
|
||||
strict?: boolean;
|
||||
linter?: AngularLinter;
|
||||
linter?: Linter;
|
||||
unitTestRunner?: UnitTestRunner;
|
||||
compilationMode?: 'full' | 'partial';
|
||||
setParserOptionsProject?: boolean;
|
||||
|
||||
@ -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<Linter, Linter.TsLint>;
|
||||
|
||||
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;
|
||||
|
||||
@ -4,7 +4,7 @@ export interface StorybookConfigurationOptions {
|
||||
configureCypress: boolean;
|
||||
generateCypressSpecs: boolean;
|
||||
generateStories: boolean;
|
||||
linter: Exclude<Linter, Linter.TsLint>;
|
||||
linter: Linter;
|
||||
name: string;
|
||||
cypressDirectory?: string;
|
||||
tsConfiguration?: boolean;
|
||||
|
||||
@ -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}",
|
||||
],
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
@ -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,
|
||||
});
|
||||
});
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"unitTestRunner": {
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"unitTestRunner": {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
"Monorepo",
|
||||
"Web",
|
||||
"Lint",
|
||||
"TSLint",
|
||||
"ESLint",
|
||||
"CLI"
|
||||
],
|
||||
|
||||
@ -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\\": [
|
||||
\\"*\\"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
||||
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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\\": {}
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
||||
@ -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",
|
||||
],
|
||||
},
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
export enum Linter {
|
||||
EsLint = 'eslint',
|
||||
TsLint = 'tslint',
|
||||
None = 'none',
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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', () => {
|
||||
|
||||
@ -71,7 +71,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"skipFormat": {
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"unitTestRunner": {
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"unitTestRunner": {
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"unitTestRunner": {
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"unitTestRunner": {
|
||||
|
||||
@ -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<Tree> {
|
||||
export async function createTestUILib(libName: string): Promise<Tree> {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"unitTestRunner": {
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"routing": {
|
||||
|
||||
@ -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<Tree> {
|
||||
export async function createTestUILib(libName: string): Promise<Tree> {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
"linter": {
|
||||
"description": "The tool to use for running lint checks.",
|
||||
"type": "string",
|
||||
"enum": ["eslint", "tslint"],
|
||||
"enum": ["eslint"],
|
||||
"default": "eslint"
|
||||
},
|
||||
"unitTestRunner": {
|
||||
|
||||
@ -135,7 +135,7 @@ function normalizeSchema(
|
||||
): StorybookConfigureSchema {
|
||||
const defaults = {
|
||||
configureCypress: true,
|
||||
linter: Linter.TsLint,
|
||||
linter: Linter.EsLint,
|
||||
js: false,
|
||||
};
|
||||
return {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -262,7 +262,7 @@ export function normalizeSchema(
|
||||
): StorybookConfigureSchema {
|
||||
const defaults = {
|
||||
configureCypress: true,
|
||||
linter: Linter.TsLint,
|
||||
linter: Linter.EsLint,
|
||||
js: false,
|
||||
};
|
||||
return {
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user