Skip to content

Commit 203f962

Browse files
clydinalan-agius4
authored andcommitted
refactor(@angular/cli): correct various uncaught code style issues
This change cleans up some of the code by removing unused variables/imports, unnecessary double negation, and some long line lengths.
1 parent ee86327 commit 203f962

File tree

9 files changed

+16
-11
lines changed

9 files changed

+16
-11
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class AddCommand extends SchematicCommand<AddCommandSchema> {
131131
// 'latest' is invalid so search for most recent matching package
132132
const versionManifests = Object.values(packageMetadata.versions).filter(
133133
(value: PackageManifest) => !prerelease(value.version) && !value.deprecated,
134-
) as PackageManifest[];
134+
);
135135

136136
versionManifests.sort((a, b) => rcompare(a.version, b.version, true));
137137

packages/angular/cli/commands/extract-i18n-impl.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ export class ExtractI18nCommand extends ArchitectCommand<ExtractI18nCommandSchem
1616
const version = process.version.substr(1).split('.');
1717
if (Number(version[0]) === 12 && Number(version[1]) === 0) {
1818
this.logger.error(
19-
'Due to a defect in Node.js 12.0, the command is not supported on this Node.js version. '
20-
+ 'Please upgrade to Node.js 12.1 or later.');
19+
'Due to a defect in Node.js 12.0, the command is not supported on this Node.js version. ' +
20+
'Please upgrade to Node.js 12.1 or later.',
21+
);
2122

2223
return 1;
2324
}
2425

2526
const commandName = process.argv[2];
2627
if (['xi18n', 'i18n-extract'].includes(commandName)) {
27-
this.logger.warn(`Warning: "ng ${commandName}" has been deprecated and will be removed in a future major version. Please use "ng extract-i18n" instead.`);
28+
this.logger.warn(
29+
`Warning: "ng ${commandName}" has been deprecated and will be removed in a future major version. ` +
30+
'Please use "ng extract-i18n" instead.',
31+
);
2832
}
2933

3034
return this.runArchitectTarget(options);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import { Arguments } from '../models/interface';
1010
import { SchematicCommand } from '../models/schematic-command';
11-
import { ensureCompatibleNpm } from '../utilities/package-manager';
1211
import { Schema as NewCommandSchema } from './new';
1312

1413

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Schema as ServeCommandSchema } from './serve';
1313
export class ServeCommand extends ArchitectCommand<ServeCommandSchema> {
1414
public readonly target = 'serve';
1515

16-
public validate(_options: ArchitectCommandOptions & Arguments) {
16+
public validate() {
1717
return true;
1818
}
1919

packages/angular/cli/lib/init.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import 'symbol-observable';
1212
import * as fs from 'fs';
1313
import * as path from 'path';
1414
import { SemVer } from 'semver';
15-
import { Duplex } from 'stream';
1615
import { colors } from '../utilities/color';
1716
import { isWarningEnabled } from '../utilities/config';
1817

packages/angular/cli/models/command.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export abstract class Command<T extends BaseCommandOptions = BaseCommandOptions>
5252
return 0;
5353
}
5454

55-
async printJsonHelp(_options: T & Arguments): Promise<number> {
55+
async printJsonHelp(): Promise<number> {
5656
const replacer = (key: string, value: string) => key === 'name'
5757
? strings.dasherize(value)
5858
: value;
@@ -176,7 +176,7 @@ export abstract class Command<T extends BaseCommandOptions = BaseCommandOptions>
176176
if (options.help === true) {
177177
return this.printHelp();
178178
} else if (options.help === 'json' || options.help === 'JSON') {
179-
return this.printJsonHelp(options);
179+
return this.printJsonHelp();
180180
} else {
181181
const startTime = +new Date();
182182
if (this.useReportAnalytics) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export abstract class SchematicCommand<
243243
packageRegistry: options.packageRegistry,
244244
// A schema registry is required to allow customizing addUndefinedDefaults
245245
registry: new schema.CoreSchemaRegistry(formats.standardFormats),
246-
resolvePaths: !!this.workspace
246+
resolvePaths: this.workspace
247247
// Workspace
248248
? this.collectionName === this.defaultCollectionName
249249
// Favor __dirname for @schematics/angular to use the build-in version

packages/angular/cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
"symbol-observable": "4.0.0",
4747
"uuid": "8.3.2"
4848
},
49+
"devDependencies": {
50+
"rxjs": "6.6.7"
51+
},
4952
"ng-update": {
5053
"migrations": "@schematics/angular/migrations/migration-collection.json",
5154
"packageGroup": {

packages/angular/cli/src/commands/update/schematic/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ function _usageMessage(
435435
target,
436436
};
437437
})
438-
.filter(({ name, info, version, target }) => {
438+
.filter(({ info, version, target }) => {
439439
return (target && semver.compare(info.installed.version, version) < 0);
440440
})
441441
.filter(({ target }) => {

0 commit comments

Comments
 (0)