Preset configurations for various environments. Presets can be loaded directly
instead of extending, or a new config can be created using the exported
create
method.
yarn add @alexseitsinger/eslint-config
Returns a complete eslint config using the rules for the specified plugins. All configs come with certain plugins automatically, so no need to specify them. Second argument is useDefaults. If false, the config will not include the default plugins.
Plugins Included:
- eslint
- eslint-comments
- node
- sort-requires
- sort-destructure-keys
- promise
- unicorn
- security
- no-loops
- return-early-no-assign
const reactConfig = createConfig([
"react", "react-hooks",
])
module.exports = {
overrides: [
{
files: ["*.js", "*.jsx"],
...reactConfig,
},
]
}
Returns the ruleset for a plugin (patches, options, rules). The second arguments specifies if its a typescript plugin, or not (default: false).
const reactRules = getRules("react", false)
Each of these is exported from the package along with the two methods above.
Name | Plugin Groups Included |
---|---|
javascript | default, javascript |
javascriptReact | default, javascript, testing, react |
javascriptReactRedux | default, javascript, testing, react, redux |
typescript | default, typescript |
typescriptReact | default, typescript, testing, react, |
typescriptReactRedux | default, typescript, testing, react, redux |
markdownJavascript | default, javascript, markdown |
markdownJavascriptReact | default, javascript, react, markdown |
markdownJavascriptReactRedux | default, javascript, react, redux, markdown |
markdownTypescript | default, typescript, markdown |
markdownTypescriptReact | default, typescript, react, markdown |
markdownTypescriptReactRedux | default, typescript, react, redux, markdown |
jsonPackage | package-json |
json | json |
Name | Plugins Used |
---|---|
default | eslint, eslint-comments, node, sort-requires, promise, unicorn, security, sort-destructure-keys, no-loops, return-early-dont-assign, |
javascript | none |
testing | jest, jest-formatting |
react | react, react-hooks, react-perf |
redux | react-redux, redux-saga |
typescript | tsdoc, @typescript-eslint/eslint-plugin, jsx-falsy |
markdown | markdown |
jsonPackage | package-json |
json | json |
// .eslintrc.js
const configs = require("@alexseitsinger/eslint-config")
module.exports = {
overrides: [
{
files: ["*.md"],
...configs.markdownJavascript,
},
{
files: ["*.js", "*.jsx"],
...configs.javascriptReact,
},
{
files: ["*.ts", "*.tsx"],
...configs.typescriptReact,
},
],
}