A dynamic multi-framework ESLint config.
The lint rules that are applied to a given file depend on its extension and whether its associated package is a dependency of your project.
.tsx
extension inside of a project with dependencies on typescript
, react
, and prettier
will be linted with rules for TypeScript, React, and Prettier; but not with rules for Svelte or Vue.**/*.{spec,test}.{js?(x),ts?(x)}
inside of a project with a dependency on jest
will be linted with Jest rules.Node.js projects are a special case because node
itself is not typically installed as a project level dependency and it does not always use unique file extensions. To address this, this package exports a separate config with additional rules for Node.js. See Usage.
In addition to framework or file specific lint rules, rules common to multiple file types are internally extended from the following configs/plugins:
prettier
)Install as a devDependency with your preferred Node.js package manager (npm, pnpm, yarn, etc.):
pnpm i -D @theurgi/eslint-config
Extend this package in your local eslint config (e.g. .eslintrc.json):
{
"extends": ["@theurgi/eslint-config"]
}
This config includes all the non-Node rules plus Node specific rules and overrides.
{
"extends": ["@theurgi/eslint-config/node"]
}
For error highlighting and auto-fix-on-save, install the ESLint extension and configure VSCode's settings as follows:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": [
"astro",
"javascript",
"javascriptreact",
"json",
"json5",
"jsonc",
"svelte",
"typescript",
"typescriptreact",
"vue"
]
}
Special thanks to privatenumber whose eslint-config was the primary reference for this package.