This is a simple boilerplate for Angular applications. It sets up ESLint, Prettier and a pre-commit hook that runs both. ⚙️
To generate a new application with that template, you just have to hit "Use this template button" button at the top of this page. If you prefer, this configuration can also be replicated with the following steps. It only takes some minutes. 👇
- Generate a new Angular application with
ng new {{app-name}}
. - Install ESLint with
npm i eslint -D
. - Create the initial ESLint configuration with
eslint --init
. ESLint will prompt you some questions to generate the config. If you want to have the very same config just copy and paste the contents of.eslintrc.json
. - Install Prettier with
npm i prettier -D
. - Create a file called
.prettierrc.json
at the root of the project, containing the object{ "quote": "single", "semi": false }
. - Generate the pre-commit configuration by running
npx mrm@2 lint-staged
. At that point, lint-staged might have generated a weird log file called6
at the root of your project. If it did, you might want to delete it. - Change the
lint-staged
property ofpackage.json
to:{ "*.ts": "eslint --cache --fix", "*.{ts,html,css,json}": "prettier --write" }
.
Aaaaand you're good to go. Happy coding! 🥰