My personal ESLint shareable configurations.
npm install --save-dev eslint @btmills/eslint-config-btmills
If using ES6 modules, install eslint-plugin-import:
npm install --save-dev eslint-plugin-import
If using React, install eslint-plugin-react and eslint-plugin-react-hooks:
npm install --save-dev eslint-plugin-react eslint-plugin-react-hooks
If using TypeScript, install typescript-eslint:
npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
If using Flow, install babel-eslint and eslint-plugin-flowtype:
npm install --save-dev babel-eslint eslint-plugin-flowtype
Add one of the following lines to your project's .eslintrc.js
:
module.exports = {
"extends": "@btmills/eslint-config-btmills", // Defaults to es5
"extends": "@btmills/eslint-config-btmills/es5",
"extends": "@btmills/eslint-config-btmills/es2015",
"extends": "@btmills/eslint-config-btmills/es2016",
"extends": "@btmills/eslint-config-btmills/es2017",
"extends": "@btmills/eslint-config-btmills/es2018",
"extends": "@btmills/eslint-config-btmills/es2019",
"extends": "@btmills/eslint-config-btmills/es2020",
"extends": "@btmills/eslint-config-btmills/es2021",
"extends": "@btmills/eslint-config-btmills/es2022",
// Use React and Flow with a language config by extending multiple configs
"extends": [
"@btmills/eslint-config-btmills/es2015",
"@btmills/eslint-config-btmills/react",
"@btmills/eslint-config-btmills/flow"
],
// Use TypeScript
"overrides": [
{
"files": ["**/*.ts{,x}"],
"extends": ["@btmills/eslint-config-btmills/typescript"]
},
// Optionally include rules that require type information
{
"files": ["**/*.ts{,x}"],
"extends": ["@btmills/eslint-config-btmills/typescript-project"],
"parserOptions": {
"project": "./tsconfig.json"
}
}
]
};
MIT © Brandon Mills