Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit da15948

Browse files
committed
refactor: add more linting rules
This include a custom rule that enforces that imports are next to each others (grouped).
1 parent 18fe75d commit da15948

File tree

31 files changed

+137
-80
lines changed

31 files changed

+137
-80
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"build": "npm run admin -- build",
1818
"build-tsc": "tsc -p tsconfig.json",
1919
"fix": "npm run lint -- --fix",
20-
"lint": "tslint --config tslint.json --project tsconfig.json --type-check",
20+
"lint": "tsc -p rules/tsconfig.json && tslint --config tslint.json --project tsconfig.json --type-check",
2121
"test": "node ./bin/devkit-admin test",
2222
"validate-commits": "./bin/devkit-admin validate-commits",
2323
"integration": "npm run build && npm run integration:build-optimizer",

packages/_/schematics_cli/src/cli.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
import {SchemaClassFactory} from '@ngtools/json-schema';
2323
import * as minimist from 'minimist';
2424
import {Observable} from 'rxjs/Observable';
25-
2625
import 'rxjs/add/operator/ignoreElements';
2726

2827

packages/angular_devkit/core/src/logger/cli-logger.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8+
import 'rxjs/add/operator/filter';
9+
import {bold, dim, red, white, yellow} from '../terminal';
810
import {IndentLogger} from './indent';
911
import {LogEntry, Logger} from './logger';
1012

11-
import {bold, dim, red, white, yellow} from '../terminal';
12-
13-
import 'rxjs/add/operator/filter';
14-
1513

1614
/**
1715
* A Logger that sends information to STDOUT and STDERR.

packages/angular_devkit/core/src/logger/indent.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {Logger} from './logger';
9-
108
import 'rxjs/add/operator/map';
9+
import {Logger} from './logger';
1110

1211

1312
/**

packages/angular_devkit/core/src/logger/logger.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {JsonObject} from '../json/interface';
9-
108
import {Observable} from 'rxjs/Observable';
119
import {PartialObserver} from 'rxjs/Observer';
1210
import {Operator} from 'rxjs/Operator';
1311
import {Subject} from 'rxjs/Subject';
1412
import {Subscription} from 'rxjs/Subscription';
13+
import {JsonObject} from '../json/interface';
1514

1615

1716
export interface LoggerMetadata extends JsonObject {

packages/angular_devkit/core/src/logger/null-logger.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {Logger} from './logger';
9-
108
import {Observable} from 'rxjs/Observable';
11-
129
import 'rxjs/add/observable/empty';
10+
import {Logger} from './logger';
1311

1412

1513
export class NullLogger extends Logger {

packages/angular_devkit/core/src/logger/transform-logger.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import {Observable} from 'rxjs/Observable';
9-
109
import {LogEntry, Logger} from './logger';
1110

1211

packages/angular_devkit/schematics/src/engine/engine.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8+
import 'rxjs/add/operator/map';
9+
import {Url} from 'url';
810
import {BaseException} from '../exception/exception';
911
import {MergeStrategy} from '../tree/interface';
1012
import {NullTree} from '../tree/null';
@@ -19,9 +21,6 @@ import {
1921
} from './interface';
2022
import {SchematicImpl} from './schematic';
2123

22-
import 'rxjs/add/operator/map';
23-
import {Url} from 'url';
24-
2524

2625
export class UnknownUrlSourceProtocol extends BaseException {
2726
constructor(url: string) { super(`Unknown Protocol on url "${url}".`); }

packages/angular_devkit/schematics/src/engine/interface.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {FileEntry, MergeStrategy, Tree} from '../tree/interface';
9-
108
import {Observable} from 'rxjs/Observable';
119
import {Url} from 'url';
10+
import {FileEntry, MergeStrategy, Tree} from '../tree/interface';
1211

1312

1413
/**

packages/angular_devkit/schematics/src/rules/base_spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8+
import {Observable} from 'rxjs/Observable';
9+
import 'rxjs/add/operator/toPromise';
810
import {Rule, SchematicContext, Source} from '../engine/interface';
911
import {Tree} from '../tree/interface';
1012
import {empty} from '../tree/static';
1113
import {apply, chain} from './base';
1214
import {callRule, callSource} from './call';
1315

14-
import {Observable} from 'rxjs/Observable';
15-
import 'rxjs/add/operator/toPromise';
16-
1716

1817
const context: SchematicContext = null !;
1918

0 commit comments

Comments
 (0)