@lidofinance/eslint-config v0.46.0
Lido ESint config
Automated, non-opinionated ESLint config foundation
❗ Please note that this ESLint config is still 0.x and is subject to significant changes; it is mainly used by internal Lido teams.
Installation
npm install --dev @lidofinance/eslint-config
# and plugins
npm install --dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-import-resolver-typescript eslint-plugin-eslint-comments eslint-plugin-import eslint-plugin-jest eslint-plugin-promise eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-sonarjs eslint-plugin-unicorn @next/eslint-plugin-nextIf using TypeScript, alter tsconfig.json line includes to include everything, like that:
"include": ["**/*","**/.*"]
ℹ️ Modern module resolution ESLint patch by Rush team is intentionally not used, as it conflicts with same patch in
@next/eslint-plugin.
Configuration
Style rules are intentionally not provided; bring your own code style, whatever it is - prettier, airbnb, xo or standard.
// .eslintrc.js.js
{
"root": true,
"extends": [
// note: use every other config BEFORE @lidofinance config,
// EXCEPT prettier; prettier is bundled with multiple
// disable rules that should be turned off to avoid conflicts
//"airbnb",
"@lidofinance",
//"prettier"
]
}What's inside
@lidofinance/eslint-config is feature-packed config that ships with some logic.
Following assumptions are done:
- ES version target is latest (2022); if you need other, change
envin.eslintrc - code is always server-ready
- code is client-ready if
reactpackage is present - there is no magic resolution mechanism and usage of webpack loaders; only explicit file paths and
tsconfig.jsonpathsare considered - latest version of TypeScript (4.6.x) and ESLint (^8.13) are used
For performance, developer experience and accuracy reasons some rules will turn on if following conditions will happen:
Reactpackage is declared inpackage.jsonreact,react-hooksrules will be used
Nextpackage is declared inpackage.jsonnextplugin rules will be used- react rule
react/react-in-jsx-scopewill turn off
Jestpackage is declared inpackage.jsonjestplugin rules will be used- some rules will be disabled (like "avoid code duplication" and "do not use any") for test-specific file patterns
Typescriptpackage is declared inpackage.json:typescript-eslintrules will be enabled- parser will be switched to typescript-eslint
- if
tsconfig.jsonis present, type-level lint rules will be enabled - if
compilerOptions.strictistrue, additional anti-any rules will be enabled
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago