Skip to content

Commit

Permalink
fix(linter): remove leftovers after tslint support removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip9587 committed Sep 30, 2022
1 parent 8c8c29c commit acd794c
Show file tree
Hide file tree
Showing 25 changed files with 47 additions and 186 deletions.
2 changes: 1 addition & 1 deletion docs/generated/packages/express.json
Expand Up @@ -82,7 +82,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"unitTestRunner": {
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/packages/linter.json
Expand Up @@ -104,14 +104,14 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"config": {
"type": "string",
"description": "The name of the configuration file.",
"x-completion-type": "file",
"x-completion-glob": "(tslint.json|.eslintrc.json)"
"x-completion-glob": ".eslintrc.json)"
},
"tsConfig": {
"description": "The name of the TypeScript configuration file.",
Expand Down
5 changes: 2 additions & 3 deletions docs/generated/packages/nx-plugin.json
Expand Up @@ -50,9 +50,8 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"default": "eslint",
"x-deprecated": "TSLint support is deprecated and will be removed"
"enum": ["eslint"],
"default": "eslint"
},
"unitTestRunner": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/react-native.json
Expand Up @@ -375,7 +375,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"standaloneConfig": {
Expand Down
6 changes: 3 additions & 3 deletions docs/generated/packages/react.json
Expand Up @@ -645,7 +645,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"standaloneConfig": {
Expand Down Expand Up @@ -956,7 +956,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"skipFormat": {
Expand Down Expand Up @@ -1113,7 +1113,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"routing": {
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages/web.json
Expand Up @@ -120,7 +120,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"skipFormat": {
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/packages/workspace.json
Expand Up @@ -135,7 +135,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["tslint", "eslint"],
"enum": ["eslint"],
"default": "eslint"
},
"style": {
Expand Down Expand Up @@ -340,7 +340,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["tslint", "eslint"],
"enum": ["eslint"],
"default": "eslint"
},
"packageManager": {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/generators/ng-add/schema.d.ts
Expand Up @@ -14,6 +14,6 @@ export interface GeneratorOptions {
skipInstall?: boolean;
skipPostInstall?: boolean;
style?: Styles;
linter?: Exclude<Linter, Linter.TsLint>;
linter?: Linter;
skipPackageJson?: boolean;
}
2 changes: 1 addition & 1 deletion packages/express/src/generators/application/schema.json
Expand Up @@ -33,7 +33,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"unitTestRunner": {
Expand Down
8 changes: 5 additions & 3 deletions packages/linter/src/executors/lint/schema.json
Expand Up @@ -8,14 +8,14 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"config": {
"type": "string",
"description": "The name of the configuration file.",
"x-completion-type": "file",
"x-completion-glob": "(tslint.json|.eslintrc.json)"
"x-completion-glob": ".eslintrc.json)"
},
"tsConfig": {
"description": "The name of the TypeScript configuration file.",
Expand Down Expand Up @@ -57,7 +57,9 @@
"tap"
]
},
{ "minLength": 1 }
{
"minLength": 1
}
]
},
"exclude": {
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/src/generators/application/schema.d.ts
Expand Up @@ -5,7 +5,7 @@ export interface ApplicationGeneratorOptions {
name: string;
directory?: string;
frontendProject?: string;
linter?: Exclude<Linter, Linter.TsLint>;
linter?: Linter;
skipFormat?: boolean;
skipPackageJson?: boolean;
standaloneConfig?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/nest/src/generators/library/schema.d.ts
Expand Up @@ -8,7 +8,7 @@ export interface LibraryGeneratorOptions {
directory?: string;
global?: boolean;
importPath?: string;
linter?: Exclude<Linter, Linter.TsLint>;
linter?: Linter;
publishable?: boolean;
service?: boolean;
skipFormat?: boolean;
Expand Down
5 changes: 2 additions & 3 deletions packages/nx-plugin/src/generators/plugin/schema.json
Expand Up @@ -33,9 +33,8 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"default": "eslint",
"x-deprecated": "TSLint support is deprecated and will be removed"
"enum": ["eslint"],
"default": "eslint"
},
"unitTestRunner": {
"type": "string",
Expand Down
1 change: 0 additions & 1 deletion packages/nx/src/utils/versions.ts
Expand Up @@ -3,7 +3,6 @@ export const nxVersion = require('../../package.json').version;
export const angularCliVersion = '~14.2.0';
export const typescriptVersion = '~4.8.2';
export const prettierVersion = '^2.6.2';
export const tslintVersion = '~6.1.0';
export const typescriptESLintVersion = '^5.36.1';
export const eslintVersion = '~8.15.0';
export const eslintConfigPrettierVersion = '8.1.0';
Expand Down
Expand Up @@ -36,7 +36,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"standaloneConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/generators/host/schema.json
Expand Up @@ -68,7 +68,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"skipFormat": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/generators/remote/schema.json
Expand Up @@ -68,7 +68,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"routing": {
Expand Down
Expand Up @@ -52,7 +52,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"standaloneConfig": {
Expand Down
7 changes: 5 additions & 2 deletions packages/web/src/generators/application/schema.json
Expand Up @@ -28,7 +28,10 @@
"message": "Which stylesheet format would you like to use?",
"type": "list",
"items": [
{ "value": "css", "label": "CSS" },
{
"value": "css",
"label": "CSS"
},
{
"value": "scss",
"label": "SASS(.scss) [ http://sass-lang.com ]"
Expand Down Expand Up @@ -59,7 +62,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "tslint"],
"enum": ["eslint"],
"default": "eslint"
},
"skipFormat": {
Expand Down
Expand Up @@ -30,7 +30,7 @@ describe('updateEslint', () => {
it('should handle .eslintrc.json not existing', async () => {
await libraryGenerator(tree, {
name: 'my-lib',
linter: Linter.TsLint,
linter: Linter.None,
standaloneConfig: false,
});

Expand Down
45 changes: 7 additions & 38 deletions packages/workspace/src/generators/new/new.ts
Expand Up @@ -19,6 +19,7 @@ import { workspaceGenerator } from '../workspace/workspace';
import { nxVersion } from '../../utils/versions';
import { Preset } from '../utils/presets';
import { getNpmPackageVersion } from '../utils/get-npm-package-version';
import { Linter } from '../../utils/lint';

export interface Schema {
cli: 'nx' | 'angular';
Expand All @@ -31,7 +32,7 @@ export interface Schema {
nxCloud?: boolean;
preset: string;
defaultBase: string;
linter: 'tslint' | 'eslint';
linter: Linter;
packageManager?: PackageManager;
}

Expand Down Expand Up @@ -264,20 +265,11 @@ function normalizeOptions(options: NormalizedSchema): NormalizedSchema {

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;
}
if (
linter === Linter.EsLint &&
(preset === Preset.Angular || preset === Preset.AngularWithNest)
) {
setESLintDefault(host, options);
}
}

Expand All @@ -303,29 +295,6 @@ function setESLintDefault(host: Tree, options: Schema) {
);
}

/**
* 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,
Expand Down
2 changes: 1 addition & 1 deletion packages/workspace/src/generators/new/schema.json
Expand Up @@ -55,7 +55,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["tslint", "eslint"],
"enum": ["eslint"],
"default": "eslint"
},
"packageManager": {
Expand Down
7 changes: 5 additions & 2 deletions packages/workspace/src/generators/preset/schema.json
Expand Up @@ -25,7 +25,7 @@
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["tslint", "eslint"],
"enum": ["eslint"],
"default": "eslint"
},
"style": {
Expand All @@ -36,7 +36,10 @@
"message": "Which stylesheet format would you like to use?",
"type": "list",
"items": [
{ "value": "css", "label": "CSS" },
{
"value": "css",
"label": "CSS"
},
{
"value": "scss",
"label": "SASS(.scss) [ http://sass-lang.com ]"
Expand Down

0 comments on commit acd794c

Please sign in to comment.