mchevestrier/eslint-plugin-wyrm

GitHub: mchevestrier/eslint-plugin-wyrm

一款为现代 TypeScript 项目提供 50+ 条精细化 ESLint 规则的插件,提升代码质量与类型安全。

Stars: 1 | Forks: 0

# 🐲 eslint-plugin-wyrm [![npm version](https://img.shields.io/npm/v/eslint-plugin-wyrm.svg?color=7f52af&labelColor=26272b)](https://www.npmjs.com/package/eslint-plugin-wyrm) [![GitHub release](https://img.shields.io/github/v/release/mchevestrier/eslint-plugin-wyrm?color=7f52af&labelColor=26272b)](https://github.com/mchevestrier/eslint-plugin-wyrm/releases/latest) [![GitHub License](https://img.shields.io/badge/license-MIT-232428.svg?color=7f52af&labelColor=26272b)](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/LICENSE.md) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&labelColor=26272b&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fmchevestrier%2Feslint-plugin-wyrm%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/mchevestrier/eslint-plugin-wyrm/master) ## 安装 ``` npm install --save-dev eslint eslint-plugin-wyrm ``` ## 用法 ``` import { defineConfig } from 'eslint/config'; import wyrm from 'eslint-plugin-wyrm'; export default defineConfig([ // ... wyrm.configs.recommended, ]); ``` ## 配置 | | 名称 | | :-- | :----------------------- | | 🟩 | `recommended` | | ✅ | `recommendedTypeChecked` | | 🟪 | `strict` | | ☑️ | `strictTypeChecked` | ## 规则 💼 配置中启用的规则。\ 🟩 在 `recommended` 配置中设置。\ ✅ 在 `recommendedTypeChecked` 配置中设置。\ 🟪 在 `strict` 配置中设置。\ ☑️ 在 `strictTypeChecked` 配置中设置。\ 🔧 可通过 [`--fix` CLI 选项](https://eslint.org/docs/user-guide/command-line-interface#--fix) 自动修复。\ 💡 可通过 [编辑器建议](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions) 手动修复。\ 💭 需要 [类型信息](https://typescript-eslint.io/linting/typed-linting)。 | 名称 | 描述 | 💼 | 🔧 | 💡 | 💭 | | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------- | :---------- | :-- | :-- | :-- | | [array-from-array](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/array-from-array.md) | 禁止对数组调用 `Array.from` | ☑️ | 🔧 | | 💭 | | [await-promise-resolve](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/await-promise-resolve.md) | 禁止 `await Promise.resolve()` | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [constant-boolean-cast](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/constant-boolean-cast.md) | 禁止对值为常量的表达式进行布尔类型转换 | ✅ ☑️ | | 💡 | 💭 | | [de-morgan](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/de-morgan.md) | 强制使用德摩根定律简化否定逻辑表达式 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [discarded-expression-statement](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/discarded-expression-statement.md) | 禁止丢弃表达式语句的结果 | | | | 💭 | | [distribute-boolean-casts](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/distribute-boolean-casts.md) | 强制将布尔类型转换分配到逻辑表达式中 | 🟪 ☑️ | 🔧 | | | | [duplicate-destructuring](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/duplicate-destructuring.md) | 禁止在对象解构模式中使用重复的键 | 🟩 ✅ 🟪 ☑️ | | | | | [duplicate-object-spread](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/duplicate-object-spread.md) | 禁止在对象字面量中使用重复的展开元素 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [e](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/e.md) | 禁止将 `e` 作为参数名 | 🟪 ☑️ | | 💡 | | | [empty-for](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/empty-for.md) | 禁止使用 `for (;;)` | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [eqeq-null](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/eqeq-null.md) | 禁止使用 `x == null`(当等价于 `x === null` 时) | ☑️ | 🔧 | | 💭 | | [exact-string-regex](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/exact-string-regex.md) | 禁止在可以使用字符串相等时使用正则表达式 | 🟩 ✅ 🟪 ☑️ | | 💡 | | | [export-using](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/export-using.md) | 禁止导出使用 `using` 或 `await using` 声明的变量 | 🟩 ✅ 🟪 ☑️ | | | | | [generic-constructor-with-hook](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/generic-constructor-with-hook.md) | 禁止在泛型类上指定类型参数,而是应在钩子上指定 | 🟪 ☑️ | 🔧 | | | | [idiomatic-cast](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/idiomatic-cast.md) | 强制使用类型转换的惯用方式 | ☑️ | 🔧 | | 💭 | | [inner-as-const](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/inner-as-const.md) | 强制仅在外部对象/数组字面量上使用 `as const` | 🟪 ☑️ | 🔧 | | | | [jsx-tostring](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/jsx-tostring.md) | 禁止在 JSX 表达式容器内调用 `.toString()` | ☑️ | 🔧 | | 💭 | | [literal-destructuring](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/literal-destructuring.md) | 禁止通过解构对象或数组字面量来声明变量 | 🟪 ☑️ | 🔧 | | | | [named-export-with-side-effects](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/named-export-with-side-effects.md) | 禁止在有副作用的文件中导出命名导出 | 🟩 ✅ 🟪 ☑️ | | | | | [no-commented-out-comment](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-commented-out-comment.md) | 禁止注释掉的注释 | 🟩 ✅ 🟪 ☑️ | | | | | [no-constant-template-expression](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-constant-template-expression.md) | 禁止在模板字面量中使用常量字符串表达式 | ☑️ | | 💡 | 💭 | | [no-constructed-error-cause](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-constructed-error-cause.md) | 禁止使用 `Error.cause` 构造的对象 | 🟪 ☑️ | | | | | [no-convoluted-boolean-expressions](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-convoluted-boolean-expressions.md) | 禁止可简化的布尔类型逻辑表达式 | ✅ ☑️ | 🔧 | | 💭 | | [no-convoluted-logical-expressions](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-convoluted-logical-expressions.md) | 禁止可简化的逻辑表达式 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [no-custom-url-parsing](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-custom-url-parsing.md) | 禁止手动解析或构建 URL | 🟪 ☑️ | | | | | [no-disallowed-warning-comments](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-disallowed-warning-comments.md) | 禁止使用不允许的注释(如 FIXME、XXX、HACK) | 🟪 ☑️ | | | | | [no-duplicated-return](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-duplicated-return.md) | 禁止包含早期返回的重复分支 | 🟩 ✅ 🟪 ☑️ | | | | | [no-else-break](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-else-break.md) | 禁止在 `break` 语句后使用不必要的 `else` 块 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [no-else-continue](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-else-continue.md) | 禁止在 `continue` 语句后使用不必要的 `else` 块 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [no-else-never](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-else-never.md) | 禁止在永不返回的表达式后使用不必要的 `else` 块 | ☑️ | 🔧 | | 💭 | | [no-elsereturn](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-else-return.md) | 禁止在 `return` 语句后使用不必要的 `else` 块 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [no-else-throw](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-else-throw.md) | 禁止在 `throw` 语句后使用不必要的 `else` 块 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [no-empty-attribute](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-empty-attribute.md) | 禁止某些空的 JSX 属性 | 🟪 ☑️ | | | | | [no-empty-comment](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-empty-comment.md) | 禁止空注释 | 🟪 ☑️ | | | | | [no-empty-jsx-expression](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-empty-jsx-expression.md) | 禁止空的 JSX 表达式容器 | 🟩 ✅ 🟪 ☑️ | | | | | [no-empty-literal-iteration](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-empty-literal-iteration.md) | 禁止迭代空字面量 | 🟩 ✅ 🟪 ☑️ | | | | | [no-extra-false-fallback](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-extra-false-fallback.md) | 禁止在条件和谓词中使用多余的 `?? false` | 🟪 ☑️ | | 💡 | | | [no-extra-nested-boolean-cast](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-extra-nested-boolean-cast.md) | 禁止在条件和谓词中使用多余的布尔类型转换 | 🟪 ☑️ | | | | | [no-first-last](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-first-last.md) | 禁止使用令人困惑的 "first" 或 "last" 命名 | 🟩 ✅ 🟪 ☑️ | | | | | [no-float-length-check](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-float-length-check.md) | 禁止将长度与浮点数进行比较 | 🟩 ✅ 🟪 ☑️ | | | | | [no-huge-try-block](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-huge-try-block.md) | 禁止庞大的 try/catch 块 | 🟪 ☑️ | | | | | [no-huge-useeffect](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-huge-useeffect.md) | 禁止庞大的 `useEffect` 函数 | 🟪 ☑️ | | | | | [no-if-length-for](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-if-length-for.md) | 禁止在正长度循环前使用冗余的条件检查 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [no-inline-jsdoc-tag](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-inline-jsdoc-tag.md) | 禁止代码注释中的 JSDoc 标签 | 🟪 ☑️ | | | | | [no-invalid-date-literal](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-invalid-date-literal.md) | 禁止无效的日期字面量 | 🟩 ✅ 🟪 ☑️ | | | | | [no-jsx-statement](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-jsx-statement.md) | 禁止 JSX 表达式语句 | 🟩 ✅ 🟪 ☑️ | | | | | [no-lax-array-type](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-lax-array-type.md) | 禁止声明比实际元素类型更宽泛的数组类型 | ☑️ | | 💡 | 💭 | | [no-lax-return-type](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-lax-return-type.md) | 禁止声明比实际返回值类型更宽泛的函数返回类型 | ☑️ | | 💡 | 💭 | | [no-mutable-literal-fill](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-mutable-literal-fill.md) | 禁止使用可变字面量填充数组 | 🟩 ✅ 🟪 ☑️ | | | | | [no-nullish-ternary](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-nullish-ternary.md) | 禁止可以用可选链替代的三元条件 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [no-numbered-comments](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-numbered-comments.md) | 禁止编号注释 | | | | | | [no-obvious-any](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-obvious-any.md) | 禁止在可以轻松推断出更严格类型时使用 `any` | ☑️ | 🔧 | | 💭 | | [no-optional-type-guard-param](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-optional-type-guard-param.md) | 禁止类型保护中的可选参数 | 🟩 ✅ 🟪 ☑️ | | | | | [no-out-of-order-comments](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-out-of-order-comments.md) | 禁止无序编号注释 | 🟩 ✅ 🟪 ☑️ | | | | | [no-possibly-nullish-equality](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-possibly-nullish-equality.md) | 禁止检查可能为 null 或 undefined 的值的相等性 | ☑️ | | | 💭 | | [no-redundant-function-declaration](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-redundant-function-declaration.md) | 禁止冗余函数声明 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [no-return-to-void](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-return-to-void.md) | 禁止在返回 void 的回调中返回值 | ☑️ | | | 💭 | | [no-self-object-assign](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-self-object-assign.md) | 禁止使用 `Object.assign()` 时将同一对象同时作为目标和源 | 🟩 ✅ 🟪 ☑️ | | | | | [no-sloppy-length-check](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-sloppy-length-check.md) | 禁止松散的集合大小检查 | 🟩 ✅ 🟪 ☑️ | | | | | [no-suspicious-jsx-semicolon](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-suspicious-jsx-semicolon.md) | 禁止 JSX 中可疑的分号 | 🟩 ✅ 🟪 ☑️ | | | | | [no-ternary-return](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-ternary-return.md) | 禁止在返回语句中使用三元条件 | 🟪 ☑️ | 🔧 | | | | [no-unassigned-todo](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-unassigned-todo.md) | 禁止未分配的 TODO 注释 | 🟪 ☑️ | | | | | [no-unbound-catch-error](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-unbound-catch-error.md) | 禁止未绑定错误的 `catch` 子句 | 🟪 ☑️ | | | | | [no-unused-mutually-referential](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-unused-mutually-referential.md) | 禁止未使用的函数,即使它们是相互递归的 | 🟪 ☑️ | | | | | [no-unused-param-read](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-unused-param-read.md) | 禁止引用以 `_` 开头标记为未使用的参数 | 🟪 ☑️ | | | | | [no-useless-computed-key](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-computed-key.md) | 禁止无用的计算键 | 🟪 ☑️ | 🔧 | | | | [no-useless-iife](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-iife.md) | 禁止无用的 IIFE | 🟩 ✅ 🟪 ☑️ | | 💡 | | | [no-useless-logical-fallback](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-logical-fallback.md) | 禁止无用的逻辑表达式回退值 | ✅ ☑️ | | 💡 | 💭 | | [no-useless-return-undefined](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-return-undefined.md) | 禁止在返回 void 的回调中返回 `undefined` | ☑️ | | | 💭 | | [no-useless-ts-check](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-ts-check.md) | 禁止 TypeScript 文件中无用的 `@ts-check` 注释 | 🟩 ✅ 🟪 ☑️ | | | | |no-useless-use-strict](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-use-strict.md) | 禁止无用的 "use strict" 指令 | 🟪 ☑️ | | | | | [no-useless-usememo](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-usememo.md) | 禁止无用的 `useMemo()` | 🟪 ☑️ | | | | | [no-whitespace-property](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-whitespace-property.md) | 禁止对象键的前导或尾随空格 | 🟪 ☑️ | | | | | [nullish-object-spread](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/nullish-object-spread.md) | 禁止在对象展开中对 nullish 值使用无用的回退值 | 🟪 ☑️ | | | | | [optional-call-expression](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/optional-call-expression.md) | 强制使用可选调用表达式语法 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [prefer-array-from](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-array-from.md) | 强制使用 `Array.from` 或 `Array.fromAsync` 而非迭代累积 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [prefer-catch-method](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-catch-method.md) | 强制在提高可读性时使用 `Promise.prototype.catch()` | 🟩 ✅ 🟪 ☑️ | | 💡 | | | [prefer-early-return](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-early-return.md) | 要求在可能的情况下使用早期返回 | 🟪 ☑️ | 🔧 | | | | [prefer-eqeq-null](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-eqeq-null.md) | 强制使用 `x == null` 而非 `x === null || x === undefined` | 🟪 ☑️ | 🔧 | | | | [prefer-finally](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-finally.md) | 强制在 `try` 和 `catch` 块中使用 `finally` 而非代码重复 | 🟪 ☑️ | | 💡 | | | [prefer-getorinsert](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-getorinsert.md) | 强制使用 `Map#getOrInsert` | 🟪 ☑️ | | 💡 | | | [prefer-has](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-has.md) | 强制使用 `Map#has` 和 `Set#has` | 🟪 ☑️ | 🔧 | | | | [prefer-object-keys-values](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-object-keys-values.md) | 强制使用 `Object.keys()` 和 `Object.values()` 而非 `Object.entries()` | 🟪 ☑️ | | 💡 | | | [prefer-repeat](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-repeat.md) | 强制使用 `String.prototype.repeat` | 🟩 ✅ 🟪 ☑️ | | 💡 | | | [prefer-string-join](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-string-join.md) | 强制使用 `String.prototype.join` | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [primitive-valueof](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/primitive-valueof.md) | 禁止对原始类型调用 `.valueOf()` | ✅ ☑️ | 🔧 | | 💭 | | [slim-try](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/slim-try.md) | 强制将安全语句移出 `try` 块 | 🟪 ☑️ | 🔧 | | | | [styled-button-has-type](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/styled-button-has-type.md) | 禁止在未显式指定 `type` 属性的情况下使用 `styled.button` | 🟩 ✅ 🟪 ☑️ | | | | | [styled-transient-props](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/styled-transient-props.md) | 强制在 styled 组件中使用瞬态属性,以避免污染 DOM 元素中的未知属性 | 🟩 ✅ 🟪 ☑️ | | | | | [suspicious-map-length](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/suspicious-map-length.md) | 禁止可疑的 `.map().length` 用法 | 🟩 ✅ 🟪 ☑️ | | 💡 | | | [template-tostring](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/template-tostring.md) | 禁止在模板表达式中调用 `.toString()` | 🟪 ☑️ | 🔧 | | | | [unsafe-asserted-chain](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/unsafe-asserted-chain.md) | 禁止在可选链表达式上进行不安全类型断言 | ☑️ | | | 💭 | | [unused-object-assign](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/unused-object-assign.md) | 禁止未使用的 `Object.assign()` 表达式 | 🟩 ✅ 🟪 ☑️ | | | | | [useless-as-const](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/useless-as-const.md) | 禁止无用的 `as const` 断言 | 🟪 ☑️ | | 💡 | | | [useless-assign](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/useless-assign.md) | 强制直接返回值,而不是先赋值给变量 | 🟪 ☑️ | 🔧 | | | | [useless-conditional-assign](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/useless-conditional-assign.md) | 强制直接返回值,而不是条件赋值 | 🟩 ✅ 🟪 ☑️ | 🔧 | | | | [useless-intermediary-variable](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/useless-intermediary-variable.md) | 禁止不必要的中间变量 | 🟪 ☑️ | | 💡 | | | [useless-mock](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/useless-mock.md) | 禁止在测试中使用无用的 mock | 🟪 ☑️ | | | | | [useless-required](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/useless-required.md) | 禁止不必要的 `Required` 和 `Partial` 使用 | ☑️ | | 💡 | 💭 |
标签:CMS安全, ESLint, eslint-plugin, JavaScript, lint, Mutation testing, npm, SEO, Stryker, TypeScript, 严格模式, 云安全监控, 代码规范, 前端, 安全插件, 推荐配置, 插件, 数据可视化, 模块化设计, 现代前端, 类型检查, 编辑器建议, 自动化修复, 自动化攻击, 规则, 静态分析