@m1rn/eslint-config
v1.0.2
Published
ESLint shareable configurations
Downloads
16
Maintainers
Readme
@m1rn/eslint-config
ESLint preset configuration library.
Features
- 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.
Prerequisites
Node.js
- Version >= 18.20.0
- ESM Project
ESLint
- Version >= 9.6.0
- Flat Config
Installation
npm install @m1rn/eslint-config --save-dev
Usage
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 */)
]
Presets
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.
Plugins Name
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 }