Skip to content

Commit 8d7fe17

Browse files
committed
feat: fix linting and add strict mode
1 parent e997275 commit 8d7fe17

File tree

64 files changed

+475
-473
lines changed

Some content is hidden

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

64 files changed

+475
-473
lines changed

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
node_modules/*
2+
package.json
3+
package-lock.json
4+
yarn.lock
5+
dist

.eslintrc

+8-7
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717
"createDefaultProgram": true
1818
},
1919
"extends": [
20-
"plugin:@angular-eslint/recommended"
20+
"plugin:@angular-eslint/recommended",
21+
"plugin:@typescript-eslint/recommended",
22+
"prettier/@typescript-eslint",
23+
"plugin:prettier/recommended",
24+
"prettier/@typescript-eslint"
2125
],
2226
"rules": {
23-
24-
/**
25-
* Any TypeScript source code (NOT TEMPLATE) related rules you wish to use/reconfigure over and above the
26-
* recommended set provided by the @angular-eslint project would go here.
27-
*/
2827
"@angular-eslint/component-class-suffix": [
2928
"error",
3029
{
@@ -42,7 +41,9 @@
4241
"error",
4342
{ "type": "element", "prefix": "app", "style": "kebab-case" }
4443
],
45-
"@angular-eslint/no-empty-lifecycle-method": "off"
44+
"@angular-eslint/no-empty-lifecycle-method": "off",
45+
"@typescript-eslint/no-empty-function": "off",
46+
"@typescript-eslint/no-unused-vars": "off"
4647
}
4748
},
4849
{

.prettierrc

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
2+
"semi": true,
3+
"trailingComma": "all",
24
"singleQuote": true,
3-
"printWidth": 80
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"endOfLine": "auto"
49
}

.vscode/settings.json

+31-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
{
2+
"editor.codeActionsOnSave": {
3+
"source.organizeImports": false,
4+
"source.fixAll": true,
5+
},
6+
"css.validate": false,
7+
"eslint.validate": [
8+
"javascript",
9+
"javascriptreact",
10+
"typescript",
11+
"typescriptreact",
12+
"html"
13+
],
14+
"[javascript]": {
15+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
216
"editor.codeActionsOnSave": {
3-
"source.fixAll": true,
4-
"source.organizeImports": true
17+
"source.fixAll.eslint": true
518
},
6-
"css.validate": false,
7-
"eslint.validate": [
8-
"javascript",
9-
"javascriptreact",
10-
"typescript",
11-
"typescriptreact",
12-
"html"
13-
],
19+
"editor.formatOnSave": true
20+
},
21+
"[typescript]": {
22+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
23+
"editor.codeActionsOnSave": {
24+
"source.fixAll.eslint": true
25+
},
26+
"editor.formatOnSave": true
27+
},
28+
"[json]": {
29+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
30+
"editor.codeActionsOnSave": {
31+
"source.fixAll.eslint": true
32+
},
33+
"editor.formatOnSave": true
34+
}
1435
}

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Angular starter for enterprise-grade front-end projects, built under a clean arc
44

55
## ⚗️ Features
66

