eslint-plugin-wyrm
v0.0.13
Published
100+ ESLint rules for modern TS projects
Maintainers
Readme
🐲 eslint-plugin-wyrm
Installation
npm install --save-dev eslint eslint-plugin-wyrmUsage
import { defineConfig } from 'eslint/config';
import wyrm from 'eslint-plugin-wyrm';
export default defineConfig([
// ...
wyrm.configs.recommended,
]);Configs
| | Name |
| :-- | :----------------------- |
| 🟩 | recommended |
| ✅ | recommendedTypeChecked |
| 🟪 | strict |
| ☑️ | strictTypeChecked |
Rules
💼 Configurations enabled in.
🟩 Set in the recommended configuration.
✅ Set in the recommendedTypeChecked configuration.
🟪 Set in the strict configuration.
☑️ Set in the strictTypeChecked configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.
💭 Requires type information.
| Name | Description | 💼 | 🔧 | 💡 | 💭 |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- | :---------- | :-- | :-- | :-- |
| array-from-array | Forbid calling Array.from on arrays | ☑️ | 🔧 | | 💭 |
| as-unknown-as | Forbid as unknown as | 🟪 ☑️ | | | |
| await-promise-resolve | Forbid await Promise.resolve() | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| boolean-coalescing | Prefer distributing boolean casts over nullish coalescing expressions | ☑️ | 🔧 | | 💭 |
| comment-duplicate-leading-space | Forbid duplicate leading space in comments | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| conditional-boolean | Forbid if/else branches where the only difference is a boolean literal | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| constant-boolean-cast | Forbid boolean casts on values with constant truthiness | ✅ ☑️ | | 💡 | 💭 |
| de-morgan | Enforce using De Morgan's law to simplify negated logical expressions | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| discarded-expression-statement | Forbid discarding the result of expression statements | | | | 💭 |
| distribute-boolean-casts | Enforce that boolean casts are distributed over logical expressions | 🟪 ☑️ | 🔧 | | |
| duplicate-destructuring | Forbid duplicate keys in object destructuring patterns | 🟩 ✅ 🟪 ☑️ | | | |
| duplicate-object-spread | Forbid duplicate spread elements in object literals | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| e | Forbid using e as a parameter name | 🟪 ☑️ | | 💡 | |
| empty-for | Forbid using for (;;) | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| enum-member | Prefer enum members to literals asserted as enum | ✅ ☑️ | 🔧 | | 💭 |
| eqeq-null | Forbid using x == null when equivalent to x === null | ☑️ | 🔧 | | 💭 |
| exact-string-regex | Forbid using a RegEx when string equality would suffice | 🟩 ✅ 🟪 ☑️ | | 💡 | |
| export-using | Forbid exporting variables declared with using or await using | 🟩 ✅ 🟪 ☑️ | | | |
| generic-constructor-with-hook | Forbid specifying the type arguments on the hook instead of on the generic class | 🟪 ☑️ | 🔧 | | |
| idiomatic-cast | Enforce idiomatic ways to cast values | ☑️ | 🔧 | | 💭 |
| inferable-type-predicate | Forbid inferable type predicates | ☑️ | 🔧 | | 💭 |
| inner-as-const | Enforce setting as const on the outermost object/array literal only | 🟪 ☑️ | 🔧 | | |
| jsx-tostring | Forbid calling .toString() inside JSX expressions containers | ☑️ | 🔧 | | 💭 |
| literal-destructuring | Forbid variable declaration by destructuring object or array literals | 🟪 ☑️ | 🔧 | | |
| named-export-with-side-effects | Forbid named exports in files with side effects | 🟩 ✅ 🟪 ☑️ | | | |
| nested-reduce | Forbid nested reduce calls | 🟪 ☑️ | | | |
| nested-try-catch | Forbid nested try/catch statements | 🟪 ☑️ | | | |
| no-commented-out-comment | Forbid commented out comments | 🟩 ✅ 🟪 ☑️ | | | |
| no-constant-template-expression | Disallow constant string expressions in template literals | ☑️ | | 💡 | 💭 |
| no-constructed-error-cause | Forbid using Error.cause with constructed objects | 🟪 ☑️ | | | |
| no-convoluted-boolean-expressions | Forbid simplifiable logical expressions with boolean types | ✅ ☑️ | 🔧 | | 💭 |
| no-convoluted-logical-expressions | Forbid simplifiable logical expressions | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| no-custom-url-parsing | Forbid parsing or building URLs by hand | 🟪 ☑️ | | | |
| no-disallowed-warning-comments | Forbid disallowed comments like FIXME, XXX, HACK | 🟪 ☑️ | | | |
| no-duplicated-return | Forbid duplicated branches with early returns | 🟩 ✅ 🟪 ☑️ | | | |
| no-else-break | Forbid unnecessary else block after a break statement | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| no-else-continue | Forbid unnecessary else block after a continue statement | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| no-else-never | Forbid unnecessary else block after an expression that never returns | ☑️ | 🔧 | | 💭 |
| no-else-return | Forbid unnecessary else block after a return statement | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| no-else-throw | Forbid unnecessary else block after a throw statement | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| no-empty-attribute | Forbid some empty JSX attributes | 🟪 ☑️ | | | |
| no-empty-comment | Forbid empty comments | 🟪 ☑️ | | | |
| no-empty-jsx-expression | Forbid empty JSX expression containers | 🟩 ✅ 🟪 ☑️ | | | |
| no-empty-literal-iteration | Forbid iterating over empty literals | 🟩 ✅ 🟪 ☑️ | | | |
| no-extra-false-fallback | Forbid extra ?? false in conditions and predicates | 🟪 ☑️ | | 💡 | |
| no-extra-nested-boolean-cast | Forbid extra boolean casts in conditions and predicates | 🟪 ☑️ | | | |
| no-first-last | Forbid confusing naming for "first" or "last" | 🟩 ✅ 🟪 ☑️ | | | |
| no-float-length-check | Forbid comparing a length to a floating point number | 🟩 ✅ 🟪 ☑️ | | | |
| no-huge-try-block | Forbid huge try/catch blocks | 🟪 ☑️ | | | |
| no-huge-useeffect | Forbid huge useEffect functions | 🟪 ☑️ | | | |
| no-if-length-for | Forbid redundant condition for positive length before a loop | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| no-inline-jsdoc-tag | Forbid JSDoc tags in code comments | 🟪 ☑️ | | | |
| no-invalid-date-literal | Disallow invalid date literals | 🟩 ✅ 🟪 ☑️ | | | |
| no-jsx-statement | Forbid JSX expression statements | 🟩 ✅ 🟪 ☑️ | | | |
| no-lax-array-type | Forbid declaring array types that are wider than the types of the actual elements | ☑️ | | 💡 | 💭 |
| no-lax-return-type | Forbid declaring function return types that are wider than the types of the actual return values | ☑️ | | 💡 | 💭 |
| no-mutable-literal-fill | Forbid using mutable literals to fill arrays | 🟩 ✅ 🟪 ☑️ | | | |
| no-nullish-ternary | Forbid ternary conditions that can be replaced by optional chains | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| no-numbered-comments | Forbid numbered comments | | | | |
| no-obvious-any | Forbid using any when a stricter type can be trivially inferred | ☑️ | 🔧 | | 💭 |
| no-optional-type-guard-param | Forbid optional parameters in type guards | 🟩 ✅ 🟪 ☑️ | | | |
| no-out-of-order-comments | Forbid out of order numbered comments | 🟩 ✅ 🟪 ☑️ | | | |
| no-possibly-nullish-equality | Forbid checking the equality of possibly nullish values | ☑️ | | | 💭 |
| no-redundant-function-declaration | Forbid redundant function declarations | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| no-return-to-void | Forbid returning values in void-returning callbacks | ☑️ | | | 💭 |
| no-self-object-assign | Forbid using Object.assign() with the same object as both target and source | 🟩 ✅ 🟪 ☑️ | | | |
| no-sloppy-length-check | Forbid sloppy collection size checks | 🟩 ✅ 🟪 ☑️ | | | |
| no-suspicious-jsx-semicolon | Forbid suspicious semicolons in JSX | 🟩 ✅ 🟪 ☑️ | | | |
| no-ternary-return | Disallow ternary conditions in return statements | 🟪 ☑️ | 🔧 | | |
| no-type-guard | Forbid type guards | | | | |
| no-unassigned-todo | Forbid unassigned TODO comments | 🟪 ☑️ | | | |
| no-unbound-catch-error | Forbid catch clauses with unbound errors | 🟪 ☑️ | | | |
| no-unused-mutually-referential | Forbid unused functions, even if mutually referential | 🟪 ☑️ | | | |
| no-unused-param-read | Forbid referencing parameters marked as unused with a leading underscore | 🟪 ☑️ | | | |
| no-useless-computed-key | Forbid useless computed keys | 🟪 ☑️ | 🔧 | | |
| no-useless-iife | Forbid useless IIFEs | 🟩 ✅ 🟪 ☑️ | | 💡 | |
| no-useless-logical-fallback | Forbid useless fallback values for logical expressions | ✅ ☑️ | | 💡 | 💭 |
| no-useless-return-undefined | Forbid returning undefined in void-returning callbacks | ☑️ | | | 💭 |
| no-useless-ts-check | Forbid useless @ts-check comments in TypeScript files | 🟩 ✅ 🟪 ☑️ | | | |
| no-useless-use-strict | Forbid useless "use strict" directives. | 🟪 ☑️ | | | |
| no-useless-usememo | Forbid useless useMemo() | 🟪 ☑️ | | | |
| no-whitespace-property | Forbid leading or trailing whitespace in object keys | 🟪 ☑️ | | | |
| nullish-object-spread | Forbid useless fallback for nullish values in object spread | 🟪 ☑️ | | | |
| optional-call-expression | Enforce using optional call expression syntax | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| prefer-array-from | Enforce using Array.from or Array.fromAsync over iterative accumulation | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| prefer-catch-method | Enforce usage of Promise.prototype.catch() when it improves readability | 🟩 ✅ 🟪 ☑️ | | 💡 | |
| prefer-early-return | Require early returns when possible | 🟪 ☑️ | 🔧 | | |
| prefer-eqeq-null | Enforce using x == null instead of x === null \|\| x === undefined | 🟪 ☑️ | 🔧 | | |
| prefer-finally | Enforce using finally rather than duplicating code in try and catch blocks | 🟪 ☑️ | | 💡 | |
| prefer-getorinsert | Enforce using Map#getOrInsert | 🟪 ☑️ | | 💡 | |
| prefer-has | Enforce using Map#has and Set#has | 🟪 ☑️ | 🔧 | | |
| prefer-in | Prefer in to Object.hasOwn() and Object.prototype.hasOwnProperty.call() | 🟪 ☑️ | | 💡 | |
| prefer-object-keys-values | Enforce using Object.keys() and Object.values() rather than Object.entries() | 🟪 ☑️ | | 💡 | |
| prefer-repeat | Enforce usage of String.prototype.repeat | 🟩 ✅ 🟪 ☑️ | | 💡 | |
| prefer-satisfies | Prefer satisfies to type assertions | ☑️ | | 💡 | 💭 |
| prefer-string-join | Enforce usage of String.prototype.join | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| primitive-valueof | Forbid calling .valueOf() on a primitive | ✅ ☑️ | 🔧 | | 💭 |
| slim-try | Enforce moving safe statements out of try blocks | 🟪 ☑️ | 🔧 | | |
| styled-button-has-type | Disallow usage of styled.button without an explicit type attribute. | 🟩 ✅ 🟪 ☑️ | | | |
| styled-transient-props | Enforce using transient props in styled components to avoid polluting DOM elements with unknown props | 🟩 ✅ 🟪 ☑️ | | | |
| suspicious-map-length | Disallow suspicious use of .map().length | 🟩 ✅ 🟪 ☑️ | | 💡 | |
| template-tostring | Forbid calling .toString() inside template expressions | 🟪 ☑️ | 🔧 | | |
| unsafe-asserted-chain | Disallow unsafe type assertions on optional chained expressions | ☑️ | | | 💭 |
| unused-object-assign | Disallow unused Object.assign() expressions | 🟩 ✅ 🟪 ☑️ | | | |
| unused-object-freeze | Disallow unused Object.freeze() expressions | 🟩 ✅ 🟪 ☑️ | | | |
| useless-as-const | Forbid useless as const assertions | 🟪 ☑️ | | 💡 | |
| useless-assign | Enforce directly returning a value instead of assigning it first to a variable | 🟪 ☑️ | 🔧 | | |
| useless-conditional-assign | Enforce directly returning a value instead of conditionally assigning it first to a variable | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
| useless-intermediary-variable | Disallow unnecessary intermediary variables | 🟪 ☑️ | | 💡 | |
| useless-mock | Forbid useless mocks in tests | 🟪 ☑️ | | | |
| useless-required | Forbid unnecessary use of Required<T> and Partial<T> | ☑️ | | 💡 | 💭 |
