0.0.8 • Published 3 years ago
eslint-plugin-mt-code-check v0.0.8
eslint-plugin-mt-code-check
ESLint 编码规范扩展
安装
请先安装 ESLint:
npm i eslint --save-dev接下来安装插件 eslint-plugin-mt-code-check:
npm install eslint-plugin-mt-code-check --save-dev
# 或
yarn add eslint-plugin-mt-code-check --save-dev
# 或
pnpm install eslint-plugin-mt-code-check --save-dev使用
将 mt-code-check 添加到您的 .eslintrc 文件的 plugins 区域。注意,请忽略前缀 eslint-plugin-:
{
"plugins": [
"mt-code-check"
]
}接下来在 rules 中配置你想启用的规则:
{
"rules": {
"mt-code-check/sort-variable": 2, // 规则:相邻的变量声明,let 必须放在 const 后面
}
}支持的规则
"mt-code-check/settimeout-no-number:setTimeout 的第二个参数禁止是数字"mt-code-check/sort-variable":相邻(前后两行、同一行)的变量声明,let 必须放在 const 后面"mt-code-check/no-iife":禁止使用立即执行函数"mt-code-check/no-expression-assignment":禁止使用 arrarr.length = 1 这种方式追加数组元素,应该使用 arr.push()