@killerchip/eslint-config
v0.0.14
Published
This package provides various shareable [ESLint](https://eslint.org/) configuration for various development environments.
Downloads
7
Readme
@killerchip/eslint-config
This package provides various shareable ESLint configuration for various development environments.
It includes eslint
configuration for the following project types:
- javascript
- typescript
All the configuration consider that your project uses
prettier
formatting so, it disables all the rules that conflict withprettier
formatting.
Installation
Regardless of your project type install the package with:
npm:
npm install --save-dev eslint @killerchip/eslint-config
yarn:
yarn install -D eslint @killerchip/eslint-config
pnpm:
pnpm install -D eslint @killerchip/eslint-config
Configuration - Javascript
For javascript projects, add this to your .eslintrc.js
file:
module.exports = {
env: {
node: true,
},
extends: '@killerchip/eslint-config/javascript',
};
add a script in your package.json
:
{
"scripts": {
"lint": "eslint ."
}
}
Configuration - Typescript
For typescript projects, need to install additional package:
npm:
npm install --save-dev @typescript-eslint/eslint-plugin@latest @typescript-eslint/parser@latest
yarn:
yarn install -D eslint @typescript-eslint/eslint-plugin@latest @typescript-eslint/parser@latest
pnpm:
pnpm install -D eslint @typescript-eslint/eslint-plugin@latest @typescript-eslint/parser@latest
Add .eslintrc.js
file to your project with the following content:
module.exports = {
extends: ['@killerchip/eslint-config/typescript'],
parserOptions: {
tsconfigRootDir: __dirname,
project: true,
},
};
add a script in your package.json
:
{
"scripts": {
"lint": "eslint ."
}
}
If you get an error like: "ESLint was configured to run ... However, that TSConfig does not / none of those TSConfigs include this file", then add these files in an .eslintignore
file. Find more details here: https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file
Configuration - NextJS
Install the needed packages:
npm install -D @killerchip/eslint-config @typescript-eslint/eslint-plugin@latest @typescript-eslint/parser@latest eslint
In .eslintrc.js
file add the following content:
module.exports = {
extends: [
"next/core-web-vitals",
"@killerchip/eslint-config/typescript",
"prettier",
],
parserOptions: {
tsconfigRootDir: __dirname,
project: true,
},
overrides: require("@killerchip/eslint-config/next.override").overrides,
};