eslint-config-hardcore
eslint-config-hardcore copied to clipboard
The most strict (yet practical) ESLint config. 53 plugins. 1333 rules. React, Vue, Node, and pure JS/TS.
eslint-config-hardcore
The most strict (yet practical) ESLint config.
Aims to include as many plugins and rules as possible to make your code extremely consistent and robust.
37 plugins. 1243 rules.
Usage
npm install eslint-config-hardcore --save-dev
Available configs:
-
hardcore
- base framework-agnostic config -
hardcore/ts
- additional config for TypeScript -
hardcore/node
- additional config for Node.js -
hardcore/react
- additional config for React -
hardcore/vue
- additional config for Vue 3/Nuxt 3 -
hardcore/react-testing-library
- additional config for React Testing Library -
hardcore/jest
- additional config for Jest -
hardcore/fp
- additional config for functional programming -
hardcore/ts-for-js
- additional config for linting JavaScript with typescript-eslint
Example .eslintrc.json
for a React project:
{
"extends": [
"hardcore",
"hardcore/react",
"hardcore/react-testing-library",
"hardcore/jest",
"hardcore/fp"
],
"env": {
"browser": true
},
"overrides": [
{
"files": ["server/**/*.js"],
"extends": ["hardcore/node"],
"env": {
"browser": false
}
}
]
}
Example .eslintrc.json
for a TypeScript React project:
{
"extends": [
"hardcore",
"hardcore/react",
"hardcore/react-testing-library",
"hardcore/jest",
"hardcore/fp",
"hardcore/ts"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"env": {
"browser": true
},
"overrides": [
{
"files": ["server/**/*.ts"],
"extends": ["hardcore/node"],
"env": {
"browser": false
}
}
]
}
Example .eslintrc.json
for a Vue 3/Nuxt 3 project:
{
"extends": ["hardcore", "hardcore/vue"],
"settings": {
"import/resolver": {
"alias": {
"map": [["@", "./src/"]],
"extensions": [".js", ".vue"]
}
}
}
}
Example .eslintrc.json
for a TypeScript Vue 3/Nuxt 3 project:
{
"extends": ["hardcore", "hardcore/ts", "hardcore/vue"],
"parserOptions": {
"project": "tsconfig.json"
}
}
Configs
hardcore
Base framework-agnostic config.
¹ eslint-plugin-json actually includes 19 rules, but I consider them as one "no-invalid-json" rule.
hardcore/ts
Config for TypeScript.
Plugin | Enabled rules |
---|---|
typescript-eslint | 103 |
eslint-plugin-etc | 10 |
@shopify/eslint-plugin | 3 |
eslint-plugin-sort-class-members | 1 |
eslint-plugin-decorator-position | 1 |
eslint-plugin-no-explicit-type-exports | 1 |
Total: | 119 |
hardcore/node
Config for Node.js.
Plugin | Enabled rules |
---|---|
eslint-plugin-node | 35 |
Total: | 35 |
hardcore/react
Config for React.
Plugin | Enabled rules |
---|---|
eslint-plugin-react | 80 |
eslint-plugin-styled-components-a11y | 33 |
eslint-plugin-jsx-a11y | 32 |
eslint-plugin-react-perf | 4 |
eslint-plugin-react-form-fields | 4 |
@shopify/eslint-plugin | 3 |
eslint-plugin-react-hook-form | 3 |
eslint-plugin-react-hooks | 2 |
Total: | 161 |
hardcore/vue
Config for Vue 3/Nuxt 3.
Plugin | Enabled rules |
---|---|
eslint-plugin-vue | 154 |
Total: | 154 |
hardcore/react-testing-library
Config for React Testing Library.
Plugin | Enabled rules |
---|---|
eslint-plugin-testing-library | 25 |
Total: | 25 |
hardcore/jest
Config for Jest.
Plugin | Enabled rules |
---|---|
eslint-plugin-jest | 48 |
eslint-plugin-jest-dom | 11 |
eslint-plugin-jest-formatting | 7 |
Total: | 66 |
hardcore/fp
Config for functional programming.
Plugin | Enabled rules |
---|---|
eslint-plugin-fp | 13 |
eslint-plugin-ramda | 24 |
Total: | 37 |
hardcore/ts-for-js
Config for linting JavaScript with typescript-eslint.
Plugin | Enabled rules |
---|---|
typescript-eslint | 27 |
@shopify/eslint-plugin | 2 |
eslint-plugin-sort-class-members | 1 |
eslint-plugin-decorator-position | 1 |
Total: | 31 |
Did you know you can lint JavaScript code with typescript-eslint?
Use this config to take advantage of typescript-eslint's advanced type-aware
rules (like
@typescript-eslint/naming-convention
and
@typescript-eslint/prefer-optional-chain
)
without the need to switch to writing TypeScript.
- First, you'll need to create
tsconfig.json
in the root of your project. You don't have to specify any options, just{}
should do it. - Then add
hardcore/ts-for-js
to theoverrides
section in your.eslintrc
like this:
{
"extends": ["hardcore"],
"env": {
"browser": true
},
"overrides": [
{
"files": ["*.js"],
"extends": ["hardcore/ts-for-js"],
"parserOptions": {
"project": "./tsconfig.json"
}
}
]
}
Changelog
License
MIT