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 -

Published by sindresorhus over 3 years ago

New rules

Improvements

  • no-array-for-each: Use let if parameters are reassigned (#1139) a13ad3c
  • no-array-push-push and prefer-ternary: Improve same reference detection (#1123) c2c28a6
  • prefer-spread: Add Array#slice() check (#1117) 8bdb52d

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v28.0.2...v29.0.0

eslint-plugin-unicorn -

Published by sindresorhus over 3 years ago

  • prevent-abbreviations: Do not rename exported types when using @babel/eslint-parser (#1104) 9a91a3d
  • prevent-abbreviations: Do not rename exported TypeScript types (#1103) 5c08932

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

eslint-plugin-unicorn -

Published by sindresorhus over 3 years ago

  • Fix missing eslint-visitor-keys dependency (#1100) 5c1ff2e

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

eslint-plugin-unicorn -

Published by sindresorhus over 3 years ago

Improvements

  • no-lonely-if: Keep all comments (#1047) da94ca9
  • prefer-includes: Add Array#some() check (#1097) ee3a2e5
  • prefer-includes: Improve report location (#1061) 83575a8
  • prefer-spread: Improve auto-fix (#1080) e54dc66
  • prefer-spread: Add more suggestions for .concat fix (#1054) 673c440

Fixes

  • no-unreadable-array-destructuring: Fix crash on destructuring in for…of loop (#1076) 11ce1bc
  • no-array-for-each: Ignore React.Children.forEach (#1088) 5a931dd
  • prefer-string-slice: Keep optional chaining in autofix (#1085) acaf197
  • prefer-spread: Ignore Buffer.concat() (#1069) da685f7
  • Ignore unexpected case in catch-error-name and prefer-set-has (#1077) 79a64b1
  • prefer-default-parameters: Fix non-iterable visitorKeys (#1013) d707e83
  • consistent-destructuring: Add ExperimentalRestProperty check (#1060) aca2ec5

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v27.0.0...v28.0.0

eslint-plugin-unicorn -

Published by sindresorhus over 3 years ago

New rules

Improvements

  • prefer-ternary: Add only-single-line option (#1025) 306c9e7
  • numeric-separators-style: Add onlyIfContainsSeparator option (#916) 8d32574
  • prefer-spread: Prefer ... over Array#concat() (#1029) cda72bd
  • prefer-spread: Fix more .concat cases (#1042) c3c7ba3
  • no-array-callback-reference: Improve suggestions for Array#forEach() (#1049) 77bcdc6
  • no-new-buffer: Use suggestion for unknown arguments (#1037) 88a724c
  • no-unreadable-array-destructuring: Add auto-fix (#1010) 27bc3c3
  • new-for-builtins: Better auto-fix (#1022) 5ba0f83
  • no-instanceof-array: Better auto-fix (#1020) 0520f31

Fixes

  • prefer-query-selector: Fix crash on unexpected selector (#1034) 88018ca

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

eslint-plugin-unicorn -

Published by sindresorhus almost 4 years ago

  • prefer-math-trunc: Use suggestion instead of auto-fix for x | 0 (#1014) 74b1b2d

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

eslint-plugin-unicorn -

Published by sindresorhus almost 4 years ago

New rules

Improvements

  • Remove import-index rule from recommended preset (#977) ff1cd2e
  • prefer-string-starts-ends-with: Remove check on String#match() (#1002) c9fa8b1
  • no-array-callback-reference: Ignore AwaitExpression except reduce and reduceRight (#814) 4c2b00b

Fixes

  • prefer-string-starts-ends-with: Fix missing parentheses for some cases (#976) e2f94fe
  • Don't consider ?? operator LogicExpression as a boolean value node (#986) dc7f79b

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v25.0.0...v26.0.0

eslint-plugin-unicorn -

Published by sindresorhus almost 4 years ago

eslint-plugin-unicorn -

Published by sindresorhus almost 4 years ago

New rules

Renamed rules

We improved the naming and name consistency of some rules. Sorry about the churn.

If you use the recommended preset and you're not overriding any rules, you don't need to do anything.

  • no-fn-reference-in-iteratorno-array-callback-reference
  • no-array-instanceofno-instanceof-array
  • no-reduceno-array-reduce
  • prefer-datasetprefer-dom-node-dataset
  • prefer-flat-mapprefer-array-flat-map
  • prefer-replace-allprefer-string-replace-all
  • prefer-starts-ends-withprefer-string-starts-ends-with
  • prefer-text-contentprefer-dom-node-text-content
  • prefer-trim-start-endprefer-string-trim-start-end
  • prefer-event-keyprefer-keyboard-event-key
  • prefer-node-appendprefer-dom-node-append
  • prefer-node-removeprefer-dom-node-remove

20c6341

Improvements

  • explicit-length-check: Make rule work in many more cases (#943) f3bc798
  • explicit-length-check: Check unsafe LogicalExpressions (#952) a1b60ad
  • explicit-length-check: Check Boolean(foo.length) (#951) f4577f7
  • explicit-length-check: Check more cases (#941) 83a6453
  • new-for-builtins: Ignore Object(x) === x and Object(x) !== x (#944) 5c7ea92
  • explicit-length-check: Rewrite rule (#938) 94ae87a

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v24.0.0...v25.0.0

eslint-plugin-unicorn -

Published by sindresorhus almost 4 years ago

New rules

Improvements

  • prevent-abbreviations: Add ignore option (#891) 898fcb4
  • no-useless-undefined: Add checkArguments option (#877) a1617b9
  • consistent-function-scoping: Allow ignoring arrow functions (#932) 17bf27c
  • Rewrite error-message rule (#922) 877bef9
  • Improve prefer-query-selector rule (#908) 635601d
  • prevent-abbreviations: Add var/vars replacements (#894) 07dadf5
  • prevent-abbreviations: Add verversion replacement (#870) e755cdd
  • prefer-number-properties: Support computed key of ClassProperty MethodDefinition Property (#886) 769ac35
  • prefer-optional-catch-binding: Improve output (#884) 375d11a
  • no-null: Exclude useRef(null) and React.useRef(null) (#890) 7a4dbf4
  • prefer-number-properties: Add Infinity support (#874) 643169b
  • no-console-spaces: Improve report location (#866) 190cbac
  • no-useless-undefined: Ignore toHaveBeenCalledWith method (#876) d10a641
  • prefer-replace-all: Handle u flag (#879) d98d867
  • no-for-loop: Improve output when using the TypeScript parser (#883) 52edd3b
  • no-for-loop: Respect declaration kind (#878) df3f7bd
  • no-for-loop: Only report on the for loop head part (#885) e9c6963

Fixes

  • Fix false import styles seen in reported problem messages (#910) d669707
  • import-style: Fix crash on babel-eslint parser (#927) 9f5f721
  • prevent-abbreviations: Fix crash with TypeScript parser (#913) 9d5eca6
  • prefer-query-selector: Fix crash on calling without argument (#906) 36908da
  • import-style: Fix crash on destructing require (#904) 8335d41
  • new-for-builtins: Remove auto-fix for new String, new Boolean(), and new Number() (#907) dfc1ce0

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v23.0.0...v24.0.0

eslint-plugin-unicorn -

Published by sindresorhus about 4 years ago

New rules

Improvements

  • explicit-length-check: Use 'non-zero': 'greater-than' by default (#850) 7c5df5f
  • prevent-abbreviations: Add fn/func -> function, i/idx/j -> index replacements (#836) e502f42
  • consistent-function-scoping: Check anonymous functions (#835) 29ecbf6
  • no-console-spaces: Make space position more specific (#838) e17a63f
  • no-nested-ternary: Improve report location & message (#844) ca1afa6
  • Track JSX presence per-function, fixing some false negatives (#830) 85d424c

Fixes

  • prefer-flat-map: Exclude .flat() where depth is not 1 (#859) 61d9851

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v22.0.0...v23.0.0

eslint-plugin-unicorn -

Published by sindresorhus about 4 years ago

New rules

Improvements

  • Allow Children in no-fn-reference-in-iterator (#809) 036e440
  • filename-case: Ignore more index files (#826) 64d03a5
  • Update ecmaVersion to 2021 (#820) a78cea3

Fixes

  • prefer-trim-start-end: Fix error message, improve report location (#823) b35c261
  • number-literal-case: Fix false positive on @typescript-eslint/parser (#815) 33a1268
  • no-unused-properties: Fix error thrown when using rest in object destructuring (#811) 1475f39

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v21.0.0...v22.0.0

eslint-plugin-unicorn -

Published by sindresorhus over 4 years ago

New rules

Improvements

  • Add ev to event default replacement to prevent-abbreviations rule (#793) a0b4aba
  • Ignore more types in no-fn-reference-in-iterator and no-reduce rule (#756) 5159c24
  • Make unicorn/prefer-flat-map not enabled by default in the recommended config 655220a
  • Improve consistent-function-scoping report location (#778) df218a2
  • Improve consistent-function-scoping message (#773) 4ed2adf

Fixes

  • consistent-function-scoping: Fix wrong detect of IIFE (#772) f7127da
  • prefer-starts-ends-with: Fix pipe in regex (#783) 1dca2f3
  • prevent-abbreviations: Fix optional parameter (#764) 7781c3f
  • no-useless-undefined: Ignore undefined use in compare functions (#758) 6d36407

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v20.1.0...v21.0.0

eslint-plugin-unicorn -

Published by sindresorhus over 4 years ago

  • Use singular array element variable name in autofix for no-for-loop rule (#745) 2002093
  • Avoid naming collision with default array element variable in autofix for no-for-loop rule (#749) 48bd5c8

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v20.0.0...v20.1.0

eslint-plugin-unicorn -

Published by sindresorhus over 4 years ago

Breaking

New rules

Improvements

  • throw-new-error: Check MemberExpression customError (#716) a28aad5
  • prefer-starts-ends-with: Add auto-fix (#711) da978e3
  • consistent-function-scoping: Ignore IIFE (#707) 1f4413d
  • prefer-set-has: Ignore arrays only checking existence once (#706) 54c6f54

Fixes

  • prefer-starts-ends-with: Fix bug with m flag (#721) 83bbabc
  • prefer-string-slice: Handle negative length in .substr() (#709) 7439465

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

eslint-plugin-unicorn -

Published by sindresorhus over 4 years ago

  • no-fn-reference-in-iterator: Ignore this. and Vue.filter (#699) b02a9c6
  • no-fn-reference-in-iterator: Ignore cases obviously not a function reference (#697) dae5107

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

eslint-plugin-unicorn -

Published by sindresorhus over 4 years ago

New rules

Breaking

  • string-content: Make it have no default patterns (#637) 08fad55
  • catch-error-name: Replace caughtErrorsIgnorePattern option with an ignore option (#661) 5a27f04

Improvements

  • custom-error-definition: Support class properties (#673) 9cc8d60
  • catch-error-name: Support Promise#then (#660) edcf73c
  • prefer-set-has: Supports more types of array (#641) 29f3c9c

Fixes

  • escape-case: Fix missing characters (#678) d986427
  • no-nested-ternary: Fix incorrect result with TypeScript parser (#664) cb08ed0
  • custom-error-definition: Fix duplicated reports on this.message assign (#669) aa00647
  • custom-error-definition: Fix crash on @typescript-eslint/parser (#659) e8cb921
  • catch-error-name: Improve error message (#665) 8ac9a90
  • catch-error-name: Fix error renaming (#654) cc2d1b1
  • catch-error-name: Only allow _ when it's not used (#650) 0c31a0b
  • catch-error-name: Ignore destructuring (#649) b2838fd

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

eslint-plugin-unicorn -

Published by sindresorhus over 4 years ago

  • prefer-number-properties: Fix suggestion description (#635) d410ca3

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

eslint-plugin-unicorn -

Published by sindresorhus over 4 years ago

New rules

Improvements

Fixes

  • no-console-spaces: Fix crash on string contains \n (#629) 9cd01cd
  • explicit-length-check: Ignore computed length of MemberExpression (#620) 418e072
  • prefer-spread: Insert semicolon in more cases (#615) de48b3d
  • catch-error-name: Keep typeAnnotation when replacing identifier (#613) 446ff37
  • prevent-abbreviations: Fix crash on TypeParameter with default value (#606) 2ef7a21
  • prevent-abbreviations: Add global variables check (#603) b5c0a12
  • Update regexp-tree to fix whitespace rewrite (#605) 2b78a17

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v17.2.0...v18.0.0

eslint-plugin-unicorn -

Published by sindresorhus over 4 years ago

  • consistent-function-scoping: Check use of this and arguments (#590) 8b417e6
  • prevent-abbreviations: Fix inappropriate suggestion (#592) 2e20294
  • consistent-function-scoping: Ignore within React hooks (#588) 7126d6d
  • string-content: Ignore some TaggedTemplateExpression (#585) 92f3f3d
  • consistent-function-scoping: Display function name in error message (#589) e7e49ec
  • consistent-function-scoping: Fix uninitialized variable check (#587) 4c48c02

https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v17.1.0...v17.2.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