aus-eslint-config
v2.1.1
Published
eslint9+的一键扁平化配置库
Downloads
339
Readme
aus-eslint-config
- Eslint9+的配置库 简化配置流程 傻瓜式操作 预置了一些常用的eslint规则
- 从2.0.0版本开始,代码样式使用prettier进行格式化(无需安装) 导入方式改变
安装
pnpm install aus-eslint-config -D
使用
eslinteslint.config.mjs
// 项目根目录创建eslint.config.mjs
import { eslintConfig } from 'aus-eslint-config'
export default eslintConfig({
vue: true,
ts: {
'vue/no-unused-vars': 'off'
},
...
})
/**
* AusConfig接口,用于配置代码检查规则, 可以通过对应属性覆盖默认配置
*
* @property {Linter.RulesRecord?} baseRules 基础规则,用于定义通用的js代码检查规则
* @property {Linter.RulesRecord | boolean?} ts TypeScript规则,用于定义TypeScript代码的检查规则;如果为boolean类型,表示是否启用TypeScript检查
* @property {Linter.RulesRecord | boolean?} vue Vue规则,用于定义Vue代码的检查规则;如果为boolean类型,表示是否启用Vue检查
* @property {Linter.RulesRecord | boolean?} unocss Unocss规则,用于定义Unocss相关的检查规则;如果为boolean类型,表示是否启用Unocss检查
* @property {string[]} ignores 忽略列表,用于指定哪些文件或目录在检查时应该被忽略
* @property {Linter.RulesRecord?} rules 自定义规则,允许用户定义额外的代码检查规则
*/
interface AusConfig {
baseRules?: Linter.RulesRecord;
ts?: Linter.RulesRecord | boolean;
vue?: Linter.RulesRecord | boolean;
unocss?: Linter.RulesRecord | boolean;
ignores?: string[];
rules?: Linter.RulesRecord;
}
prettierprettier.config.mjs
// 如果需要使用prettier格式化代码,需要在根目录创建prettier.config.mjs
// 可以使用导出的配置 也可按照prettier的配置进行自定义
import { prettierConfig } from 'aus-eslint-config'
export default prettierConfig({
printWidth: 100,
tabWidth: 2,
...
})
默认ignore目录及文件
'**/dist',
'**/docs',
'**/node_modules',
'**/package-lock.json',
'**/yarn.lock',
'**/pnpm-lock.yaml',
'**/*.woff',
'**/*.woff2',
'**/.idea',
'**/.vscode',
'**/.git',
'**/Dockerfile',
'**/.*'