Skip to content

Commit 5fc2061

Browse files
committed
feat: code linting & prettier
1 parent 7fc3f8a commit 5fc2061

18 files changed

+10462
-609
lines changed

README.md

+23-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
# Default template
1+
# Hack
22

3-
Template for angular application with a lazy-loadable structure.
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.1.
44

5-
`share` – a folder for shared pieces of code:
6-
* interfaces
7-
* components
8-
* pipes
9-
* directives
10-
* helpers (utils)
11-
* anything else
5+
## Development server
126

13-
`core` a folder for core things such as services
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
148

15-
`home` – a module for home page that you can change anyway you`d like. You may use it as a boilerplate for other modules.
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

package.json

+37-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,27 @@
77
"build": "ng build",
88
"test": "ng test",
99
"lint": "ng lint",
10-
"e2e": "ng e2e"
10+
"e2e": "ng e2e",
11+
"lint:fix": "eslint --fix \"src/**/*.ts\"",
12+
"style:fix": "stylelint \"src/**/*.scss\" --syntax scss --fix",
13+
"format:fix": "prettier --write \"src/**/*.{ts,js,json,scss}\""
1114
},
1215
"private": true,
16+
"husky": {
17+
"hooks": {
18+
"pre-commit": "lint-staged"
19+
}
20+
},
21+
"lint-staged": {
22+
"*.{js,ts,tsx}": [
23+
"eslint --fix",
24+
"prettier --write"
25+
],
26+
"*.scss": [
27+
"prettier --write",
28+
"stylelint --syntax scss --fix"
29+
]
30+
},
1331
"dependencies": {
1432
"@angular/animations": "~9.0.0",
1533
"@angular/common": "~9.0.0",
@@ -28,18 +46,35 @@
2846
"@angular/cli": "~9.0.1",
2947
"@angular/compiler-cli": "~9.0.0",
3048
"@angular/language-service": "~9.0.0",
31-
"@types/node": "^12.11.1",
3249
"@types/jasmine": "~3.5.0",
3350
"@types/jasminewd2": "~2.0.3",
51+
"@types/node": "^12.11.1",
52+
"@typescript-eslint/eslint-plugin": "^3.0.2",
53+
"@typescript-eslint/parser": "^3.0.2",
3454
"codelyzer": "^5.1.2",
55+
"eslint": "^7.1.0",
56+
"eslint-config-prettier": "^6.11.0",
57+
"eslint-plugin-angular": "^4.0.1",
58+
"eslint-plugin-node": "^11.1.0",
59+
"eslint-plugin-prettier": "^3.1.3",
60+
"eslint-plugin-simple-import-sort": "^5.0.3",
61+
"husky": "^4.2.5",
3562
"jasmine-core": "~3.5.0",
3663
"jasmine-spec-reporter": "~4.2.1",
3764
"karma": "~4.3.0",
3865
"karma-chrome-launcher": "~3.1.0",
3966
"karma-coverage-istanbul-reporter": "~2.1.0",
4067
"karma-jasmine": "~2.0.1",
4168
"karma-jasmine-html-reporter": "^1.4.2",
69+
"lint-staged": "^10.2.7",
70+
"prettier": "^2.0.5",
4271
"protractor": "~5.4.3",
72+
"stylelint": "^13.5.0",
73+
"stylelint-config-prettier": "^8.0.1",
74+
"stylelint-config-sass-guidelines": "^7.0.0",
75+
"stylelint-config-standard": "^20.0.0",
76+
"stylelint-prettier": "^1.1.2",
77+
"stylelint-scss": "^3.17.2",
4378
"ts-node": "~8.3.0",
4479
"tslint": "~5.18.0",
4580
"typescript": "~3.7.5"

src/app/app-routing.module.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import { NgModule } from '@angular/core';
2-
import { Routes, RouterModule } from '@angular/router';
3-
2+
import { RouterModule, Routes } from '@angular/router';
43

54
const routes: Routes = [
65
{
76
path: '',
87
pathMatch: 'full',
98
loadChildren: () => import('./home/home.module').then(m => m.HomeModule),
10-
}
9+
},
1110
];
1211

1312
@NgModule({
1413
imports: [RouterModule.forRoot(routes)],
15-
exports: [RouterModule]
14+
exports: [RouterModule],
1615
})
17-
export class AppRoutingModule { }
16+
export class AppRoutingModule {}

0 commit comments

Comments
 (0)