eslint-config-mv v1.0.1
eslint-config-mkvlrn
purpose
Set of ESLint configurations for TypeScript and JavaScript Node projects with sane defaults. Also exposes a simple prettier (mostly default) config.
Mainly extends AirBnb's excellent guide, disabling a few rules in order to accommodate the projects I usually create.
All dependencies are included as straight up dependencies because ESLint flat config is still very far away and for now you have to install peer-dependencies yourself, and that ain't right.
installing
# typescript project
# eslint and typescript are peerDependencies, so they can be skipped if already installed
npm add eslint typescript eslint-config-mkvlrn -D
# javascript project
# eslint belongs in peerDependencies, so it can be skipped if already installed
npm add eslint eslint-config-mkvlrn -D
extending
// extending configuration for a typescript project WITHOUT react
// package.json
{
...
"eslintConfig":{
"extends": ["mkvlrn/ts"]
}
...
}
// extending configuration for a typescript project WITH react
// package.json
{
...
"eslintConfig":{
"extends": ["mkvlrn/ts-react"]
}
...
}
// extending configuration for a javascript project WITHOUT react
// package.json
{
...
"eslintConfig":{
"extends": ["mkvlrn/js"]
}
...
}
// extending configuration for a javascript project WITH react
// package.json
{
...
"eslintConfig":{
"extends": ["mkvlrn/js-react"]
}
...
}
extending the prettier config
// package.json
{
...
"prettier": "eslint-config-mv/prettier.config.js"
...
}
disabled rules
no-underscore-dangle
the rule just makes it awkward to deal with mongodb models
import/prefer-default-export
the rule spoils tree-shaking (in some projects) and marks the exporting of cloud functions that require a named export as incorrect
react/jsx-uses-react & react/react-in-jsx-scope
react's new jsx transform doesn't expect React to be in scope when using jsx, and these rules expect it to be imported