@webed/eslint-config
Shared ESLint config used in Webed projects.
This is meant to be used alongside Prettier (with @webed/prettier-config
).
Usage
-
Remove existing
.eslintrc.*
file, if present. -
Install
eslint
and the config.npm install -D eslint @webed/eslint-config
-
Add the following to
package.json
:"eslintConfig": { "extends": "@webed/eslint-config/recommended" }
@webed/eslint-config
@webed/prettier-config
With Prettier and -
Set up Prettier and
@webed/prettier-config
. -
When using with Prettier and
@webed/prettier-config
, ESLint should run first. Set up your scripts inpackage.json
like 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 complain -
npm run fmt
: attempt to autofix lint issues and autoformat code
📝 Not every rule in this configuration is autofixable, sonpm run fmt
may continue failing until lint issues are addressed manually. -
With Husky
-
Install husky:
npm install -D husky
-
Add the following to
package.json
:"husky": { "hooks": { "pre-commit": "npm run lint" } },