Skip to content

Commit 6b6aa75

Browse files
committed
build: update files to be eslint compliant
All TypeScript files have been updated to pass the new eslint-based linting checks. eslint compatible disabling comments have also been added in place of the previous tslint comments. (cherry picked from commit c1512e4)
1 parent 0b96768 commit 6b6aa75

File tree

235 files changed

+386
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+386
-480
lines changed

.eslintrc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,21 @@
7676
"no-useless-escape": "off",
7777
"@typescript-eslint/await-thenable": "off",
7878
"@typescript-eslint/ban-types": "off",
79+
"@typescript-eslint/no-empty-function": "off",
7980
"@typescript-eslint/explicit-module-boundary-types": "off",
81+
"@typescript-eslint/no-implied-eval": "off",
8082
"@typescript-eslint/no-var-requires": "off",
83+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
8184
"@typescript-eslint/no-unsafe-assignment": "off",
8285
"@typescript-eslint/no-unsafe-call": "off",
8386
"@typescript-eslint/no-unsafe-member-access": "off",
8487
"@typescript-eslint/no-unsafe-return": "off",
88+
"@typescript-eslint/no-unused-vars": "off",
8589
"@typescript-eslint/prefer-regexp-exec": "off",
8690
"@typescript-eslint/require-await": "off",
8791
"@typescript-eslint/restrict-plus-operands": "off",
88-
"@typescript-eslint/restrict-template-expressions": "off"
92+
"@typescript-eslint/restrict-template-expressions": "off",
93+
"@typescript-eslint/unbound-method": "off"
8994
},
9095
"overrides": [
9196
{

lib/packages.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
// tslint:disable-next-line: no-global-tslint-disable
10-
// tslint:disable: no-implicit-dependencies
119
import { JsonObject } from '@angular-devkit/core';
1210
import { execSync } from 'child_process';
1311
import * as fs from 'fs';

packages/angular/cli/commands/analytics-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from '../models/analytics';
1414
import { Command } from '../models/command';
1515
import { Arguments } from '../models/interface';
16-
import { ProjectSetting, Schema as AnalyticsCommandSchema, SettingOrProject } from './analytics';
16+
import { Schema as AnalyticsCommandSchema, ProjectSetting, SettingOrProject } from './analytics';
1717

1818
export class AnalyticsCommand extends Command<AnalyticsCommandSchema> {
1919
public async run(options: AnalyticsCommandSchema & Arguments) {

packages/angular/cli/commands/doc-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class DocCommand extends Command<DocCommandSchema> {
3636
// we try to get the current Angular version of the project
3737
// and use it if we can find it
3838
try {
39-
/* tslint:disable-next-line:no-implicit-dependencies */
39+
/* eslint-disable-next-line import/no-extraneous-dependencies */
4040
const currentNgVersion = (await import('@angular/core')).VERSION.major;
4141
domain = `v${currentNgVersion}.angular.io`;
4242
} catch (e) {}

packages/angular/cli/commands/update-impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
271271
return true;
272272
}
273273

274-
// tslint:disable-next-line:no-big-function
274+
// eslint-disable-next-line max-lines-per-function
275275
async run(options: UpdateCommandSchema & Arguments) {
276276
await ensureCompatibleNpm(this.context.root);
277277

@@ -665,7 +665,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
665665
}
666666

667667
// This is a temporary workaround to allow data to be passed back from the update schematic
668-
// tslint:disable-next-line: no-any
668+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
669669
const migrations = (global as any).externalMigrations as {
670670
package: string;
671671
collection: string;

packages/angular/cli/lib/cli/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export { VERSION, Version } from '../../models/version';
1919
const debugEnv = process.env['NG_DEBUG'];
2020
const isDebug = debugEnv !== undefined && debugEnv !== '0' && debugEnv.toLowerCase() !== 'false';
2121

22-
// tslint:disable: no-console
22+
/* eslint-disable no-console */
2323
export default async function (options: { testing?: boolean; cliArgs: string[] }) {
2424
// This node version check ensures that the requirements of the project instance of the CLI are met
2525
const version = process.versions.node.split('.').map((part) => Number(part));
@@ -111,7 +111,7 @@ export default async function (options: { testing?: boolean; cliArgs: string[] }
111111
}
112112

113113
if (options.testing) {
114-
// tslint:disable-next-line: no-debugger
114+
// eslint-disable-next-line no-debugger
115115
debugger;
116116
throw err;
117117
}

packages/angular/cli/lib/init.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import 'symbol-observable';
1010
// symbol polyfill must go first
11-
// tslint:disable-next-line:ordered-imports import-groups
1211
import * as fs from 'fs';
1312
import * as path from 'path';
1413
import { SemVer } from 'semver';
@@ -22,7 +21,7 @@ if (process.env['NG_CLI_PROFILING']) {
2221
stopProfiling: (name?: string) => unknown;
2322
};
2423
try {
25-
profiler = require('v8-profiler-node8'); // tslint:disable-line:no-implicit-dependencies
24+
profiler = require('v8-profiler-node8'); // eslint-disable-line import/no-extraneous-dependencies
2625
} catch (err) {
2726
throw new Error(
2827
`Could not require 'v8-profiler-node8'. You must install it separetely with ` +
@@ -90,7 +89,7 @@ if (process.env['NG_CLI_PROFILING']) {
9089
localVersion = require(path.join(path.dirname(projectLocalCli), '../../package.json'))
9190
.version;
9291
} catch (error) {
93-
// tslint:disable-next-line no-console
92+
// eslint-disable-next-line no-console
9493
console.error('Version mismatch check skipped. Unable to retrieve local version: ' + error);
9594
}
9695
}
@@ -99,7 +98,7 @@ if (process.env['NG_CLI_PROFILING']) {
9998
try {
10099
isGlobalGreater = !!localVersion && globalVersion.compare(localVersion) > 0;
101100
} catch (error) {
102-
// tslint:disable-next-line no-console
101+
// eslint-disable-next-line no-console
103102
console.error('Version mismatch check skipped. Unable to compare local version: ' + error);
104103
}
105104

@@ -115,7 +114,7 @@ if (process.env['NG_CLI_PROFILING']) {
115114
`version (${localVersion}). The local Angular CLI version is used.\n\n` +
116115
'To disable this warning use "ng config -g cli.warnings.versionMismatch false".';
117116

118-
// tslint:disable-next-line no-console
117+
// eslint-disable-next-line no-console
119118
console.error(colors.yellow(warning));
120119
}
121120
}
@@ -144,7 +143,7 @@ if (process.env['NG_CLI_PROFILING']) {
144143
process.exit(exitCode);
145144
})
146145
.catch((err: Error) => {
147-
// tslint:disable-next-line no-console
146+
// eslint-disable-next-line no-console
148147
console.error('Unknown error: ' + err.toString());
149148
process.exit(127);
150149
});

packages/angular/cli/models/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { getWorkspace, getWorkspaceRaw } from '../utilities/config';
1515
import { isTTY } from '../utilities/tty';
1616
import { AnalyticsCollector } from './analytics-collector';
1717

18-
// tslint:disable: no-console
18+
/* eslint-disable no-console */
1919
const analyticsDebug = debug('ng:analytics'); // Generate analytics, including settings and users.
2020

2121
let _defaultAngularCliPropertyCache: string;

packages/angular/cli/models/architect-command.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export abstract class ArchitectCommand<
304304

305305
private getProjectNamesByTarget(targetName: string): string[] {
306306
const allProjectsForTargetName: string[] = [];
307-
// tslint:disable-next-line: no-non-null-assertion
307+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
308308
for (const [name, project] of this.workspace!.projects) {
309309
if (project.targets.has(targetName)) {
310310
allProjectsForTargetName.push(name);
@@ -317,7 +317,7 @@ export abstract class ArchitectCommand<
317317
} else {
318318
// For single target commands, we try the default project first,
319319
// then the full list if it has a single project, then error out.
320-
// tslint:disable-next-line: no-non-null-assertion
320+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
321321
const maybeDefaultProject = this.workspace!.extensions['defaultProject'] as string;
322322
if (maybeDefaultProject && allProjectsForTargetName.includes(maybeDefaultProject)) {
323323
return [maybeDefaultProject];

packages/angular/cli/models/command.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export abstract class Command<T extends BaseCommandOptions = BaseCommandOptions>
126126
The ${this.description.name} command requires to be run outside of a project, but a
127127
project definition was found at "${this.workspace.filePath}".
128128
`);
129+
// eslint-disable-next-line no-throw-literal
129130
throw 1;
130131
}
131132
break;
@@ -135,6 +136,7 @@ export abstract class Command<T extends BaseCommandOptions = BaseCommandOptions>
135136
The ${this.description.name} command requires to be run in an Angular project, but a
136137
project definition could not be found.
137138
`);
139+
// eslint-disable-next-line no-throw-literal
138140
throw 1;
139141
}
140142
break;

0 commit comments

Comments
 (0)