eslint-plugin-unicorn

More than 100 powerful ESLint rules

MIT License

Downloads
11.8M
Stars
3.9K
Committers
152

Bot releases are hidden (Show)

eslint-plugin-unicorn - Latest Release

Published by sindresorhus 7 months ago

New rules

Improvements

  • filename-case: Add option for multiple file extensions (#2186) 4594020
  • import-style: Support node: protocol (#2297) c28a086
  • prefer-array-find: Check array.filter().at(0) (#2284) e6074fe
  • prefer-prototype-methods: Check Object.prototype methods from globalThis (#2286) 1792d33
  • no-array-callback-reference: Check logical expressions and check ternaries deeply (#2289) 231529a

Fixes

  • prefer-spread: Fix it to not report on optional chaining (#2304) df1ff1c
  • no-anonymous-default-export: Uppercase class name (#2282) 5ce4169

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v51.0.1...v52.0.0

eslint-plugin-unicorn -

Published by sindresorhus 9 months ago

  • prefer-node-protocol: Fix false positive on bun:* modules (#2272) 43fc638

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v51.0.0...v51.0.1

eslint-plugin-unicorn -

Published by sindresorhus 9 months ago

Breaking

  • consistent-destructuring: Remove from recommended preset (#2260) 702d51b

Improvements

  • no-array-method-this-argument: Check Array.from() (#2262) 797caee

Fixes

  • no-thenable: Fix crash on {[Symbol.prototype]: 0} (#2248) 3c7d7c0
  • prefer-prototype-methods: Fix argument of isMethodCall (#2247) 3b504fa

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v50.0.1...v51.0.0

eslint-plugin-unicorn -

Published by fisker 10 months ago

Fixes

  • no-unnecessary-polyfills: Fix missing dependency error (#2242) 3df16068

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v50.0.0...v50.0.1

eslint-plugin-unicorn -

Published by sindresorhus 10 months ago

New rules

Improvements

  • Support ESLint's new config system (#1886) 65711f9
  • no-useless-undefined: Add checkArrowFunctionBody option (#2232) 9d7048c
  • prefer-negative-index: Check TypedArray#subarray() (#2237) 6708a30
  • no-useless-undefined: Ignore React state setters (#2223) 42881ba
  • prefer-module: Allow module as TSTypeParameter name (#2213) 8f61f7c

Fixes

  • string-content: Fix JSX autofix for newlines, etc. (#2222) b95e75e

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v49.0.0...v50.0.0

eslint-plugin-unicorn -

Published by sindresorhus 12 months ago

Improvements

  • expiring-todo-comments: Support monorepos (#2159) ac51d40
  • prefer-module: Allow module as TSIndexSignature names or TSTypeAliasDeclaration ids (#2209) ea94b3b
  • Support RegExp v flag (#2195) 28e7498
  • prefer-event-target: Ignore EventEmitter from @angular/core and eventemitter3 (#2197) 1629ebe

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v48.0.1...v49.0.0

eslint-plugin-unicorn -

Published by sindresorhus about 1 year ago

  • no-empty-file: Fix directive check for TypeScript parser (#2180) 1bb9ce8

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v48.0.0...v48.0.1

eslint-plugin-unicorn -

Published by sindresorhus over 1 year ago

Improvements

  • Deprecate no-unsafe-regex rule (#2135) 7b473aa
  • prefer-top-level-await: Ignore promises inside Promise.{all,allSettled,any,race}() (#2139) d3f6b60
  • no-process-exit: Ignore when using node:worker_threads module (#2136) 2907805
  • prefer-array-some: Ignore filter calls with literal argument (#2097) 7a32edb
  • prefer-modern-math-api: Check cases that Math.hypot() should be preferred (#2080) 9bbc948
  • explicit-length-check: Ignore .length || number (#1977) b9b8794

Fixes

  • Fix crash on array holes (#2129) f10f1a6
  • prefer-dom-node-dataset: Fix edge cases (#2171) b2d7378
  • prefer-dom-node-dataset: Remove broken fix for element.setAttribute (#2169) 61234af
  • no-lonely-if: Fix an edge case (#2168) ca837a8
  • no-useless-undefined: Turn parameter with undefined default value into optional parameter (#2138) 4aa7d60
  • no-thenable: Fix Object.fromEntries() check (#2130) f3265b9
  • prefer-dom-node-remove: Fix incorrect auto-fix (#2084) 74bb36d

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v47.0.0...v48.0.0

eslint-plugin-unicorn -

Published by sindresorhus over 1 year ago

Breaking

  • Require Node.js 16 (#2073) a3bc120
  • Require eslint@>=8.38.0 (#2066) 04af765
  • Enable prefer-at, prefer-event-target, and prefer-string-replace-all in recommended config (#2073) a3bc120

New rules

Improvements

  • prefer-top-level-await: Ignore .cjs files (#2072) 0c3ccb1
  • prefer-spread: Stop checking Array.from call with map function (#2064) f5beccb
  • prefer-dom-node-text-content: Check optional chaining (#2062) 8d6d007
  • prefer-dom-node-{append,remove}: Check optional chaining (#2061) 443999b

Fixes

  • prefer-number-properties: Fix false positives (#2050) 124bfa7

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v46.0.0...v47.0.0

eslint-plugin-unicorn -

Published by sindresorhus over 1 year ago

eslint-plugin-unicorn -

Published by sindresorhus over 1 year ago

Improvements

  • Add elems to abbreviations (#2040) 2a9c840
  • no-useless-spread: Check Array#{toReversed,toSorted,toSpliced,with} (#2030) 55469e5
  • prefer-set-has: Support Array#{toReversed,toSorted,toSpliced,with} (#2032) fea5b42
  • prefer-spread: Forbid use of Array#toSpliced() to copy array (#2034) 4ada50e
  • prefer-negative-index: Check .toSpliced() and .with() (#2031) 7ed738a
  • no-empty-file: Support .jsx and .tsx extensions (#2002) ba1a00e

Fixes

  • expiring-todo-comments: Do not normalize package.json (#1871) (#2020) fcd8934

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v45.0.2...v46.0.0

eslint-plugin-unicorn -

Published by sindresorhus almost 2 years ago

  • prefer-string-replace-all: Don't crash on invalid pattern (#2011) 3bbe027
  • prevent-abbreviations: Skip fix for variables used in Vue template (#2012) 8cd1ded

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v45.0.1...v45.0.2

eslint-plugin-unicorn -

Published by sindresorhus almost 2 years ago

  • no-useless-spread: Remove unsafe fix (#1996) 6756cbd

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v45.0.0...v45.0.1

eslint-plugin-unicorn -

Published by sindresorhus almost 2 years ago

New rules

Improvements

  • prefer-at: Support private fields (#1929) 60bb455
  • no-useless-undefined: Ignore Array#includes() and Set#has() (#1951) 8dfd5a7
  • no-useless-spread: Check cloning inline arrays (#1980) 5d90d73
  • prefer-top-level-await: Ignore expressions in class (#1976) b90a3aa
  • prefer-string-replace-all: Improve RegExp to string fix (#1971) b844dbc
  • prefer-string-replace-all: Check pattern even if it's already using .replaceAll (#1981) e8c5156
  • prefer-string-replace-all: Report all String#replace() when the pattern has g flag (#1965) 6316f05
  • prefer-string-replace-all: Ignore regex with pipe (#1962) 76deaa3
  • prefer-regexp-test: Use suggestions if not sure regexp without g flag (#1954) 505a203
  • no-array-for-each: Skip fix for some edge cases (#1979) 48efc7a
  • prefer-add-event-listener: Only fix ExpressionStatement, check operator (#1955) aca21f2
  • prevent-abbreviations: Improve fix for retVal (#1953) 25cd810

Fixes

  • prefer-top-level-await: Fix crash on for..of loop (#1950) 00a29c8

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v44.0.2...v45.0.0

eslint-plugin-unicorn -

Published by sindresorhus about 2 years ago

  • no-array-method-this-argument: Ignore lodash.findLast and lodash.findLastIndex (#1927) 86e8add

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v44.0.1...v44.0.2

eslint-plugin-unicorn -

Published by sindresorhus about 2 years ago

  • prefer-array-index-of: Add missing message (#1924) a981a13

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v44.0.0...v44.0.1

eslint-plugin-unicorn -

Published by sindresorhus about 2 years ago

New rules

Improvements

  • prefer-array-find: Add option to also prefer .findLast() (#1900) 02252c7
  • template-indent: Preserve trailing spaces (#1872) e4071f5
  • no-document-cookie: Check window.document.cookie (#1833) 0886544
  • prefer-array-index-of: Prefer .lastIndexOf() over .findLastIndex() (#1896) 70e5bdd
  • prefer-array-some: Check .findLast() (#1897) 3e6ae43
  • prefer-native-coercion-functions: Check .findLast and .findLastIndex (#1893) f2c6acc
  • no-array-method-this-argument: Check .findLast and .findLastIndex (#1890) 3bc28ad
  • no-array-callback-reference: Check .findLast and .findLastIndex (#1889) 37a5cda
  • prefer-negative-index: Remove ArrayBuffer#at (#1899) a10e3f6
  • prefer-at: Improve fix (#1901) 1c457bb

Fixes

  • no-await-expression-member: Fix crash on TypeScript parser (#1910) b002e75
  • prevent-abbreviations: Skip fix when variable is JSX component (#1907) 9ed08ab
  • better-regexp: Don't fix if .source or .toString() is used (#1903) 8ad592b

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v43.0.2...v44.0.0

eslint-plugin-unicorn -

Published by sindresorhus over 2 years ago

  • prefer-spread: Ignore Array#join().concat() and (a + b).concat() (#1859) ab71971

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v43.0.1...v43.0.2

eslint-plugin-unicorn -

Published by sindresorhus over 2 years ago

  • Remove prefer-event-target from the recommended preset 4d2faac
    • EventTarget requires Node.js 16 and we target Node.js 14. We'll enable it again in a year when we can target Node.js 16.

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v43.0.0...v43.0.1

eslint-plugin-unicorn -

Published by sindresorhus over 2 years ago

New rules

Breaking

  • Require Node.js 14

Improvements

  • Add prefer-top-level-await rule to recommended preset (#1803) 6f5ecf5
  • Deprecate import-index rule (#1787) 0034e69
  • Update abbreviations to support Next.js functions (#1804) 4b96057
  • text-encoding-identifier-case: Ignore JSX meta[charset="utf-8"] (#1817) c67a70f
  • prefer-number-properties: Check any use of global functions (#1834) 51d7e06
  • prefer-number-properties: Detect usage via global object (#1832) 80c4af2
  • no-array-for-each: Check reassign in for..in and for..of (#1824) d3b2548
  • no-useless-undefined: Ignore ref(undefined) in Vue project (#1828) e7306e5
  • prefer-node-protocol: Always check require() (#1827) 2c914d4
  • no-array-for-each: Improve parameter reassign detection (#1823) 56df468
  • no-array-for-each: Add fix for arrow function body (#1785) 59218e3

Fixes

  • no-array-for-each: Fix auto-fix causing SyntaxError (#1813) 47c8337

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v42.0.0...v43.0.0

Package Rankings
Top 0.62% on Npmjs.org
Top 9.55% on Proxy.golang.org
Top 19.29% on Repo1.maven.org
Badges
Extracted from project README
Coverage Status npm version