diff --git a/eslint.config.js b/eslint.config.js index b38057e8d..07aec990c 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -43,8 +43,8 @@ vendors/** const configs = [ { files: ["**/*.{js,mjs,cjs,jsx}"] }, eslintPluginJs.configs.recommended, - eslintPluginRegexp.configs["flat/recommended"], - eslintPluginUnicorn.configs["flat/recommended"], + eslintPluginRegexp.configs.recommended, + eslintPluginUnicorn.configs.recommended, eslintConfigPrettier, eslintConfigNodeStyleText, { @@ -58,7 +58,6 @@ const configs = [ "prettier-internal-rules": eslintPluginPrettierInternalRules, "simple-import-sort": eslintPluginSimpleImportSort, }, - rules: { "arrow-body-style": ["error", "as-needed"], curly: "error", @@ -250,26 +249,38 @@ const configs = [ "unicorn/escape-case": "off", "unicorn/filename-case": ["error", { checkDirectories: false }], "unicorn/import-style": "off", + "unicorn/max-nested-calls": "off", "unicorn/no-array-callback-reference": "off", "unicorn/no-array-method-this-argument": "off", "unicorn/no-array-reduce": "off", "unicorn/no-array-reverse": "off", "unicorn/no-array-sort": "off", "unicorn/no-await-expression-member": "off", + "unicorn/no-break-in-nested-loop": "off", + "unicorn/no-computed-property-existence-check": "off", // Disabled due to false positives "unicorn/no-declarations-before-early-exit": "off", "unicorn/no-for-loop": "off", + "unicorn/no-global-object-property-assignment": "off", "unicorn/no-hex-escape": "off", // Bug on `"\u{3000}"` "unicorn/no-incorrect-template-string-interpolation": "off", + "unicorn/no-invalid-argument-count": "off", "unicorn/no-negated-condition": "off", "unicorn/no-nested-ternary": "off", "unicorn/no-null": "off", "unicorn/no-process-exit": "off", "unicorn/no-thenable": "off", "unicorn/no-this-outside-of-class": "off", + "unicorn/no-top-level-side-effects": "off", + "unicorn/no-undeclared-class-members": "off", "unicorn/no-unreadable-array-destructuring": "off", + "unicorn/no-unreadable-new-expression": "off", + "unicorn/no-unreadable-object-destructuring": "off", "unicorn/no-unsafe-string-replacement": "off", + "unicorn/no-useless-concat": "off", + "unicorn/no-useless-fallback-in-spread": "off", + "unicorn/no-useless-recursion": "off", "unicorn/no-useless-switch-case": "off", "unicorn/no-useless-undefined": [ "error", @@ -292,9 +303,11 @@ const configs = [ getLastElementFunctions: ["getLast"], }, ], + "unicorn/prefer-await": "off", "unicorn/prefer-code-point": "off", "unicorn/prefer-dom-node-append": "off", "unicorn/prefer-dom-node-remove": "off", + "unicorn/prefer-early-return": "off", "unicorn/prefer-export-from": [ "error", { @@ -305,35 +318,17 @@ const configs = [ "unicorn/prefer-global-this": "off", "unicorn/prefer-https": "off", "unicorn/prefer-includes-over-repeated-comparisons": "off", + "unicorn/prefer-minimal-ternary": "off", "unicorn/prefer-query-selector": "off", + "unicorn/prefer-short-arrow-method": "off", "unicorn/prefer-ternary": "off", + "unicorn/prefer-unicode-code-point-escapes": "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/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-unreadable-object-destructuring": "off", - "unicorn/no-unreadable-new-expression": "off", - "unicorn/prefer-unicode-code-point-escapes": "off", - "unicorn/no-break-in-nested-loop": "off", - "unicorn/prefer-early-return": "off", - "unicorn/no-undeclared-class-members": "off", - "unicorn/no-useless-fallback-in-spread": "off", - "unicorn/no-useless-template-literals": "off", - "unicorn/no-global-object-property-assignment": "off", - "unicorn/prefer-await": "off", - "unicorn/no-top-level-side-effects": "off", }, - linterOptions: { reportUnusedDisableDirectives: "error", }, diff --git a/scripts/build/build.js b/scripts/build/build.js index 9cb8188a4..53717098a 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -100,7 +100,7 @@ async function buildFile({ packageConfig, file, cliOptions, results }) { prettyBytes(sizeDiff), ); - sizeMessages.push(`${message}`); + sizeMessages.push(message); } else { sizeMessages.push(styleText.blue("[NEW FILE]")); } diff --git a/scripts/build/esbuild-plugins/umd.js b/scripts/build/esbuild-plugins/umd.js index 3d309a94e..e5dae2ecc 100644 --- a/scripts/build/esbuild-plugins/umd.js +++ b/scripts/build/esbuild-plugins/umd.js @@ -12,7 +12,7 @@ function getUmdWrapper({ name }, build) { for (let index = 0; index < path.length; index++) { const object = ["root", ...path.slice(0, index + 1)].join("."); if (index === path.length - 1) { - globalObjectText.push(`${object}`); + globalObjectText.push(object); } else { globalObjectText.push(`${object} = ${object} || {};`); } diff --git a/scripts/release/steps/show-instructions-after-npm-publish.js b/scripts/release/steps/show-instructions-after-npm-publish.js index 1b9d05937..ebd88eebe 100644 --- a/scripts/release/steps/show-instructions-after-npm-publish.js +++ b/scripts/release/steps/show-instructions-after-npm-publish.js @@ -36,7 +36,7 @@ export default async function showInstructionsAfterNpmPublish({ next, }) { if (next) { - console.log(`${styleText.green.bold`Prettier ${version} published!`}`); + console.log(styleText.green.bold`Prettier ${version} published!`); await waitForEnter(); return; } diff --git a/src/cli/options/get-options-for-file.js b/src/cli/options/get-options-for-file.js index 3f2e668a5..667237f5e 100644 --- a/src/cli/options/get-options-for-file.js +++ b/src/cli/options/get-options-for-file.js @@ -121,8 +121,7 @@ async function getOptionsForFile(context, filepath) { }; context.logger.debug( - `applied config-precedence (${context.argv.configPrecedence}): ` + - `${JSON.stringify(appliedOptions)}`, + `applied config-precedence (${context.argv.configPrecedence}): ${JSON.stringify(appliedOptions)}`, ); if (hasPlugins) { diff --git a/tests/unit/get-parser-plugin-by-parser-name.js b/tests/unit/get-parser-plugin-by-parser-name.js index 5abf26404..a3791b6a8 100644 --- a/tests/unit/get-parser-plugin-by-parser-name.js +++ b/tests/unit/get-parser-plugin-by-parser-name.js @@ -28,7 +28,7 @@ describe("unit tests for getParserPluginByParserName", () => { { falsyValue: undefined }, { falsyValue: false }, ])("throws an error when parserName is $falsyValue", ({ falsyValue }) => { - const plugins = getMockPlugins(`${falsyValue}`); + const plugins = getMockPlugins(String(falsyValue)); expect(() => getParserPluginByParserName(plugins, falsyValue)).toThrow( "parserName is required.", ); diff --git a/tests/unit/get-printer-plugin-by-ast-format.js b/tests/unit/get-printer-plugin-by-ast-format.js index d257293c3..3c4807028 100644 --- a/tests/unit/get-printer-plugin-by-ast-format.js +++ b/tests/unit/get-printer-plugin-by-ast-format.js @@ -28,7 +28,7 @@ describe("unit tests for getPrinterPluginByAstFormat", () => { { falsyValue: undefined }, { falsyValue: false }, ])("throws an error when astFormat is $falsyValue", ({ falsyValue }) => { - const plugins = getMockPlugins(`${falsyValue}`); + const plugins = getMockPlugins(String(falsyValue)); expect(() => getPrinterPluginByAstFormat(plugins, falsyValue)).toThrow( "astFormat is required.", );