fix(linter): remove leftovers after tslint support removal (#12313)
This commit is contained in:
parent
2f0d61f2dd
commit
d91c7ca4ec
@ -82,7 +82,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"unitTestRunner": {
|
"unitTestRunner": {
|
||||||
|
|||||||
@ -104,14 +104,14 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The name of the configuration file.",
|
"description": "The name of the configuration file.",
|
||||||
"x-completion-type": "file",
|
"x-completion-type": "file",
|
||||||
"x-completion-glob": "(tslint.json|.eslintrc.json)"
|
"x-completion-glob": ".eslintrc.json)"
|
||||||
},
|
},
|
||||||
"tsConfig": {
|
"tsConfig": {
|
||||||
"description": "The name of the TypeScript configuration file.",
|
"description": "The name of the TypeScript configuration file.",
|
||||||
|
|||||||
@ -50,9 +50,8 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint",
|
"default": "eslint"
|
||||||
"x-deprecated": "TSLint support is deprecated and will be removed"
|
|
||||||
},
|
},
|
||||||
"unitTestRunner": {
|
"unitTestRunner": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@ -375,7 +375,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"standaloneConfig": {
|
"standaloneConfig": {
|
||||||
|
|||||||
@ -645,7 +645,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"standaloneConfig": {
|
"standaloneConfig": {
|
||||||
@ -956,7 +956,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"skipFormat": {
|
"skipFormat": {
|
||||||
@ -1113,7 +1113,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"routing": {
|
"routing": {
|
||||||
|
|||||||
@ -120,7 +120,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"skipFormat": {
|
"skipFormat": {
|
||||||
|
|||||||
@ -135,7 +135,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["tslint", "eslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
@ -340,7 +340,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["tslint", "eslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"packageManager": {
|
"packageManager": {
|
||||||
|
|||||||
@ -14,6 +14,6 @@ export interface GeneratorOptions {
|
|||||||
skipInstall?: boolean;
|
skipInstall?: boolean;
|
||||||
skipPostInstall?: boolean;
|
skipPostInstall?: boolean;
|
||||||
style?: Styles;
|
style?: Styles;
|
||||||
linter?: Exclude<Linter, Linter.TsLint>;
|
linter?: Linter;
|
||||||
skipPackageJson?: boolean;
|
skipPackageJson?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"unitTestRunner": {
|
"unitTestRunner": {
|
||||||
|
|||||||
@ -8,14 +8,14 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The name of the configuration file.",
|
"description": "The name of the configuration file.",
|
||||||
"x-completion-type": "file",
|
"x-completion-type": "file",
|
||||||
"x-completion-glob": "(tslint.json|.eslintrc.json)"
|
"x-completion-glob": ".eslintrc.json)"
|
||||||
},
|
},
|
||||||
"tsConfig": {
|
"tsConfig": {
|
||||||
"description": "The name of the TypeScript configuration file.",
|
"description": "The name of the TypeScript configuration file.",
|
||||||
@ -57,7 +57,9 @@
|
|||||||
"tap"
|
"tap"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ "minLength": 1 }
|
{
|
||||||
|
"minLength": 1
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"exclude": {
|
"exclude": {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ export interface ApplicationGeneratorOptions {
|
|||||||
name: string;
|
name: string;
|
||||||
directory?: string;
|
directory?: string;
|
||||||
frontendProject?: string;
|
frontendProject?: string;
|
||||||
linter?: Exclude<Linter, Linter.TsLint>;
|
linter?: Linter;
|
||||||
skipFormat?: boolean;
|
skipFormat?: boolean;
|
||||||
skipPackageJson?: boolean;
|
skipPackageJson?: boolean;
|
||||||
standaloneConfig?: boolean;
|
standaloneConfig?: boolean;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export interface LibraryGeneratorOptions {
|
|||||||
directory?: string;
|
directory?: string;
|
||||||
global?: boolean;
|
global?: boolean;
|
||||||
importPath?: string;
|
importPath?: string;
|
||||||
linter?: Exclude<Linter, Linter.TsLint>;
|
linter?: Linter;
|
||||||
publishable?: boolean;
|
publishable?: boolean;
|
||||||
service?: boolean;
|
service?: boolean;
|
||||||
skipFormat?: boolean;
|
skipFormat?: boolean;
|
||||||
|
|||||||
@ -33,9 +33,8 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint",
|
"default": "eslint"
|
||||||
"x-deprecated": "TSLint support is deprecated and will be removed"
|
|
||||||
},
|
},
|
||||||
"unitTestRunner": {
|
"unitTestRunner": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@ -3,7 +3,6 @@ export const nxVersion = require('../../package.json').version;
|
|||||||
export const angularCliVersion = '~14.2.0';
|
export const angularCliVersion = '~14.2.0';
|
||||||
export const typescriptVersion = '~4.8.2';
|
export const typescriptVersion = '~4.8.2';
|
||||||
export const prettierVersion = '^2.6.2';
|
export const prettierVersion = '^2.6.2';
|
||||||
export const tslintVersion = '~6.1.0';
|
|
||||||
export const typescriptESLintVersion = '^5.36.1';
|
export const typescriptESLintVersion = '^5.36.1';
|
||||||
export const eslintVersion = '~8.15.0';
|
export const eslintVersion = '~8.15.0';
|
||||||
export const eslintConfigPrettierVersion = '8.1.0';
|
export const eslintConfigPrettierVersion = '8.1.0';
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"standaloneConfig": {
|
"standaloneConfig": {
|
||||||
|
|||||||
@ -68,7 +68,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"skipFormat": {
|
"skipFormat": {
|
||||||
|
|||||||
@ -68,7 +68,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"routing": {
|
"routing": {
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"standaloneConfig": {
|
"standaloneConfig": {
|
||||||
|
|||||||
@ -28,7 +28,10 @@
|
|||||||
"message": "Which stylesheet format would you like to use?",
|
"message": "Which stylesheet format would you like to use?",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"items": [
|
"items": [
|
||||||
{ "value": "css", "label": "CSS" },
|
{
|
||||||
|
"value": "css",
|
||||||
|
"label": "CSS"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"value": "scss",
|
"value": "scss",
|
||||||
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
||||||
@ -59,7 +62,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["eslint", "tslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"skipFormat": {
|
"skipFormat": {
|
||||||
|
|||||||
@ -30,7 +30,7 @@ describe('updateEslint', () => {
|
|||||||
it('should handle .eslintrc.json not existing', async () => {
|
it('should handle .eslintrc.json not existing', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
name: 'my-lib',
|
name: 'my-lib',
|
||||||
linter: Linter.TsLint,
|
linter: Linter.None,
|
||||||
standaloneConfig: false,
|
standaloneConfig: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,8 @@ import {
|
|||||||
getWorkspacePath as devkitGetWorkspacePath,
|
getWorkspacePath as devkitGetWorkspacePath,
|
||||||
installPackagesTask,
|
installPackagesTask,
|
||||||
names,
|
names,
|
||||||
NxJsonConfiguration,
|
|
||||||
PackageManager,
|
PackageManager,
|
||||||
Tree,
|
Tree,
|
||||||
updateJson,
|
|
||||||
} from '@nrwl/devkit';
|
} from '@nrwl/devkit';
|
||||||
|
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
@ -19,6 +17,7 @@ import { workspaceGenerator } from '../workspace/workspace';
|
|||||||
import { nxVersion } from '../../utils/versions';
|
import { nxVersion } from '../../utils/versions';
|
||||||
import { Preset } from '../utils/presets';
|
import { Preset } from '../utils/presets';
|
||||||
import { getNpmPackageVersion } from '../utils/get-npm-package-version';
|
import { getNpmPackageVersion } from '../utils/get-npm-package-version';
|
||||||
|
import { Linter } from '../../utils/lint';
|
||||||
|
|
||||||
export interface Schema {
|
export interface Schema {
|
||||||
cli: 'nx' | 'angular';
|
cli: 'nx' | 'angular';
|
||||||
@ -31,7 +30,7 @@ export interface Schema {
|
|||||||
nxCloud?: boolean;
|
nxCloud?: boolean;
|
||||||
preset: string;
|
preset: string;
|
||||||
defaultBase: string;
|
defaultBase: string;
|
||||||
linter: 'tslint' | 'eslint';
|
linter: Linter;
|
||||||
packageManager?: PackageManager;
|
packageManager?: PackageManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +142,6 @@ export async function newGenerator(host: Tree, options: Schema) {
|
|||||||
|
|
||||||
await workspaceGenerator(host, { ...options, nxCloud: undefined } as any);
|
await workspaceGenerator(host, { ...options, nxCloud: undefined } as any);
|
||||||
|
|
||||||
setDefaultLinter(host, options);
|
|
||||||
addPresetDependencies(host, options);
|
addPresetDependencies(host, options);
|
||||||
addCloudDependencies(host, options);
|
addCloudDependencies(host, options);
|
||||||
|
|
||||||
@ -261,88 +259,3 @@ function normalizeOptions(options: NormalizedSchema): NormalizedSchema {
|
|||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDefaultLinter(host: Tree, options: Schema) {
|
|
||||||
const { linter, preset } = options;
|
|
||||||
// Don't do anything if someone doesn't pick angular
|
|
||||||
if (preset !== Preset.Angular && preset !== Preset.AngularWithNest) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (linter) {
|
|
||||||
case 'eslint': {
|
|
||||||
setESLintDefault(host, options);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'tslint': {
|
|
||||||
setTSLintDefault(host, options);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This sets ESLint as the default for any schematics that default to TSLint
|
|
||||||
*/
|
|
||||||
function setESLintDefault(host: Tree, options: Schema) {
|
|
||||||
updateJson<NxJsonConfiguration>(
|
|
||||||
host,
|
|
||||||
join(options.directory, 'nx.json'),
|
|
||||||
(json) => {
|
|
||||||
setDefault(json, '@nrwl/angular', 'application', 'linter', 'eslint');
|
|
||||||
setDefault(json, '@nrwl/angular', 'library', 'linter', 'eslint');
|
|
||||||
setDefault(
|
|
||||||
json,
|
|
||||||
'@nrwl/angular',
|
|
||||||
'storybook-configuration',
|
|
||||||
'linter',
|
|
||||||
'eslint'
|
|
||||||
);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This sets TSLint as the default for any schematics that default to ESLint
|
|
||||||
*/
|
|
||||||
function setTSLintDefault(host: Tree, options: Schema) {
|
|
||||||
updateJson<NxJsonConfiguration>(
|
|
||||||
host,
|
|
||||||
join(options.directory, 'nx.json'),
|
|
||||||
(json) => {
|
|
||||||
setDefault(json, '@nrwl/workspace', 'library', 'linter', 'tslint');
|
|
||||||
setDefault(json, '@nrwl/cypress', 'cypress-project', 'linter', 'tslint');
|
|
||||||
setDefault(json, '@nrwl/cypress', 'cypress-project', 'linter', 'tslint');
|
|
||||||
setDefault(json, '@nrwl/node', 'application', 'linter', 'tslint');
|
|
||||||
setDefault(json, '@nrwl/node', 'library', 'linter', 'tslint');
|
|
||||||
setDefault(json, '@nrwl/nest', 'application', 'linter', 'tslint');
|
|
||||||
setDefault(json, '@nrwl/nest', 'library', 'linter', 'tslint');
|
|
||||||
setDefault(json, '@nrwl/express', 'application', 'linter', 'tslint');
|
|
||||||
setDefault(json, '@nrwl/express', 'library', 'linter', 'tslint');
|
|
||||||
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setDefault(
|
|
||||||
json: NxJsonConfiguration,
|
|
||||||
collectionName: string,
|
|
||||||
generatorName: string,
|
|
||||||
key: string,
|
|
||||||
value: any
|
|
||||||
) {
|
|
||||||
if (!json.generators) json.generators = {};
|
|
||||||
if (
|
|
||||||
json.generators[collectionName] &&
|
|
||||||
json.generators[collectionName][generatorName]
|
|
||||||
) {
|
|
||||||
json.generators[collectionName][generatorName][key] = value;
|
|
||||||
} else if (json.generators[`${collectionName}:${generatorName}`]) {
|
|
||||||
json.generators[`${collectionName}:${generatorName}`][key] = value;
|
|
||||||
} else {
|
|
||||||
json.generators[collectionName] = json.generators[collectionName] || {};
|
|
||||||
json.generators[collectionName][generatorName] = { [key]: value };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["tslint", "eslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"packageManager": {
|
"packageManager": {
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
"linter": {
|
"linter": {
|
||||||
"description": "The tool to use for running lint checks.",
|
"description": "The tool to use for running lint checks.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["tslint", "eslint"],
|
"enum": ["eslint"],
|
||||||
"default": "eslint"
|
"default": "eslint"
|
||||||
},
|
},
|
||||||
"style": {
|
"style": {
|
||||||
@ -36,7 +36,10 @@
|
|||||||
"message": "Which stylesheet format would you like to use?",
|
"message": "Which stylesheet format would you like to use?",
|
||||||
"type": "list",
|
"type": "list",
|
||||||
"items": [
|
"items": [
|
||||||
{ "value": "css", "label": "CSS" },
|
{
|
||||||
|
"value": "css",
|
||||||
|
"label": "CSS"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"value": "scss",
|
"value": "scss",
|
||||||
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
||||||
|
|||||||
@ -11,13 +11,10 @@ import {
|
|||||||
typescriptESLintVersion,
|
typescriptESLintVersion,
|
||||||
eslintConfigPrettierVersion,
|
eslintConfigPrettierVersion,
|
||||||
nxVersion,
|
nxVersion,
|
||||||
tslintVersion,
|
|
||||||
angularCliVersion,
|
|
||||||
} from './versions';
|
} from './versions';
|
||||||
import { offsetFromRoot } from '@nrwl/devkit';
|
import { offsetFromRoot } from '@nrwl/devkit';
|
||||||
|
|
||||||
export const enum Linter {
|
export const enum Linter {
|
||||||
TsLint = 'tslint',
|
|
||||||
EsLint = 'eslint',
|
EsLint = 'eslint',
|
||||||
None = 'none',
|
None = 'none',
|
||||||
}
|
}
|
||||||
@ -28,15 +25,7 @@ export function generateProjectLint(
|
|||||||
linter: Linter,
|
linter: Linter,
|
||||||
eslintFilePatterns: string[]
|
eslintFilePatterns: string[]
|
||||||
) {
|
) {
|
||||||
if (linter === Linter.TsLint) {
|
if (linter === Linter.EsLint) {
|
||||||
return {
|
|
||||||
builder: '@angular-devkit/build-angular:tslint',
|
|
||||||
options: {
|
|
||||||
tsConfig: [tsConfigPath],
|
|
||||||
exclude: ['**/node_modules/**', `!${projectRoot}/**/*`],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
} else if (linter === Linter.EsLint) {
|
|
||||||
return {
|
return {
|
||||||
builder: '@nrwl/linter:eslint',
|
builder: '@nrwl/linter:eslint',
|
||||||
options: {
|
options: {
|
||||||
@ -71,39 +60,6 @@ export function addLintFiles(
|
|||||||
|
|
||||||
const chainedCommands = [];
|
const chainedCommands = [];
|
||||||
|
|
||||||
if (linter === 'tslint') {
|
|
||||||
chainedCommands.push((host: Tree) => {
|
|
||||||
if (!host.exists('/tslint.json')) {
|
|
||||||
host.create('/tslint.json', globalTsLint);
|
|
||||||
}
|
|
||||||
if (!options.onlyGlobal) {
|
|
||||||
host.create(
|
|
||||||
join(projectRoot as any, `tslint.json`),
|
|
||||||
JSON.stringify({
|
|
||||||
extends: `${offsetFromRoot(projectRoot)}tslint.json`,
|
|
||||||
// Include project files to be linted since the global one excludes all files.
|
|
||||||
linterOptions: {
|
|
||||||
exclude: ['!**/*'],
|
|
||||||
},
|
|
||||||
rules: {},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
chainedCommands.push(
|
|
||||||
addDepsToPackageJson(
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
tslint: tslintVersion,
|
|
||||||
'@angular-devkit/build-angular': angularCliVersion,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return chain(chainedCommands);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (linter === 'eslint') {
|
if (linter === 'eslint') {
|
||||||
if (!host.exists('/.eslintrc.json')) {
|
if (!host.exists('/.eslintrc.json')) {
|
||||||
host.create('/.eslintrc.json', globalESLint);
|
host.create('/.eslintrc.json', globalESLint);
|
||||||
@ -210,74 +166,6 @@ export function addLintFiles(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const globalTsLint = `
|
|
||||||
{
|
|
||||||
"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 globalESLint = JSON.stringify({
|
const globalESLint = JSON.stringify({
|
||||||
root: true,
|
root: true,
|
||||||
ignorePatterns: ['**/*'],
|
ignorePatterns: ['**/*'],
|
||||||
|
|||||||
@ -3,7 +3,6 @@ export const nxVersion = require('../../package.json').version;
|
|||||||
export const angularCliVersion = '~14.2.0';
|
export const angularCliVersion = '~14.2.0';
|
||||||
export const typescriptVersion = '~4.8.2';
|
export const typescriptVersion = '~4.8.2';
|
||||||
export const prettierVersion = '^2.6.2';
|
export const prettierVersion = '^2.6.2';
|
||||||
export const tslintVersion = '~6.1.0';
|
|
||||||
export const typescriptESLintVersion = '^5.36.1';
|
export const typescriptESLintVersion = '^5.36.1';
|
||||||
export const eslintVersion = '~8.15.0';
|
export const eslintVersion = '~8.15.0';
|
||||||
export const eslintConfigPrettierVersion = '8.1.0';
|
export const eslintConfigPrettierVersion = '8.1.0';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user