Skip to content

Commit b21973a

Browse files
committed
chore(eslint): Migrate from tslint to eslint
1 parent 7ab597d commit b21973a

12 files changed

+737
-470
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ insert_final_newline = true
99
trim_trailing_whitespace = true
1010
end_of_line = lf
1111

12-
[{package.json,ng-package.json,angular.json,tslint.json,karma.conf.js,tsconfig*.json,test.ts,main.ts,polyfills.ts}]
12+
[{package.json,ng-package.json,angular.json,.eslintrc.json,karma.conf.js,tsconfig*.json,test.ts,main.ts,polyfills.ts}]
1313
indent_size = 2
1414

1515
[*.md]

.eslintrc.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": [
4+
"projects/**/*"
5+
],
6+
"overrides": [
7+
{
8+
"files": [
9+
"*.ts"
10+
],
11+
"parserOptions": {
12+
"project": [
13+
"tsconfig.json",
14+
"e2e/tsconfig.json"
15+
],
16+
"createDefaultProgram": true
17+
},
18+
"extends": [
19+
"plugin:@angular-eslint/recommended",
20+
"plugin:@angular-eslint/template/process-inline-templates"
21+
],
22+
"rules": {
23+
"@angular-eslint/component-selector": [
24+
"error",
25+
{
26+
"prefix": "",
27+
"style": "kebab-case",
28+
"type": "element"
29+
}
30+
],
31+
"@angular-eslint/directive-selector": [
32+
"error",
33+
{
34+
"prefix": "",
35+
"style": "camelCase",
36+
"type": "attribute"
37+
}
38+
],
39+
"comma-dangle": [
40+
"error",
41+
{
42+
"objects": "never",
43+
"arrays": "always-multiline",
44+
"functions": "never"
45+
}
46+
]
47+
}
48+
},
49+
{
50+
"files": [
51+
"*.html"
52+
],
53+
"extends": [
54+
"plugin:@angular-eslint/template/recommended"
55+
],
56+
"rules": {}
57+
}
58+
]
59+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ import { Spinkit } from 'ng-http-loader'; // <============
120120
styleUrls: ['./app.component.css'],
121121
})
122122
export class AppComponent {
123-
public spinkit = Spinkit; // <============
123+
spinkit = Spinkit; // <============
124124
}
125125
```
126126
The different spinners available are referenced in [this file](src/lib/spinkits.ts).

angular.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,11 @@
4040
}
4141
},
4242
"lint": {
43-
"builder": "@angular-devkit/build-angular:tslint",
43+
"builder": "@angular-eslint/builder:lint",
4444
"options": {
45-
"tsConfig": [
46-
"./tsconfig.lib.json",
47-
"./tsconfig.spec.json"
48-
],
49-
"exclude": [
50-
"**/node_modules/**"
45+
"lintFilePatterns": [
46+
"src/**/*.ts",
47+
"src/**/*.html"
5148
]
5249
}
5350
}
@@ -56,6 +53,7 @@
5653
},
5754
"defaultProject": "ng-http-loader",
5855
"cli": {
59-
"packageManager": "yarn"
56+
"packageManager": "yarn",
57+
"defaultCollection": "@angular-eslint/schematics"
6058
}
6159
}

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
},
4949
"devDependencies": {
5050
"@angular-devkit/build-angular": "^12.0.0",
51+
"@angular-eslint/builder": "12.6.1",
52+
"@angular-eslint/eslint-plugin": "12.6.1",
53+
"@angular-eslint/eslint-plugin-template": "12.6.1",
54+
"@angular-eslint/schematics": "12.6.1",
55+
"@angular-eslint/template-parser": "12.6.1",
5156
"@angular/cli": "^12.0.0",
5257
"@angular/common": "^12.0.0",
5358
"@angular/compiler": "^12.0.0",
@@ -57,7 +62,9 @@
5762
"@angular/platform-browser-dynamic": "^12.0.0",
5863
"@types/jasmine": "~3.8.0",
5964
"@types/node": "^12.11.1",
60-
"codelyzer": "^6.0.0",
65+
"@typescript-eslint/eslint-plugin": "4.28.2",
66+
"@typescript-eslint/parser": "4.28.2",
67+
"eslint": "^7.26.0",
6168
"jasmine-core": "~3.8.0",
6269
"karma": "~6.3.2",
6370
"karma-chrome-launcher": "~3.1.0",
@@ -68,8 +75,6 @@
6875
"ng-packagr": "^12.0.0",
6976
"puppeteer": "^10.0.0",
7077
"rxjs": "^6.6.0",
71-
"rxjs-tslint-rules": "^4.13.0",
72-
"tslint": "~6.1.0",
7378
"typescript": "~4.3.5",
7479
"zone.js": "~0.11.4"
7580
}

src/lib/components/abstract.loader.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ import { Input, Directive } from '@angular/core';
1212
@Directive()
1313
export abstract class AbstractLoaderDirective {
1414

15-
@Input() public backgroundColor!: string;
15+
@Input() backgroundColor!: string;
1616
}

src/lib/components/ng-http-loader.component.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@ import { Spinkit } from '../spinkits';
2121
})
2222
export class NgHttpLoaderComponent implements OnInit {
2323

24-
public spinkit = Spinkit;
25-
public isVisible$!: Observable<boolean>;
26-
private visibleUntil = Date.now();
24+
spinkit = Spinkit;
25+
isVisible$!: Observable<boolean>;
26+
visibleUntil = Date.now();
2727

28-
@Input() public backdrop = true;
29-
@Input() public backgroundColor!: string;
30-
@Input() public debounceDelay = 0;
31-
@Input() public entryComponent: any = null;
32-
@Input() public extraDuration = 0;
33-
@Input() public filteredHeaders: string[] = [];
34-
@Input() public filteredMethods: string[] = [];
35-
@Input() public filteredUrlPatterns: string[] = [];
36-
@Input() public minDuration = 0;
37-
@Input() public opacity = '.7';
38-
@Input() public backdropBackgroundColor = '#f1f1f1';
39-
@Input() public spinner: string | null = Spinkit.skWave;
28+
@Input() backdrop = true;
29+
@Input() backgroundColor!: string;
30+
@Input() debounceDelay = 0;
31+
@Input() entryComponent: any = null;
32+
@Input() extraDuration = 0;
33+
@Input() filteredHeaders: string[] = [];
34+
@Input() filteredMethods: string[] = [];
35+
@Input() filteredUrlPatterns: string[] = [];
36+
@Input() minDuration = 0;
37+
@Input() opacity = '.7';
38+
@Input() backdropBackgroundColor = '#f1f1f1';
39+
@Input() spinner: string | null = Spinkit.skWave;
4040

4141
constructor(private pendingRequestsInterceptor: PendingRequestsInterceptor, private spinnerVisibility: SpinnerVisibilityService) {
4242
}
4343

44-
public ngOnInit(): void {
44+
ngOnInit(): void {
4545
this.initIsvisibleObservable();
4646
this.nullifySpinnerIfEntryComponentIsDefined();
4747
this.initFilters();

src/lib/ng-http-loader.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { SPINKIT_COMPONENTS } from './spinkits';
2727
]
2828
})
2929
export class NgHttpLoaderModule {
30-
public static forRoot(): ModuleWithProviders<NgHttpLoaderModule> {
30+
static forRoot(): ModuleWithProviders<NgHttpLoaderModule> {
3131
return {
3232
ngModule: NgHttpLoaderModule,
3333
providers: [

src/lib/services/pending-requests-interceptor.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class PendingRequestsInterceptor implements HttpInterceptor {
7373
|| this.shouldBypassHeader(req);
7474
}
7575

76-
public intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
76+
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
7777
const shouldBypass = this.shouldBypass(req);
7878

7979
if (!shouldBypass) {

src/lib/services/spinner-visibility.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export class SpinnerVisibilityService {
2525
return this._visibility$.asObservable();
2626
}
2727

28-
public show(): void {
28+
show(): void {
2929
this.pendingRequestsInterceptor.forceByPass = true;
3030
this._visibility$.next(true);
3131
}
3232

33-
public hide(): void {
33+
hide(): void {
3434
this._visibility$.next(false);
3535
this.pendingRequestsInterceptor.forceByPass = false;
3636
}

0 commit comments

Comments
 (0)