ESLint preset configuration library.
- Best Practices: Ensures accurate and reliable type checking.
- Strict Configurations: Keeps your code quality at a high standard.
- Automatic Formatting: No need to use Prettier.
- Flexible Setup: Adapts to various project needs.
- Version >= 18.20.0
- ESM Project
- Version >= 9.6.0
- Flat Config
npm install @m1rn/eslint-config --save-dev
Typically, you can import m1rn
preset and use it directly:
import { m1rn } from '@m1rn/eslint-config'
export default m1rn()
Alternatively, you can configure each integration separately:
import { m1rn } from '@m1rn/eslint-config'
export default m1rn({
ignores: {
gitignore: true
},
node: true,
browser: true,
javascript: {
jsx: true,
style: true
},
typescript: {
tsx: true,
style: true,
typeAware: true
},
jsx: {
tsx: true,
style: true
},
react: {
tsx: true
},
html: {
a11y: true,
style: true
},
json: {
style: true
},
markdown: {
codeBlocks: true
}
})
You can also import specific presets for granular configuration and combine them as you wish:
import {
ignores,
node,
browser,
javascript,
typescript,
jsx,
react,
html,
json,
markdown
} from '@m1rn/eslint-config'
export default [
...ignores(/* Options */),
...node(),
...browser(),
...javascript(/* Options */),
...typescript(/* Options */),
...jsx(/* Options */),
...react(/* Options */),
...html(/* Options */),
...json(/* Options */),
...markdown(/* Options */)
]
-
A comprehensive configuration preset that combines multiple configurations based on the provided options. By default, it enables certain presets based on the project environment and dependencies.
-
Globally ignore certain files and directories that are commonly excluded, as well as those specified in the
.gitignore
file. -
Specific rules and settings for Node.js environments.
-
Specific rules and settings for Browser environments.
-
Specific rules and settings for JavaScript.
-
Specific rules and settings for TypeScript.
-
Specific rules and settings for JSX.
-
Specific rules and settings for React.
-
Specific rules and settings for HTML.
-
Specific rules and settings for JSON、JSONC and JSON5.
-
Specific rules and settings for Markdown.
I renamed plugins to make the overall naming more consistent and easier to write.
Plugin | Name |
---|---|
@eslint/markdown | md |
@eslint-react/eslint-plugin | react |
@html-eslint/eslint-plugin | html |
@stylistic/eslint-plugin | stylistic |
@typescript-eslint/eslint-plugin | ts |
eslint-plugin-import-x | import |
eslint-plugin-jsonc | json |
eslint-plugin-perfectionist | sort |
eslint-plugin-unicorn | unicorn |
When you want to override rules, or disable them inline, you need to update to the new prefix:
-// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
+// eslint-disable-next-line ts/consistent-type-definitions
type foo = { bar: 2 }