Update dependency eslint-plugin-unicorn to v34 #1162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
18.0.1
->34.0.0
Release Notes
sindresorhus/eslint-plugin-unicorn
v34.0.0
Compare Source
New rules
no-array-method-this-argument
(#1357)96587f2
require-post-message-target-origin
(#1326)03c540b
prefer-top-level-await
(#1325)05722a1
prefer-at
(#1331)8ca5b46
Improvements
prefer-module
: Ignore.cjs
files (#1355)ebdc3c2
error-message
: SupportAggregateError
(#1351)e7b4300
filename-case
: Enforce lowercased file extension (#1336)119615b
expiring-todo-comments
: More helpful error when no conditions (#1375)914a996
prefer-array-some
andprefer-regexp-test
: Support Vue SFC (#1364)a46050e
explicit-length-check
: Supportv-show
directive (#1363)f163c4a
explicit-length-check
: Support Vue SFC files (#1360)9199611
prefer-type-error
: Improve report location (#1354)bc3d58b
no-useless-undefined
: IgnoreSet#add()
Map#set()
Array#{push,unshift}()
(#1353)c6359c3
prefer-prototype-methods
: Only check methods from[]
and{}
(#1347)29a4e75
prefer-array-some
: Report non-zero check onarray.filter().length
(#1337)f8aaac2
context.getPhysicalFilename()
(#1344)e2540cb
Fixes
prefer-array-find
andprefer-at
: Fix crash on LHS zero index access (#1373)da1f6d8
prefer-prototype-methods
: Fix a missing condition on object literal check (#1332)cec7f11
v33.0.1
Compare Source
prefer-prototype-methods
: Ignore known object literal methods (#1330)639e7af
v33.0.0
Compare Source
New rules
require-array-join-separator
(#1284)36e7103
require-number-to-fixed-digits-argument
(#1288)4a30863
prefer-prototype-methods
(#1247)7bde733
prefer-object-has-own
(#1322)ca34b40
recommended
preset.Improvements
no-array-for-each
: Handle only return statement insideif
orelse
(#1319)298a104
new-for-builtins
&no-new-buffer
: Handle line breaks afternew
keyword (#1301)d37439f
prefer-array-flat-map
: Remove check on[].concat(...array.map(…))
(#1299)128b5aa
prefer-spread
: Ignore{arrayBuffer,blob,buffer,file,this}.slice()
(#1287)e18d5f2
prefer-string-starts-ends-with
: Add suggestions for safely handling non-strings (#1277)f14a9d1
explicit-length-check
: Ignorethis.{size,length}
(#1289)ed85d00
prefer-string-starts-ends-with-rule
: Don't autofix known non-string values (#1281)a1c8984
explicit-length-check
: Ignore known, non-number length properties (#1264)42f6487
empty-brace-spaces
: Support experimental syntax (#1276)fa68b6f
prefer-dom-node-remove
: Improve parentheses handling (#1254)74e4d39
Fixes
prefer-array-flat
: Fix incorrect fix, checkArray.prototype.concat.call
(#1317)f6a939c
v32.0.1
Compare Source
prevent-abbreviations
: Fix shorthand import/export detection (#1252)4367479
v32.0.0
Compare Source
Breaking
a8e9f26
babel-eslint
(#1211)a8e9f26
You should migrate to
@babel/eslint-parser
New rules
no-document-cookie
(#1244)866c4a3
numeric-separators-style
- Was previously disabled.prefer-array-flat
- Was previously disabled.prefer-array-flat-map
- Was previously disabled.Improvements
no-for-loop
: Ignore known non-array loop variables (#1242)29f6b45
prefer-array-find
: Singularize variable name in autofix (#1243)6b340a3
prefer-switch
: Do not add braces to the default case (#1235)c241782
no-zero-fractions
: Handle numeric separators, fix missing parentheses, improve report location (#1238)2724afa
no-array-for-each
: Better error message (#1239)2e82dc8
prefer-switch
: Avoid conflict withno-unreachable
rule (#1234)1c78d0c
prefer-optional-catch-binding
: Support checking destructured errors (#1229)a0b2f4f
no-array-for-each
: Support autofixing complicated parameters (#1228)d84143f
prefer-negative-index
: SupportArray#at()
(#1217)6443ee3
explicit-length-check
: CheckSet#size
(#1226)6a745a0
filename-case
: Improve report position (#1227)3d4ac1b
Fixes
prevent-abbreviations
: Fix shorthand import/export detection (#1215)a669e31
v31.0.0
Compare Source
New rules
prefer-node-protocol
(#1203)b1a5f53
prefer-module
(#1141)a7e393c
v30.0.0
Compare Source
New rules
prefer-switch
(#1181)10e7a0c
Breaking
prevent-abbreviations
: Rename options (#1164)cf42cc5
no-keyword-prefix
: Renameblacklist
option todisallowedPrefixes
(#1180)91e60d0
Improvements
no-array-push-push
: Addignore
option (#1168)f9262d9
prefer-spread
: Reportarray.slice(0)
(#1182)92bebe1
no-useless-undefined
: Handle parenthesizedundefined
(#1178)c88882e
no-array-for-each
: Improve fixable parameter detection (#1177)18d1ac2
prefer-array-flat-map
: ExcludeReact.Children.map().flat()
(#1159)3e6b6fb
better-regex
: Report parsing errors (#1133)51ee030
filename-case
: Uniquify suggestion filenames (#1160)a87238f
PropertyDefinition
(#1127)75c4d78
Fixes
prefer-number-properties
: Fix some edge cases (#1170)e7e25b8
prefer-number-properties
: Fix some edge cases (part 2) (#1176)3a58802
prefer-regexp-test
: Do not fix if regexp hasg
flag (#1173)8d97beb
no-array-for-each
: Do not fix if callback parameter has type annotation (#1167)0d4fc8b
no-useless-undefined
: Do not reportreturn undefined
if function hasreturnType
(#1165)4ff39e0
prefer-set-has
: Use suggestions if node has type annotation (#1158)1221185
no-null
: Exclude second argument ofNode.insertBefore()
(#1157)b16c316
prefer-add-event-listener
: Fix crash on parenthesized cases (#1153)c95e854
MemberExpression
check when usingecmaVersion: 2019
(#1151)56d5d9a
prefer-regexp-test
: Do not fix if argument ofString#match()
is known notRegExp
(#1152)0abc394
v29.0.0
Compare Source
New rules
no-static-only-class
(#1120)f3b2441
prefer-array-flat
(#1126)2397d94
Improvements
no-array-for-each
: Uselet
if parameters are reassigned (#1139)a13ad3c
no-array-push-push
andprefer-ternary
: Improve same reference detection (#1123)c2c28a6
prefer-spread
: AddArray#slice()
check (#1117)8bdb52d
v28.0.2
Compare Source
prevent-abbreviations
: Do not rename exported types when using @babel/eslint-parser (#1104)9a91a3d
prevent-abbreviations
: Do not rename exported TypeScript types (#1103)5c08932
v28.0.1
Compare Source
eslint-visitor-keys
dependency (#1100)5c1ff2e
v28.0.0
Compare Source
Improvements
no-lonely-if
: Keep all comments (#1047)da94ca9
prefer-includes
: AddArray#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 infor…of
loop (#1076)11ce1bc
no-array-for-each
: IgnoreReact.Children.forEach
(#1088)5a931dd
prefer-string-slice
: Keep optional chaining in autofix (#1085)acaf197
prefer-spread
: IgnoreBuffer.concat()
(#1069)da685f7
catch-error-name
andprefer-set-has
(#1077)79a64b1
prefer-default-parameters
: Fix non-iterablevisitorKeys
(#1013)d707e83
consistent-destructuring
: AddExperimentalRestProperty
check (#1060)aca2ec5
v27.0.0
Compare Source
New rules
no-array-for-each
(#1017)719cd00
no-array-push-push
(#1015)21537d7
no-this-assignment
(#1018)62a2f92
Improvements
prefer-ternary
: Addonly-single-line
option (#1025)306c9e7
numeric-separators-style
: AddonlyIfContainsSeparator
option (#916)8d32574
prefer-spread
: Prefer...
overArray#concat()
(#1029)cda72bd
prefer-spread
: Fix more.concat
cases (#1042)c3c7ba3
no-array-callback-reference
: Improve suggestions forArray#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
v26.0.1
Compare Source
prefer-math-trunc
: Use suggestion instead of auto-fix forx | 0
(#1014)74b1b2d
v26.0.0
Compare Source
New rules
no-new-array
(#992)48390c1
prefer-array-index-of
(#920)517a782
prefer-regexp-test
(#970)7b74b40
consistent-destructuring
(#325)32bd31c
Improvements
import-index
rule from recommended preset (#977)ff1cd2e
prefer-string-starts-ends-with
: Remove check onString#match()
(#1002)c9fa8b1
no-array-callback-reference
: IgnoreAwaitExpression
exceptreduce
andreduceRight
(#814)4c2b00b
Fixes
prefer-string-starts-ends-with
: Fix missing parentheses for some cases (#976)e2f94fe
??
operator LogicExpression as aboolean
value node (#986)dc7f79b
v25.0.1
Compare Source
v25.0.0
Compare Source
New rules
prefer-array-some
(#887)b6a5a50
prefer-default-parameters
(#632)8015768
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-iterator
→no-array-callback-reference
no-array-instanceof
→no-instanceof-array
no-reduce
→no-array-reduce
prefer-dataset
→prefer-dom-node-dataset
prefer-flat-map
→prefer-array-flat-map
prefer-replace-all
→prefer-string-replace-all
prefer-starts-ends-with
→prefer-string-starts-ends-with
prefer-text-content
→prefer-dom-node-text-content
prefer-trim-start-end
→prefer-string-trim-start-end
prefer-event-key
→prefer-keyboard-event-key
prefer-node-append
→prefer-dom-node-append
prefer-node-remove
→prefer-dom-node-remove
20c6341
Improvements
explicit-length-check
: Make rule work in many more cases (#943)f3bc798
explicit-length-check
: Check unsafeLogicalExpression
s (#952)a1b60ad
explicit-length-check
: CheckBoolean(foo.length)
(#951)f4577f7
explicit-length-check
: Check more cases (#941)83a6453
new-for-builtins
: IgnoreObject(x) === x
andObject(x) !== x
(#944)5c7ea92
explicit-length-check
: Rewrite rule (#938)94ae87a
v24.0.0
Compare Source
New rules
no-lonely-if
(#936)485dbf9
empty-brace-spaces
(#933)c137daa
prefer-date-now
(#935)d0c4826
Improvements
prevent-abbreviations
: Addignore
option (#891)898fcb4
no-useless-undefined
: AddcheckArguments
option (#877)a1617b9
consistent-function-scoping
: Allow ignoring arrow functions (#932)17bf27c
error-message
rule (#922)877bef9
prefer-query-selector
rule (#908)635601d
prevent-abbreviations
: Addvar
/vars
replacements (#894)07dadf5
prevent-abbreviations
: Addver
→version
replacement (#870)e755cdd
prefer-number-properties
: Supportcomputed
key ofClassProperty
MethodDefinition
Property
(#886)769ac35
prefer-optional-catch-binding
: Improve output (#884)375d11a
no-null
: ExcludeuseRef(null)
andReact.useRef(null)
(#890)7a4dbf4
prefer-number-properties
: AddInfinity
support (#874)643169b
no-console-spaces
: Improve report location (#866)190cbac
no-useless-undefined
: IgnoretoHaveBeenCalledWith
method (#876)d10a641
prefer-replace-all
: Handleu
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
false
import styles seen in reported problem messages (#910)d669707
import-style
: Fix crash onbabel-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 fornew String
,new Boolean()
, andnew Number()
(#907)dfc1ce0
v23.0.0
Compare Source
New rules
prefer-math-trunc
rule (#851)5ee2432
numeric-separators-style
rule (#833)6c9b531
prefer-ternary
rule (#514)d59cf95
Improvements
explicit-length-check
: Use'non-zero': 'greater-than'
by default (#850)7c5df5f
prevent-abbreviations
: Addfn
/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
85d424c
Fixes
prefer-flat-map
: Exclude.flat()
where depth is not1
(#859)61d9851
v22.0.0
Compare Source
New rules
import-style
rule (#789)0c7a199
Improvements
Children
inno-fn-reference-in-iterator
(#809)036e440
filename-case
: Ignore more index files (#826)64d03a5
ecmaVersion
to2021
(#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
v21.0.0
Compare Source
New rules
prefer-array-find
rule (#735)12b46da
no-object-as-default-parameter
rule (#633)9989d2d
Improvements
ev
toevent
default replacement toprevent-abbreviations
rule (#793)a0b4aba
no-fn-reference-in-iterator
andno-reduce
rule (#756)5159c24
unicorn/prefer-flat-map
not enabled by default in the recommended config655220a
consistent-function-scoping
report location (#778)df218a2
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
: Ignoreundefined
use in compare functions (#758)6d36407
v20.1.0
Compare Source
no-for-loop
rule (#745)2002093
no-for-loop
rule (#749)48bd5c8
v20.0.0
Compare Source
Breaking
e4f44f3
New rules
prefer-optional-catch-binding
rule (#671)efdb03a
no-useless-undefined
rule (#718)30dbe6d
no-reduce
rule (#704)06ed7ee
Improvements
throw-new-error
: CheckMemberExpression
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 withm
flag (#721)83bbabc
prefer-string-slice
: Handle negative length in.substr()
(#709)7439465
v19.0.1
Compare Source
no-fn-reference-in-iterator
: Ignorethis.
andVue.filter
(#699)b02a9c6
no-fn-reference-in-iterator
: Ignore cases obviously not a function reference (#697)dae5107
v19.0.0
Compare Source
New rules
no-null
rule (#636)c773c16
Breaking
string-content
: Make it have no default patterns (#637)08fad55
catch-error-name
: ReplacecaughtErrorsIgnorePattern
option with anignore
option (#661)5a27f04
Improvements
custom-error-definition
: Support class properties (#673)9cc8d60
catch-error-name
: SupportPromise#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 onthis.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
Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled due to failing status checks.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.