diff --git a/benchmarks/string-concatenation.js b/benchmarks/string-concatenation.js index c795d42a1..fc6e59fbd 100644 --- a/benchmarks/string-concatenation.js +++ b/benchmarks/string-concatenation.js @@ -13,6 +13,7 @@ for (const size of [1e1, 1e2, 1e3, 1e4, 1e5]) { { "Array#join()"() { const result = []; + // eslint-disable-next-line unicorn/prefer-spread for (const string of strings) { result.push(string); } diff --git a/eslint.config.js b/eslint.config.js index a3dc38994..ab63cd5b0 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -240,6 +240,7 @@ const configs = [ /* eslint-plugin-unicorn */ "unicorn/better-dom-traversing": "off", "unicorn/catch-error-name": "off", + "unicorn/consistent-class-member-order": "off", "unicorn/consistent-compound-words": "off", "unicorn/consistent-destructuring": "off", "unicorn/consistent-function-scoping": "off", @@ -262,6 +263,7 @@ const configs = [ "unicorn/no-thenable": "off", "unicorn/no-this-outside-of-class": "off", "unicorn/no-unreadable-array-destructuring": "off", + "unicorn/no-unsafe-string-replacement": "off", "unicorn/no-useless-switch-case": "off", "unicorn/no-useless-undefined": [ "error", @@ -293,6 +295,7 @@ const configs = [ checkUsedVariables: false, }, ], + "unicorn/prefer-global-number-constants": "off", "unicorn/prefer-global-this": "off", "unicorn/prefer-https": "off", "unicorn/prefer-includes-over-repeated-comparisons": "off", @@ -300,8 +303,45 @@ const configs = [ "unicorn/prefer-ternary": "off", "unicorn/prevent-abbreviations": "off", "unicorn/relative-url-style": "off", + "unicorn/require-array-sort-compare": "off", "unicorn/switch-case-braces": ["error", "avoid"], "unicorn/template-indent": "error", + + // TODO: Enable the followings + "unicorn/comment-content": "off", + "unicorn/prefer-short-arrow-method": "off", + "unicorn/no-useless-concat": "off", + "unicorn/no-computed-property-existence-check": "off", + "unicorn/no-useless-recursion": "off", + "unicorn/prefer-minimal-ternary": "off", + "unicorn/max-nested-calls": "off", + "unicorn/no-invalid-argument-count": "off", + "unicorn/no-useless-else": "off", + "unicorn/no-unreadable-object-destructuring": "off", + "unicorn/no-unreadable-new-expression": "off", + "unicorn/prefer-unicode-code-point-escapes": "off", + "unicorn/no-negated-array-predicate": "off", + "unicorn/no-break-in-nested-loop": "off", + "unicorn/no-duplicate-loops": "off", + "unicorn/no-declarations-before-early-exit": "off", + "unicorn/no-negated-comparison": "off", + "unicorn/prefer-early-return": "off", + "unicorn/prefer-number-is-safe-integer": "off", + "unicorn/no-undeclared-class-members": "off", + "unicorn/no-useless-boolean-cast": "off", + "unicorn/no-useless-fallback-in-spread": "off", + "unicorn/no-unnecessary-splice": "off", + "unicorn/no-useless-template-literals": "off", + "unicorn/no-global-object-property-assignment": "off", + "unicorn/prefer-await": "off", + "unicorn/prefer-number-coercion": "off", + "unicorn/no-top-level-side-effects": "off", + "unicorn/no-return-array-push": "off", + "unicorn/prefer-array-from-map": "off", + "unicorn/no-error-property-assignment": "off", + "unicorn/prefer-iterator-to-array": "off", + // Bug on `"\u{3000}"` + "unicorn/no-incorrect-template-string-interpolation": "off", }, linterOptions: { diff --git a/package.json b/package.json index 28cf78126..31028057d 100644 --- a/package.json +++ b/package.json @@ -160,7 +160,7 @@ "eslint-plugin-n": "18.1.0", "eslint-plugin-regexp": "3.1.0", "eslint-plugin-simple-import-sort": "13.0.0", - "eslint-plugin-unicorn": "65.0.0", + "eslint-plugin-unicorn": "66.0.0", "esm-utils": "4.4.2", "get-port": "7.2.0", "gfm-test-suite": "0.0.2", diff --git a/scripts/tools/eslint-plugin-prettier-internal-rules/no-identifier-n.js b/scripts/tools/eslint-plugin-prettier-internal-rules/no-identifier-n.js index f80c164b9..73902c1d3 100644 --- a/scripts/tools/eslint-plugin-prettier-internal-rules/no-identifier-n.js +++ b/scripts/tools/eslint-plugin-prettier-internal-rules/no-identifier-n.js @@ -48,7 +48,7 @@ export default { } }, "Program:exit"() { - for (const [variable, { fixable }] of variables.entries()) { + for (const [variable, { fixable }] of variables) { const [node] = variable.identifiers; const fix = function* (fixer) { diff --git a/src/main/core.js b/src/main/core.js index 5f51b86bf..04b0e20bd 100644 --- a/src/main/core.js +++ b/src/main/core.js @@ -149,7 +149,6 @@ async function coreFormat(originalText, opts, addAlignmentSize = 0) { // diff old and new cursor node texts, with a special cursor // symbol inserted to find out where it moves to - // eslint-disable-next-line unicorn/prefer-spread const oldCursorNodeCharArray = oldCursorRegionText.split(""); oldCursorNodeCharArray.splice( cursorOffsetRelativeToOldCursorRegionStart, @@ -157,7 +156,6 @@ async function coreFormat(originalText, opts, addAlignmentSize = 0) { CURSOR, ); - // eslint-disable-next-line unicorn/prefer-spread const newCursorNodeCharArray = newCursorRegionText.split(""); const cursorNodeDiff = diffArrays( oldCursorNodeCharArray, diff --git a/yarn.lock b/yarn.lock index 6b4a8e1ad..5e33cb407 100644 --- a/yarn.lock +++ b/yarn.lock @@ -165,7 +165,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.25.9, @babel/helper-validator-identifier@npm:^7.28.5, @babel/helper-validator-identifier@npm:^7.29.7": +"@babel/helper-validator-identifier@npm:^7.25.9, @babel/helper-validator-identifier@npm:^7.29.7": version: 7.29.7 resolution: "@babel/helper-validator-identifier@npm:7.29.7" checksum: 10/2efa42701eb05babf26dff3332109c9e5e1a3400a71fb9e68ee27af28235036a2a72c2494c04bdab3f909075f42a58b2e8271074372bc7f8e79ec02bd364d7a7 @@ -3362,7 +3362,7 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:4.28.2, browserslist@npm:^4.24.0, browserslist@npm:^4.25.2, browserslist@npm:^4.28.1": +"browserslist@npm:4.28.2, browserslist@npm:^4.24.0, browserslist@npm:^4.25.2, browserslist@npm:^4.28.1, browserslist@npm:^4.28.2": version: 4.28.2 resolution: "browserslist@npm:4.28.2" dependencies: @@ -4481,28 +4481,29 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-unicorn@npm:65.0.0": - version: 65.0.0 - resolution: "eslint-plugin-unicorn@npm:65.0.0" +"eslint-plugin-unicorn@npm:66.0.0": + version: 66.0.0 + resolution: "eslint-plugin-unicorn@npm:66.0.0" dependencies: - "@babel/helper-validator-identifier": "npm:^7.28.5" + "@babel/helper-validator-identifier": "npm:^7.29.7" "@eslint-community/eslint-utils": "npm:^4.9.1" + browserslist: "npm:^4.28.2" change-case: "npm:^5.4.4" ci-info: "npm:^4.4.0" core-js-compat: "npm:^3.49.0" detect-indent: "npm:^7.0.2" find-up-simple: "npm:^1.0.1" - globals: "npm:^17.4.0" + globals: "npm:^17.6.0" indent-string: "npm:^5.0.0" is-builtin-module: "npm:^5.0.0" jsesc: "npm:^3.1.0" pluralize: "npm:^8.0.0" - regjsparser: "npm:^0.13.0" - semver: "npm:^7.7.4" + regjsparser: "npm:^0.13.1" + semver: "npm:^7.8.4" strip-indent: "npm:^4.1.1" peerDependencies: - eslint: ">=9.38.0" - checksum: 10/1c303889522994b50b48d16ebe8f2df0cfddb0d4fe366681c9519f1cc9d875bf86f67266837777e7f3bcebbb3cb9e68e610d7ba718218ff59071fcad55f02c43 + eslint: ">=10.4" + checksum: 10/7cc02b67616d2f5415792b7c20178513d01ab857ae2a8794ff3b85ebb0ae3b3b85a344426910b8345fd52371c96d2986ab0469a6859bef7ce3f1e19dad0187f8 languageName: node linkType: hard @@ -5189,7 +5190,7 @@ __metadata: languageName: node linkType: hard -"globals@npm:17.6.0, globals@npm:^17.4.0": +"globals@npm:17.6.0, globals@npm:^17.6.0": version: 17.6.0 resolution: "globals@npm:17.6.0" checksum: 10/2bf0febf31c942edee6f4eca7e939a9c885f8ecfb767048b1c4dd2a32008d0ab136e6076665d76b44b29c2571bbbc1681371caab05fd8ee0067c7618e841b89d @@ -8122,7 +8123,7 @@ __metadata: eslint-plugin-n: "npm:18.1.0" eslint-plugin-regexp: "npm:3.1.0" eslint-plugin-simple-import-sort: "npm:13.0.0" - eslint-plugin-unicorn: "npm:65.0.0" + eslint-plugin-unicorn: "npm:66.0.0" esm-utils: "npm:4.4.2" espree: "npm:11.2.0" fast-glob: "npm:3.3.3" @@ -8390,14 +8391,14 @@ __metadata: languageName: node linkType: hard -"regjsparser@npm:^0.13.0": - version: 0.13.1 - resolution: "regjsparser@npm:0.13.1" +"regjsparser@npm:^0.13.1": + version: 0.13.2 + resolution: "regjsparser@npm:0.13.2" dependencies: jsesc: "npm:~3.1.0" bin: regjsparser: bin/parser - checksum: 10/3383e9dab8bc8cd09efcd9538191b1e194b1921438ca69fce833d1a447d0625635229464cbc6cb03f33e5d342f2d343e2738fdac9132e2470bca621e480c02ec + checksum: 10/291aecbd47371cee347a96c47ccaae729ba50b7b2cb2a5de7e088e2ab835fe133569422f06ae28f5ff0830ac03f3196a35ba493f23ecda086d82e3e326f14074 languageName: node linkType: hard @@ -8545,7 +8546,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.8.4, semver@npm:^7.3.5, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.2, semver@npm:^7.6.3, semver@npm:^7.7.2, semver@npm:^7.7.3, semver@npm:^7.7.4, semver@npm:^7.8.1": +"semver@npm:7.8.4, semver@npm:^7.3.5, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.2, semver@npm:^7.6.3, semver@npm:^7.7.2, semver@npm:^7.7.3, semver@npm:^7.7.4, semver@npm:^7.8.1, semver@npm:^7.8.4": version: 7.8.4 resolution: "semver@npm:7.8.4" bin: