0.3.0 • Published 3 years ago
@navify/eslint-config v0.3.0
@navify/eslint-config
Shared ESLint config used in Navify and Jigra projects.
This is meant to be used alongside Prettier (with @navify/prettier-config).
Usage
- Remove existing
.eslintrc.*file, if present. Install
eslintand the config.npm install -D eslint @navify/eslint-configAdd the following to
package.json:"eslintConfig": { "extends": "@navify/eslint-config/recommended" }
:memo: You can also use the base rule set: @navify/eslint-config
With Prettier and @navify/prettier-config
- Set up Prettier and
@navify/prettier-config. When using with Prettier and
@navify/prettier-config, ESLint should run first. Set up your scripts inpackage.jsonlike this:"scripts": { "lint": "npm run eslint && npm run prettier -- --check", "fmt": "npm run eslint -- --fix && npm run prettier -- --write", "prettier": "prettier \"**/*.ts\"", "eslint": "eslint . --ext .ts", }npm run lint: for checking if ESLint and Prettier complainnpm run fmt: attempt to autofix lint issues and autoformat code
:memo: Not every rule in this configuration is autofixable, so
npm run fmtmay continue failing until lint issues are addressed manually.
With Husky
Install husky:
npm install -D huskyAdd the following to
package.json:"husky": { "hooks": { "pre-commit": "npm run lint" } },
0.3.0
3 years ago