7+
- Strict mode.
78
- Lazy loading.
89
- Smart and pure components pattern.
910
- Components types (e.g. component, page).
@@ -19,7 +20,7 @@ Angular starter for enterprise-grade front-end projects, built under a clean arc
1920
- Scalable CSS architecture with [ITCSS](https://itcss.io/).
2021
- [Lighthouse](https://developers.google.com/web/tools/lighthouse) reports improved.
2122
- Migration from TSLint to ESLint.
22-
- Husky hooks
23+
- ESLint migration.
2324

2425
## 📄 Pages
2526

angular.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"angular-boilerplate": {
77
"projectType": "application",
88
"schematics": {
9+
"@schematics/angular:application": {
10+
"strict": true
11+
},
912
"@schematics/angular:component": {
1013
"style": "scss"
1114
}
@@ -47,21 +50,20 @@
4750
"optimization": true,
4851
"outputHashing": "all",
4952
"sourceMap": false,
50-
"extractCss": true,
5153
"namedChunks": false,
5254
"extractLicenses": true,
5355
"vendorChunk": false,
5456
"buildOptimizer": true,
5557
"budgets": [
5658
{
5759
"type": "initial",
58-
"maximumWarning": "2mb",
59-
"maximumError": "5mb"
60+
"maximumWarning": "500kb",
61+
"maximumError": "1mb"
6062
},
6163
{
6264
"type": "anyComponentStyle",
63-
"maximumWarning": "6kb",
64-
"maximumError": "10kb"
65+
"maximumWarning": "2kb",
66+
"maximumError": "4kb"
6567
}
6668
],
6769
"serviceWorker": true,

package.json

+11-9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "angular-boilerplate",
33
"version": "0.0.0",
44
"private": true,
5+
"sideEffects": false,
56
"scripts": {
67
"ng": "ng",
78
"dev": "ng serve -o",
@@ -27,6 +28,8 @@
2728
]
2829
},
2930
"dependencies": {
31+
"@angular-eslint/builder": "^1.1.0",
32+
"@angular-eslint/template-parser": "^1.1.0",
3033
"@angular/animations": "~11.0.0",
3134
"@angular/common": "~11.0.0",
3235
"@angular/compiler": "~11.0.0",
@@ -44,24 +47,21 @@
4447
"devDependencies": {
4548
"@angular-builders/custom-webpack": "^11.0.0",
4649
"@angular-devkit/build-angular": "~0.1101.2",
47-
"@angular-eslint/builder": "1.1.0",
48-
"@angular-eslint/eslint-plugin": "1.1.0",
49-
"@angular-eslint/eslint-plugin-template": "1.1.0",
50-
"@angular-eslint/schematics": "^0.8.0-beta.7",
51-
"@angular-eslint/template-parser": "1.1.0",
50+
"@angular-eslint/eslint-plugin": "^1.1.0",
51+
"@angular-eslint/eslint-plugin-template": "^1.1.0",
5252
"@angular/cli": "~11.1.2",
5353
"@angular/compiler-cli": "~11.0.0",
5454
"@angular/localize": "^11.0.0",
5555
"@fullhuman/postcss-purgecss": "^3.1.3",
5656
"@types/jasmine": "~3.6.3",
5757
"@types/jasminewd2": "~2.0.3",
5858
"@types/node": "^14.14.22",
59-
"@typescript-eslint/eslint-plugin": "4.14.2",
60-
"@typescript-eslint/parser": "4.14.2",
59+
"@typescript-eslint/eslint-plugin": "^4.14.2",
6160
"autoprefixer": "^10.2.4",
6261
"eslint": "^7.19.0",
63-
"eslint-plugin-jsdoc": "31.6.0",
64-
"eslint-plugin-prefer-arrow": "1.2.3",
62+
"eslint-config-prettier": "^7.2.0",
63+
"eslint-plugin-angular": "^4.0.1",
64+
"eslint-plugin-prettier": "^3.3.1",
6565
"husky": "^4.3.8",
6666
"jasmine-core": "~3.6.0",
6767
"jasmine-spec-reporter": "~6.0.0",
@@ -76,6 +76,8 @@
7676
"postcss-import": "^12.0.1",
7777
"postcss-loader": "^4.2.0",
7878
"postcss-scss": "^3.0.4",
79+
"prettier": "^2.2.1",
80+
"prettier-eslint": "^12.0.0",
7981
"protractor": "~7.0.0",
8082
"ts-node": "~9.1.1",
8183
"typescript": "~4.0.5",

src/app/+auth/pages/forgot-password-email-sent/forgot-password-email-sent.page.spec.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ describe('ForgotPasswordEmailSentPage', () => {
66
let component: ForgotPasswordEmailSentPage;
77
let fixture: ComponentFixture<ForgotPasswordEmailSentPage>;
88

9-
beforeEach(waitForAsync(() => {
10-
TestBed.configureTestingModule({
11-
declarations: [ ForgotPasswordEmailSentPage ]
12-
})
13-
.compileComponents();
14-
}));
9+
beforeEach(
10+
waitForAsync(() => {
11+
TestBed.configureTestingModule({
12+
declarations: [ForgotPasswordEmailSentPage],
13+
}).compileComponents();
14+
}),
15+
);
1516

1617
beforeEach(() => {
1718
fixture = TestBed.createComponent(ForgotPasswordEmailSentPage);

src/app/+auth/pages/forgot-password-email-sent/forgot-password-email-sent.page.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ import { Component, OnInit } from '@angular/core';
22

33
@Component({
44
templateUrl: './forgot-password-email-sent.page.html',
5-
styleUrls: ['./forgot-password-email-sent.page.scss']
5+
styleUrls: ['./forgot-password-email-sent.page.scss'],
66
})
77
export class ForgotPasswordEmailSentPage implements OnInit {
8+
constructor() {}
89

9-
constructor() { }
10-
11-
ngOnInit(): void {
12-
}
13-
10+
ngOnInit(): void {}
1411
}

src/app/+auth/pages/forgot-password/forgot-password.page.spec.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ describe('ForgotPasswordPage', () => {
66
let component: ForgotPasswordPage;
77
let fixture: ComponentFixture<ForgotPasswordPage>;
88

9-
beforeEach(waitForAsync(() => {
10-
TestBed.configureTestingModule({
11-
declarations: [ ForgotPasswordPage ]
12-
})
13-
.compileComponents();
14-
}));
9+
beforeEach(
10+
waitForAsync(() => {
11+
TestBed.configureTestingModule({
12+
declarations: [ForgotPasswordPage],
13+
}).compileComponents();
14+
}),
15+
);
1516

1617
beforeEach(() => {
1718
fixture = TestBed.createComponent(ForgotPasswordPage);

src/app/+auth/pages/forgot-password/forgot-password.page.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ import { Component, OnInit } from '@angular/core';
22

33
@Component({
44
templateUrl: './forgot-password.page.html',
5-
styleUrls: ['./forgot-password.page.scss']
5+
styleUrls: ['./forgot-password.page.scss'],
66
})
77
export class ForgotPasswordPage implements OnInit {
8+
constructor() {}
89

9-
constructor() { }
10-
11-
ngOnInit(): void {
12-
}
13-
10+
ngOnInit(): void {}
1411
}

src/app/+auth/pages/password-reset-failed/password-reset-failed.page.spec.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ describe('PasswordResetFailedPage', () => {
66
let component: PasswordResetFailedPage;
77
let fixture: ComponentFixture<PasswordResetFailedPage>;
88

9-
beforeEach(waitForAsync(() => {
10-
TestBed.configureTestingModule({
11-
declarations: [ PasswordResetFailedPage ]
12-
})
13-
.compileComponents();
14-
}));
9+
beforeEach(
10+
waitForAsync(() => {
11+
TestBed.configureTestingModule({
12+
declarations: [PasswordResetFailedPage],
13+
}).compileComponents();
14+
}),
15+
);
1516

1617
beforeEach(() => {
1718
fixture = TestBed.createComponent(PasswordResetFailedPage);

src/app/+auth/pages/password-reset-failed/password-reset-failed.page.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ import { Component, OnInit } from '@angular/core';
22

33
@Component({
44
templateUrl: './password-reset-failed.page.html',
5-
styleUrls: ['./password-reset-failed.page.scss']
5+
styleUrls: ['./password-reset-failed.page.scss'],
66
})
77
export class PasswordResetFailedPage implements OnInit {
8+
constructor() {}
89

9-
constructor() { }
10-
11-
ngOnInit(): void {
12-
}
13-
10+
ngOnInit(): void {}
1411
}

src/app/+auth/pages/password-reset-succeeded/password-reset-succeeded.page.spec.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ describe('PasswordResetSucceededPage', () => {
66
let component: PasswordResetSucceededPage;
77
let fixture: ComponentFixture<PasswordResetSucceededPage>;
88

9-
beforeEach(waitForAsync(() => {
10-
TestBed.configureTestingModule({
11-
declarations: [ PasswordResetSucceededPage ]
12-
})
13-
.compileComponents();
14-
}));
9+
beforeEach(
10+
waitForAsync(() => {
11+
TestBed.configureTestingModule({
12+
declarations: [PasswordResetSucceededPage],
13+
}).compileComponents();
14+
}),
15+
);
1516

1617
beforeEach(() => {
1718
fixture = TestBed.createComponent(PasswordResetSucceededPage);

src/app/+auth/pages/password-reset/password-reset.page.spec.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ describe('PasswordResetPage', () => {
66
let component: PasswordResetPage;
77
let fixture: ComponentFixture<PasswordResetPage>;
88

9-
beforeEach(waitForAsync(() => {
10-
TestBed.configureTestingModule({
11-
declarations: [ PasswordResetPage ]
12-
})
13-
.compileComponents();
14-
}));
9+
beforeEach(
10+
waitForAsync(() => {
11+
TestBed.configureTestingModule({
12+
declarations: [PasswordResetPage],
13+
}).compileComponents();
14+
}),
15+
);
1516

1617
beforeEach(() => {
1718
fixture = TestBed.createComponent(PasswordResetPage);

src/app/+auth/pages/password-reset/password-reset.page.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ import { Component, OnInit } from '@angular/core';
22

33
@Component({
44
templateUrl: './password-reset.page.html',
5-
styleUrls: ['./password-reset.page.scss']
5+
styleUrls: ['./password-reset.page.scss'],
66
})
77
export class PasswordResetPage implements OnInit {
8+
constructor() {}
89

9-
constructor() { }
10-
11-
ngOnInit(): void {
12-
}
13-
10+
ngOnInit(): void {}
1411
}

src/app/+auth/pages/sign-in/sign-in.page.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class SignInPage implements OnInit {
1313
constructor(
1414
private router: Router,
1515
private activatedRoute: ActivatedRoute,
16-
private authService: AuthService
16+
private authService: AuthService,
1717
) {
1818
this.returnUrl =
1919
this.activatedRoute.snapshot.queryParamMap.get('returnUrl') ||
@@ -22,7 +22,7 @@ export class SignInPage implements OnInit {
2222

2323
ngOnInit(): void {}
2424

25-
onClickSignIn() {
25+
onClickSignIn(): void {
2626
this.authService.signIn();
2727
this.router.navigate([this.returnUrl]);
2828
}

0 commit comments

Comments
 (0)