Skip to content

Commit

Permalink
update eslint-plugin-unicorn
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jun 14, 2024
1 parent a5b9e0d commit ad14155
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions scripts/bundle-package/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions scripts/bundle-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/compat/common-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GLOBAL.showResults = function (engine, logger) {
function logResults(showDifference) {
for (var name in results) {
if (data[name]) {
if (!!data[name][engine] === results[name]) {
if (Boolean(data[name][engine]) === results[name]) {

This comment has been minimized.

Copy link
@zloirock

zloirock Jun 14, 2024

Author Owner

@fisker I'm still banned in the eslint-plugin-unicorn repo, so let's report it here again.

In this case, results[name] could be true or false, data[name][engine] - something like '42' or undefined. !! is a common shorthand for boolean conversion. But unicorn/no-negation-in-equality-check reports an error here.

It could be good to add !!foo === bar to exceptions or add an option for that.

This comment has been minimized.

Copy link
@fisker

fisker Jun 14, 2024

Sure, I can add an option.

This comment has been minimized.

Copy link
@fisker

fisker Jun 14, 2024

if (showDifference) continue;
} else difference = true;
} else if (showDifference) continue;
Expand Down
4 changes: 3 additions & 1 deletion tests/eslint/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ const base = {
'unicorn/no-lonely-if': ERROR,
// disallow a magic number as the depth argument in `Array#flat`
'unicorn/no-magic-array-flat-depth': ERROR,
// disallow negated expression in equality check
'unicorn/no-negation-in-equality-check': ERROR,
// enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`
'unicorn/no-new-buffer': ERROR,
// disallow passing single-element arrays to `Promise` methods
Expand Down Expand Up @@ -602,7 +604,7 @@ const base = {
hexadecimal: { minimumDigits: 0, groupLength: 2 },
}],
// prefer `.find()` over the first element from `.filter()`
'unicorn/prefer-array-find': ERROR,
'unicorn/prefer-array-find': [ERROR, { checkFromLast: true }],
// use `.flat()` to flatten an array of arrays
'unicorn/prefer-array-flat': ERROR,
// use `.flatMap()` to map and then flatten an array instead of using `.map().flat()`
Expand Down
20 changes: 10 additions & 10 deletions tests/eslint/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"eslint-plugin-redos": "^4.5.0-beta.6",
"eslint-plugin-regexp": "^2.6.0",
"eslint-plugin-sonarjs": "^1.0.3",
"eslint-plugin-unicorn": "^53.0.0",
"eslint-plugin-unicorn": "^54.0.0",
"globals": "^15.4.0",
"jsonc-eslint-parser": "^2.4.0"
}
Expand Down
6 changes: 3 additions & 3 deletions tests/observables/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ad14155

Please sign in to comment.