@basenative / eslint-config
共享ESLint平面配置预设DuganLabs项目。一个观点,一个来源。
安装
pnpm add -D eslint @basenative/eslint-config
使用
选择与运行时匹配的预设。在 eslint.config.js:
// SPA / browser
import config from "@basenative/eslint-config/browser";
export default config;
// Node / scripts
import config from "@basenative/eslint-config/node";
export default config;
// Cloudflare Workers / Pages Functions
import config from "@basenative/eslint-config/worker";
export default config;
// React
import config from "@basenative/eslint-config/react";
export default config;
组成
预设导出一个数组-扩展它:
import base from "@basenative/eslint-config/browser";
export default [
...base,
{
rules: {
"no-console": "warn",
},
},
];
里面有什么?
@eslint/js推荐设置- 下划线前缀免除未使用的变量/参数/捕获的错误
no-eval/no-implied-eval/no-new-func(安全基线)eqeqeq聪明,no-var,prefer-const- Worker预设块(仅限节点的全局变量)
process,Buffer,__dirname,__filename) - 更美观的兼容性-禁用格式化规则
链接
- 碱性单氧- https://github.com/DuganLabs/basenative
- 问题- - - - - - https://github.com/DuganLabs/basenative/issues
- 文档- https://github.com/DuganLabs/basenative#readme
许可证
apache - 2.0