sindresorhus/
Various awesome ESLint rules
USD raised
Recent activities
`no-negated-comparison`: `NaN` cases
`no-unsafe-property-key`: false positive with type-guarded string values
`prefer-string-starts-ends-with`: detect comparisons to slices
`prefer-string-starts-ends-with`: detect comparisons with slices
Rule proposal: new `prefer-string-trim-start-end`
`unicorn/no-unnecessary-array-flat-map` changes type
`isolated-functions`: Should allow globals configured with `/* global */` comments
`prefer-boolean-return`: Consider exempting for a series of ≥ 2 `if`s with early return
Rule proposal: enahance ESLint's `no-else-return` to catch `break`, `continue`, `throw` and `process.exit()`
`prefer-number-coercion` should not fix length strings
Rule proposal: disable unnecessary `Array#flatMap()`
`prefer-code-point` should not suggest a change if the number is used for a sum
`no-incorrect-template-string-interpolation` does not detect JSDoc
unicorn/no-useless-concat should skip template string concats
`name-replacements` - prefer abbreviation‽ The variable `repository` should be named `repo`
`consistent-boolean-name`: TypeError: parameters is not iterable
`no-top-level-side-effects` should allow files whose only exports are `export type`
Rule proposal: arrow-return-style
`unicorn/comment-content` caused multiline comment out code to mutate
`custom-error-definition` false positive on constant (no-substitution) template literal for name
`prefer-type-literal-last`: exclude from `unopinionated`, relax some checks
`logical-assignment-operators`: should autofix `??=`
`no-useless-fallback-in-spread`: Option to skip checking ternaries
`no-unsafe-property-key` cannot handle `unique symbol` correctly
unicorn/no-empty-file don't working more .gitignore and .editorconfig
`prevent-abbreviations`: support CSS
False positive in the `prefer-array-some` rule
`better-dom-traversing` should only effects for native API, ignores library API such as React
`no-unused-array-method-return` false positive for type assertion
Rule proposal: `prefer-iterator-concat`
`rule-name`: `no-new-array` add suggestion tests
Unable to open PR due to repository pull request restriction
Rule proposal: `simple-condition-first`
Rule proposal: disallow method names that match their class names
Error when handling the size property of ordinary objects with the `explicit-length-check` rule
`unicorn/prevent-abbreviations` incorrectly handles imports after an auto-fix
Rule proposal: `no-useless-iterator-to-array`
The rule disabling does not work for `<script is:inline>` in Astro files.
`unicorn/prefer-spread`: ArrayBuffer.prototype.slice incorrectly linted
Restructure directories
Rule proposal: forbid declarations that are not used before an early return
Rule proposal: Enforce `.toArray()` at the end of `Iterator` methods
`no-useless-undefined`: should work when a function has a return type specified
expiring-todo-comments: should not flag "eslint disable" comments
no-array-sort should not insist cloning (using .toSorted()) a cloned array
`prefer-bigint-literal`: Support number with `+`/`-` sign
`no-array-reduce` - doesn't report optional chaining
Rule proposal: `prefer-bigint-literal`
`prefer-dom-node-dataset`: Use `[]` accessor, rather than object (works better with TypeScript)
`rule-name`: prefer-at
`explicit-length-check`: add autofix for .length <= 0 to .length === 0
Rule proposal: `no-array-fill-with-reference-type`
`prefer-string-raw`: Support template literals
Rule proposal: `logical-assignment-operators` replacement
Remove `empty-brace-spaces` from recommended
`rule-name`: `no-array-callback-reference` option to allow functions defined in module
`rule-name`: no-useless-spread disallows using spread to copy an array
`error-message`: support custom error packages
Rule proposal: prefer `url.fileURLToPath` over `URL#pathname` for Node
`rule-name`: `prefer-number-is-safe-integer`
`rule-name`: explicit-length-check and safe navigation operator
`prefer-ternary`: interaction with no-else-return
`unicorn/prefer-type-error`: ignore error type check
`prefer-global-this`: Autofix for `typeof window` prevents common bundler optimizations
Rule proposal:
Rule proposal: `no-arguments`
Rule proposal: `no-useless-object-entries-lookup`
`prefer-global-this`: support for EyeDropper
Rule proposal: `prefer-object-has-own`
Rule proposal: Prefer Array.from() callback for list comprehensions
Rule proposal: name-dialect
Rule proposal: `prefer-logical-assignment`
Rule proposal: `no-dangling-else` - Disallow dangling else ambiuguity
Rule proposal: `class-method-style`
Use `meta.defaultOptions` for rules with options
`prefer-global-this` should also exclude `'open' in window`
`no-new-array` confusing error message leading to `new-for-builtins`
Rule proposal: switch-case-limits
Rule proposal: `consistent-date-clone`
Rule proposal: require node:assert/strict
Rule proposal: Prefer array last methods over reverse
Rule proposal: `prefer-consecutive-conditions`
Rule proposal: Named object destructuring
Rule proposal: prefer-npm-protocol
Rule proposal: `no-untyped-empty-array` in ts file
`prefer-modern-math-apis` change request
Rule proposal: `consistent-conditional-object-spread`
Rule proposal: no-mixed-html
Rule proposal: `no-unnecessary-splice`
Rule proposal: prefer `getHTML`/`setHTML` to `.innerHTML`
`prefer-string-slice` bad autofix from `.substr()`
Rule proposal: prefer `obj.entries()` to create `URLSearchParams`
Rule proposal: `no-single-promise-in-promise-all`
Rule proposal: `prefer-array-find-last`
Rule proposal: `no-non-exists-builtin-properties`
Docs request: explain why explicit-length-check is useful
Rule proposal: Forbid `btoa` and `atob`
`prefer-at` should also mark substrings of length 1
Rule proposal: prefer-named-exports-from-is
Rule proposal: `no-instanceof-function`
Rule proposal: `consistent-empty-spread`
Rule proposal: The file name cannot be index
`prevent-abbreviations` should ignore config files
`prefer-string-replace-all`: Allow more flags to be fixed to string
Enforce `.replaceAll()` over `.replace()` when the pattern has `g` flag
Rule proposal: `no-template-in-string`
Rule proposal: prefer-array-some should also check for misuse of Array.findIndex()
`prefer-array-some` should also check for misuse of `Array.findIndex()`
`unicorn/better-regex` conflicts with `regexp/strict` and `regexp/match-any`
More powerful `new-for-builtins`
`no-array-for-each` should skip fix if second parameter is not an `Identifier`
Rule proposal: prefer TypedArray's over `node:buffer`
Rule proposal: Prefer assert() or assert.ok()
Rule proposal: prefer-operator-assignement
Rule proposal: Number(str) over parseFloat(str)
Rule proposal: `no-optional-call`
`throw-new-error` is already covered by `new-for-builtins`
Rule proposal: Prepend type variables in unions: `A | {B: string}` instead of `{B: string} | A`
fix prefer-ternary removes comments
better-regex rule breaks regex
Include reason to use rule in documentation
`relative-url-style` turns `'./'` into `''`, which breaks things
plugin:unicorn/recommended: Environment key "es2022" is unknown
Rule proposal: `prefer-short-arrow-method`
Rule proposal: `no-unreadable-iife`
`unicorn/prefer-export-from` breaks type exports in typescript projects using the `isolatedModules` flag.
Rule proposal: Prefer explicit array check over `Array#flat()`.
Rule proposal: Extend `prefer-modern-dom-apis` with `insertBefore` => `prepend`
Rule proposal: `prefer-array-from`
Rule proposal: `prefer-string-repeat`
False positive in `prefer-array-flat`
Rule proposal: string character access by index
False positive for unicorn/no-array-method-this-argument and unicorn/no-array-callback-reference when using leaflet's L.map();
Help initiating "prefer-query-selector" outside of UNICORN
Rule proposal: `no-unused-assign`
False positive in `consistent-function-scoping` when using `React.useEffect`
better-regex - sanity check error and suggestion
False positive for prefer-regexp-test with Redux Toolkit
Rule proposal: prevent mistake in map access
Rule proposal: No property references in destructuring patterns
Rule proposal: `no-redundant-nesting-in-template-literal`
`no-array-for-each`: is not handling optional chaining when auto-fixing
Rule proposal: Prefer `array.flat()` over `array.flat(1)`
$file-name.tsx fails the kebab-case rule (filename-case)
better-regex proposes to replace [!~^] with [!^~] and [~^] with [^~]
Rule proposal: `minimum-ternary`
Rule change proposal regarding `prefer-ternary`:
prefer-export-from improperly handles JSON import/exports
Rule proposal: No moot `./` in `new URL()`
no-array-method-this-argument false positive with Cypress.find
Rule proposal: Doc comment Asterix prefix style
Rule proposal: `no-unreadable-new-expression`
Rule proposal: `no-thenable`
Token "items" does not exist.
Rule proposal: `prefer-await`
require-array-join-separator doesn't work optional chaining
unicorn/no-array-callback-reference fires for non-array and no function passed
MessageChannel.postMessage is identified as Window.postMessage by require-post-message-target-origin
Rule proposal: `no-await-await`
*.ts override makes ESLint lint .ts files
no-unused-properties doesn't detect unused typescript object args
"npm run test" fails with an error about ./lib/rules/no-warning-comments
📝 Rule improvement: `padded-blocks` - Option to set minimum number of statements to require in block, before applying the rule
Rule proposal: prefer destructuring defaults to Object.assign/rest
Consistent function scoping while returning a function
Readme for no-unsafe-regex has wrong example
Rule proposal: `prefer-math-log10`
no-array-for-each Slower Performance
Linting crashes while loading rule `unicorn/filename-case`
no-null should allow, or have an option to allow, the `null == foo` pattern for value-presence-checking
Autofix breaks regex
Rule proposal: `prefer-logical-assignment-operators`
Comment is destroyed when autofixing via 'unicorn/prefer-ternary'
Possible issue with `prefer-object-from-entries`
`require-post-message-target-origin` should ignore some cases
Rule proposal: `prefer-code-point`
Rule proposal: `filename-case` Pascal case, ignore extensions or consider long extensions
no-array-callback-reference false positives with mongoose.Model
`require-number-to-fixed-digits-argument` proposed breaking code changes when using libraries that replicate `toFixed()`
`no-array-for-each`: False positive with Maps/Sets
getPhysicalFilename() error when linting
Rule proposal: spellcheck
prefer-number-properties can't detect usages via global object
`no-zero-fractions`: Incorrect fix
Rule proposal: Prefer `prefer-scoped-selector`
Rule proposal: `prefer-promise-all-settled`
`require-post-message-target-origin` targets an unrelated API (types available)
consistent-destructuring: incorrect report if the value is reassigned
[unicorn/filename-case] Ignore base on file path
Expand `prefer-dom-node-text-content` against `.innerHTML` or implement `no-inner-html` rule
Rule proposal: `no-query-selector-all-zero`
`require-post-message-target-origin` shouldn't trigger in web extension context
Missing case in `prefer-switch`
`no-useless-undefined` conflicts with hooks
Rule proposal: `call-arguments-length`
no-array-for-each invalid fix
`prefer-array-flat` incorrect fix
Rule proposal: `no-unnecessary-rename`
explicit-length-check reported for class properties "size"
Rule proposal: `no-nested-call`
Rule proposal: `prefer-path2d`
Enforce extensions case in `filename-case`
`prefer-string-starts-ends-with`: incorrect autofix when string does not exist
[explicit-length-check]: misunderstanding a string an index
Rule proposal: `no-useless-interpolation`
Rule proposal: `prefer-object-from-entries`
For Angular Core it prints "The variable `HttpParams` should be named `HttpParameters`"
`prefer-switch` rule causes unreachable break statement when return statement present
Rule proposal: `prefer-destructured-variables`
Support `node:` module name prefix in the `import-style` rule
Conflict no-useless-undefined with consistent-return
No way to write async generators
[no-array-callback-reference] enhancement: report only if missing mandatory arguments
Rule proposal: Require extension for relative imports and re-exports
[consistent-destructing] False positives on deep destruction
prefer-set-has doesn't autofix types
Incorrect autofix of string concat with `prefer-spread` rule
document.append() has browser compatible issue
no-array-for-each: uses const when variable assigned
[consistent-destructuring] incorrect fix for ts `in` type guard
[no-this-assignment] unfixable reporting
Dependencies are missing and code throws in the last day or two
`prevent-abbreviations` renames exported type declarations in Typescript
`no-array-for-each`: autofix uses an already existing variable name in method chaining
Rule proposal: Forbid reassign top level variable in functions
False positive on no-array-for-each
`better-regex` enhancement: report invalid regexes (when exceptions thrown by the parser)
Fix smoke test failure
`prefer-spread` flags non-array concat
`prefer-spread` flagging `Array#concat(…)` for non-iterable objects
Lack of clear alternative for reduceRight in unicorn/no-array-reduce
unicorn/no-array-push-push - breaks stream.push
prefer-spread
Rule proposal: `no-complex-iteratee-expression`
Fix "smoke test"
Rule proposal: `consistent-non-exists-index-check`
no-array-callback-reference
Broken autofix in prefer-string-slice with optional chaining
Broken autofix with `better-regex` and multiple optional spaces
Rule proposal: `prefer-regexp-code-point-escape`
Rule proposal: `prefer-regexp-unicode-property-escapes`
Rule proposal: `no-useless-else`
Rule proposal: Require passive event listener
Rule proposal: `prefer-math-floor`
Rule proposal: `prefer-top-level-await`
Rule proposal: `prefer-global-this`
Rule proposal: `prefer-array-flat`
Rule proposal: `no-http`
[BUG] Do not pass function directly to JQuery `.find(…)` .eslintunicorn/no-array-callback-reference
TypeError: source.visitorKeys[node.type] is not iterable
Rule proposal: `no-new-array`
Rule proposal: `no-array-for-each`
Improve option naming
unicorn/new-for-builtins disallows Object contructor.
`error-message`: Maximum call stack size exceeded
Rule proposal: `empty-brace-space`
`unicorn/better-regex` autofix breaks "match all" in multiline regexps
prefer-ternary: option to ignore when multiple lines
Rule proposal: simplify negation
Add some sort of whitelist to `string-content`
Make 'import-index' handle more cases
Is there a way to turn all rules level to warn/error?
Use lodash instead of method of lodash
Add typescript packages back to integration test run
Auto-fix for prefer-includes removes too many/wrong parenthesis
Performance advice on “prefer-query-selector” rule
'use strict' is unnecessary inside of modules
`no-for-loop` rule bug with `@typescript-eslint/parser`
`prevent-abbreviations` fixer bug
`prevent-abbreviation` rule currently not working with `@typescript-eslint/parser`
Rule Proposal: Forbid naming variables beginning with "new"
Add `no-zero-fractions` rule, Fixes #207
Add `prefer-key-over-key-code` rule
Add `prefer-dataset` rule
Add `jsx-import` rule
Add `prefer-includes` rule
Definition for rule 'unicorn/import-index' was not found eslint
Add blacklist to `no-fn-reference-in-iterator` rule to prevent false-positives - fixes #121
Import naming rule
© 2019 BoostIO, Inc.