This project was generated with Angular CLI version 8.3.26.
Install these dependencies
$ npm install --save-dev eslint eslint-plugin-import eslint-plugin-json @typescript-eslint/eslint-plugin prettier eslint-plugin-prettier eslint-config-prettier @typescript-eslint/parser husky lint-staged nodemon npm-run-all stylelint stylelint-scss
Copy the following files
- .eslintrc.json
- .prettierrc.js
- .stylelintrc.json
Add the following command to the scripts.
"lint": "npm-run-all --parallel lint:css lint:ts",
"lint:css": "stylelint --color --fix \"**/*.scss\"",
"lint:ts": "eslint --color --quiet --fix --ext .js,.ts .",
"lint:watch": "nodemon -e ts,js,scss -x npm run lint",
"dev": "npm-run-all --parallel lint:watch start"
Add the following code to the package.json
file.
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,ts,tsx}": [
"eslint --fix"
]
}
Finally copy the code from .vscode > settings.json
vscode settings for auto format on save. And add the following extenstions to the vs code.
dbaeumer.vscode-eslint
esbenp.prettier-vscode
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.
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
.
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.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.