@spec-lint/eslint-plugin
v2.0.4
Published
前端编码规范自定义 ESLint 插件
Maintainers
Readme
@lint-spec/eslint-plugin
前端编码规范自定义 ESLint 插件
安装
npm install @lint-spec/eslint-plugin eslint --save-dev使用
ESLint 9 flat config 格式:
// eslint.config.js
import lintSpecPlugin from '@lint-spec/eslint-plugin';
export default [
{
plugins: {
'@lint-spec': lintSpecPlugin,
},
rules: {
'@lint-spec/no-secret-info': 'error',
'@lint-spec/no-http-url': 'warn',
},
},
];使用 recommended 预设
// eslint.config.js
import lintSpecPlugin from '@lint-spec/eslint-plugin';
export default [
lintSpecPlugin.configs.recommended,
];支持的规则
no-broad-semantic-versioning- 不要指定宽泛的版本范围no-http-url- 使用 HTTPS 协议头的 URL,而不是 HTTPno-js-in-ts-project- 不要在 TS 项目中使用 JSno-secret-info- 不要在代码中直接设置passwordtokenandsecret信息no-timer-magic-numbers- 不要在 setTimeout/setInterval 中使用魔法数字
