2.27.7 • Published 9 months ago
@avanlan/eslint-config v2.27.7
@avanlan/eslint-config
Supports ESLint v9 or v8.50.0+
!IMPORTANT Since v1.0.0, this config is rewritten to the new ESLint Flat config, check the release note for more details.
Usage
pnpm i -D eslint @avanlan/eslint-config@^2
And create eslint.config.mjs
in your project root:
// eslint.config.mjs
import avanlan from '@avanlan/eslint-config'
export default avanlan()
If you still use some configs from the legacy eslintrc format, you can use the @eslint/eslintrc
package to convert them to the flat config.
// eslint.config.mjs
import avanlan from '@avanlan/eslint-config'
import { FlatCompat } from '@eslint/eslintrc'
const compat = new FlatCompat()
export default avanlan(
{
ignores: [],
},
// Legacy config
...compat.config({
extends: [
'eslint:recommended',
// Other extends...
],
})
// Other flat configs...
)
Note that
.eslintignore
no longer works in Flat config, see customization for more details.
Add script for package.json
For example:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}