Shared eslint configuration for my personal TypeScript projects.
-
Install the dependencies:
$ npm install -D \ eslint \ @kayahr/eslint-config \ @typescript-eslint/eslint-plugin \ @typescript-eslint/parser \ eslint-plugin-deprecation \ eslint-plugin-simple-import-sort
-
Create an
.eslintrc.json
configuration file with the following content (Modify environment if necessary):{ "$schema": "https://json.schemastore.org/eslintrc", "root": true, "env": { "es6": true, "node": true, "browser": true }, "extends": [ "@kayahr" ] }
-
Add the following script line to
package.json
:"lint": "eslint --max-warnings 0 --ext .ts src"
-
Reference the
lint
script in thetest
script:"test": "npm run -s lint && npm run -s check"
-
Run eslint by typing
npm test
ornpm run lint
.