Skip to content

Commit 233c05d

Browse files
authored
Merge pull request #157 from mpalourdio/eslint
Eslint
2 parents 7ab597d + 9e42994 commit 233c05d

13 files changed

+944
-409
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: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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+
"plugin:rxjs/recommended"
22+
],
23+
"rules": {
24+
"@angular-eslint/component-selector": [
25+
"error",
26+
{
27+
"prefix": "",
28+
"style": "kebab-case",
29+
"type": "element"
30+
}
31+
],
32+
"@angular-eslint/directive-selector": [
33+
"error",
34+
{
35+
"prefix": "",
36+
"style": "camelCase",
37+
"type": "attribute"
38+
}
39+
],
40+
"comma-dangle": [
41+
"error",
42+
{
43+
"objects": "never",
44+
"arrays": "always-multiline",
45+
"functions": "never"
46+
}
47+
],
48+
"rxjs/finnish": [
49+
"error",
50+
{
51+
"functions": true,
52+
"methods": true,
53+
"names": {
54+
"^(canActivate|canActivateChild|canDeactivate|canLoad|intercept|resolve|validate)$": false
55+
},
56+
"parameters": true,
57+
"properties": true,
58+
"strict": false,
59+
"types": {
60+
"^EventEmitter$": false
61+
},
62+
"variables": true
63+
}
64+
],
65+
"rxjs/no-implicit-any-catch": [
66+
"error",
67+
{
68+
"allowExplicitAny": true
69+
}
70+
]
71+
}
72+
},
73+
{
74+
"files": [
75+
"*.html"
76+
],
77+
"extends": [
78+
"plugin:@angular-eslint/template/recommended"
79+
],
80+
"rules": {}
81+
}
82+
]
83+
}

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: 9 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,10 @@
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",
68+
"eslint-plugin-rxjs": "^4.0.1",
6169
"jasmine-core": "~3.8.0",
6270
"karma": "~6.3.2",
6371
"karma-chrome-launcher": "~3.1.0",
@@ -68,8 +76,6 @@
6876
"ng-packagr": "^12.0.0",
6977
"puppeteer": "^10.0.0",
7078
"rxjs": "^6.6.0",
71-
"rxjs-tslint-rules": "^4.13.0",
72-
"tslint": "~6.1.0",
7379
"typescript": "~4.3.5",
7480
"zone.js": "~0.11.4"
7581
}

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)