搭配 @antfu/eslint-config 进行使用:
pnpm i -D eslint @antfu/eslint-config @anthony-ju/eslint-config
在根目录创建eslint.config.js
文件,并将以下内容添加到文件中:
With "type": "module"
in package.json (recommended):
import antfu from '@antfu/eslint-config'
import { ignores, rules } from '@anthony-ju/eslint-config'
export default antfu(
{
rules,
ignores,
},
)
With CJS:
const antfu = require('@antfu/eslint-config').default
const { ignores, rules } = require('@anthony-ju/eslint-config')
module.exports = antfu(
{
rules,
ignores,
},
)
Add script for package.json:
{
"scripts": {
"lint": "eslint --fix"
}
}