diff --git a/package.json b/package.json index 85deee0a2..0d9a2f4a6 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "eslint-plugin-n": "17.23.1", "eslint-plugin-regexp": "2.10.0", "eslint-plugin-simple-import-sort": "12.1.1", - "eslint-plugin-unicorn": "61.0.2", + "eslint-plugin-unicorn": "62.0.0", "esm-utils": "4.4.2", "globals": "16.4.0", "jest": "30.2.0", diff --git a/scripts/build-website.js b/scripts/build-website.js index 43c38857a..d9867ac3b 100644 --- a/scripts/build-website.js +++ b/scripts/build-website.js @@ -74,34 +74,33 @@ async function buildPlaygroundFiles() { prettier: { file: "prettier/standalone.mjs", }, + plugins: await Promise.all( + pluginFiles.map(async (file) => { + const plugin = { file }; + + const pluginModule = await import( + url.pathToFileURL(path.join(PACKAGES_DIRECTORY, file)) + ); + + for (const property of ["languages", "options", "defaultOptions"]) { + const value = pluginModule[property]; + if (value !== undefined) { + plugin[property] = value; + } + } + + for (const property of ["parsers", "printers"]) { + const value = pluginModule[property]; + if (value !== undefined) { + plugin[property] = Object.keys(value); + } + } + + return plugin; + }), + ), }; - packageManifest.plugins = await Promise.all( - pluginFiles.map(async (file) => { - const plugin = { file }; - - const pluginModule = await import( - url.pathToFileURL(path.join(PACKAGES_DIRECTORY, file)) - ); - - for (const property of ["languages", "options", "defaultOptions"]) { - const value = pluginModule[property]; - if (value !== undefined) { - plugin[property] = value; - } - } - - for (const property of ["parsers", "printers"]) { - const value = pluginModule[property]; - if (value !== undefined) { - plugin[property] = Object.keys(value); - } - } - - return plugin; - }), - ); - await Promise.all([ ...[packageManifest.prettier, ...packageManifest.plugins].map(({ file }) => copyFile( diff --git a/scripts/build/config.js b/scripts/build/config.js index 8042e329f..754b4d0ff 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -303,7 +303,7 @@ const pluginFiles = [ // Remove `'property' in typescript` check text = text.replaceAll( new RegExp( - `".*?" in (?:${typescriptVariables.join("|")})(?=\\W)`, + String.raw`".*?" in (?:${typescriptVariables.join("|")})(?=\W)`, "gu", ), "true", diff --git a/src/language-html/embed/vue-v-for-directive.js b/src/language-html/embed/vue-v-for-directive.js index 5ed2f6269..5c0d80663 100644 --- a/src/language-html/embed/vue-v-for-directive.js +++ b/src/language-html/embed/vue-v-for-directive.js @@ -47,8 +47,7 @@ function parseVueVForDirective(value) { return; } - const res = {}; - res.for = inMatch[3].trim(); + const res = { for: inMatch[3].trim() }; if (!res.for) { return; } diff --git a/src/language-html/print/element.js b/src/language-html/print/element.js index c417ac9ee..9e2fe46ed 100644 --- a/src/language-html/print/element.js +++ b/src/language-html/print/element.js @@ -139,7 +139,7 @@ function printElement(path, options, print) { node.isWhitespaceSensitive && node.isIndentationSensitive)) && new RegExp( - `\\n[\\t ]{${options.tabWidth * (path.ancestors.length - 1)}}$`, + String.raw`\n[\t ]{${options.tabWidth * (path.ancestors.length - 1)}}$`, "u", ).test(node.lastChild.value) ) { diff --git a/src/language-js/print/jsx.js b/src/language-js/print/jsx.js index eda787f60..20e8eeb3f 100644 --- a/src/language-js/print/jsx.js +++ b/src/language-js/print/jsx.js @@ -713,9 +713,8 @@ function shouldPrintBracketSameLine(node, options, nameHasComments) { function printJsxClosingElement(path, options, print) { const { node } = path; - const parts = []; - - parts.push(" `\\p{General_Category=${charset}}`, + (charset) => String.raw`\p{General_Category=${charset}}`, "\u{ff5e}", // Used as a substitute for U+301C in Windows ), ].join("|")})`, diff --git a/src/utils/pragma/pragma.evaluate.js b/src/utils/pragma/pragma.evaluate.js index d927185ae..fddc57cb1 100644 --- a/src/utils/pragma/pragma.evaluate.js +++ b/src/utils/pragma/pragma.evaluate.js @@ -48,8 +48,8 @@ export const [MARKDOWN_HAS_PRAGMA_REGEXP, MARKDOWN_HAS_IGNORE_PRAGMA_REGEXP] = [ const pragma = `@(?:${pragmas.join("|")})`; return new RegExp( [ - ``, - `\\{\\s*\\/\\*\\s*${pragma}\\s*\\*\\/\\s*\\}`, + String.raw``, + String.raw`\{\s*\/\*\s*${pragma}\s*\*\/\s*\}`, ``, ].join("|"), "mu", diff --git a/yarn.lock b/yarn.lock index 700d8cd50..206ecb69e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -166,10 +166,10 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.25.9, @babel/helper-validator-identifier@npm:^7.27.1": - version: 7.27.1 - resolution: "@babel/helper-validator-identifier@npm:7.27.1" - checksum: 10/75041904d21bdc0cd3b07a8ac90b11d64cd3c881e89cb936fa80edd734bf23c35e6bd1312611e8574c4eab1f3af0f63e8a5894f4699e9cfdf70c06fcf4252320 +"@babel/helper-validator-identifier@npm:^7.25.9, @babel/helper-validator-identifier@npm:^7.27.1, @babel/helper-validator-identifier@npm:^7.28.5": + version: 7.28.5 + resolution: "@babel/helper-validator-identifier@npm:7.28.5" + checksum: 10/8e5d9b0133702cfacc7f368bf792f0f8ac0483794877c6dca5fcb73810ee138e27527701826fb58a40a004f3a5ec0a2f3c3dd5e326d262530b119918f3132ba7 languageName: node linkType: hard @@ -1401,15 +1401,6 @@ __metadata: languageName: node linkType: hard -"@eslint/core@npm:^0.15.2": - version: 0.15.2 - resolution: "@eslint/core@npm:0.15.2" - dependencies: - "@types/json-schema": "npm:^7.0.15" - checksum: 10/41d6273bbc6897cca34a2ca4e80a24bf6f1d43519456ebaa3c38f187da2d9e06f442c64f6e2a2813f055dce35e5cea33a21d0ac3b5b0830b7165641c640faf5d - languageName: node - linkType: hard - "@eslint/core@npm:^0.16.0": version: 0.16.0 resolution: "@eslint/core@npm:0.16.0" @@ -1450,16 +1441,6 @@ __metadata: languageName: node linkType: hard -"@eslint/plugin-kit@npm:^0.3.3": - version: 0.3.5 - resolution: "@eslint/plugin-kit@npm:0.3.5" - dependencies: - "@eslint/core": "npm:^0.15.2" - levn: "npm:^0.4.1" - checksum: 10/b8552d79c3091446b07d8b87a9a8ccb8cdee4d933c0ed46b8f61029c3382246fec8d04ea7d1e61656d9275263205ccaa40019fd7581bbce897eca3eda42d5dad - languageName: node - linkType: hard - "@eslint/plugin-kit@npm:^0.4.0": version: 0.4.0 resolution: "@eslint/plugin-kit@npm:0.4.0" @@ -3387,7 +3368,7 @@ __metadata: languageName: node linkType: hard -"ci-info@npm:4.3.1, ci-info@npm:^4.2.0, ci-info@npm:^4.3.0": +"ci-info@npm:4.3.1, ci-info@npm:^4.2.0, ci-info@npm:^4.3.1": version: 4.3.1 resolution: "ci-info@npm:4.3.1" checksum: 10/9dc952bef67e665ccde2e7a552d42d5d095529d21829ece060a00925ede2dfa136160c70ef2471ea6ed6c9b133218b47c007f56955c0f1734a2e57f240aa7445 @@ -3575,7 +3556,7 @@ __metadata: languageName: node linkType: hard -"core-js-compat@npm:^3.44.0": +"core-js-compat@npm:^3.46.0": version: 3.46.0 resolution: "core-js-compat@npm:3.46.0" dependencies: @@ -4365,31 +4346,31 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-unicorn@npm:61.0.2": - version: 61.0.2 - resolution: "eslint-plugin-unicorn@npm:61.0.2" +"eslint-plugin-unicorn@npm:62.0.0": + version: 62.0.0 + resolution: "eslint-plugin-unicorn@npm:62.0.0" dependencies: - "@babel/helper-validator-identifier": "npm:^7.27.1" - "@eslint-community/eslint-utils": "npm:^4.7.0" - "@eslint/plugin-kit": "npm:^0.3.3" + "@babel/helper-validator-identifier": "npm:^7.28.5" + "@eslint-community/eslint-utils": "npm:^4.9.0" + "@eslint/plugin-kit": "npm:^0.4.0" change-case: "npm:^5.4.4" - ci-info: "npm:^4.3.0" + ci-info: "npm:^4.3.1" clean-regexp: "npm:^1.0.0" - core-js-compat: "npm:^3.44.0" + core-js-compat: "npm:^3.46.0" esquery: "npm:^1.6.0" find-up-simple: "npm:^1.0.1" - globals: "npm:^16.3.0" + globals: "npm:^16.4.0" indent-string: "npm:^5.0.0" is-builtin-module: "npm:^5.0.0" jsesc: "npm:^3.1.0" pluralize: "npm:^8.0.0" regexp-tree: "npm:^0.1.27" - regjsparser: "npm:^0.12.0" - semver: "npm:^7.7.2" - strip-indent: "npm:^4.0.0" + regjsparser: "npm:^0.13.0" + semver: "npm:^7.7.3" + strip-indent: "npm:^4.1.1" peerDependencies: - eslint: ">=9.29.0" - checksum: 10/bafc0659849694d55edfb7b72b4350b00070acd8ceb2048457e63783036312557742208ae6c72bd41db866dcf1aae11ab01b5d701a9201b0cbdc01d9ff384396 + eslint: ">=9.38.0" + checksum: 10/bae4fee1f9e65c0d7f3b6b59b46a1963393434956ebc5860281ff7141a4d4b494cf4d9db966d3fcf5baffbbfb2e92cec4864ba8de0af7c73a3ca1ba789827525 languageName: node linkType: hard @@ -5012,7 +4993,7 @@ __metadata: languageName: node linkType: hard -"globals@npm:16.4.0, globals@npm:^16.3.0": +"globals@npm:16.4.0, globals@npm:^16.4.0": version: 16.4.0 resolution: "globals@npm:16.4.0" checksum: 10/1627a9f42fb4c82d7af6a0c8b6cd616e00110908304d5f1ddcdf325998f3aed45a4b29d8a1e47870f328817805263e31e4f1673f00022b9c2b210552767921cf @@ -6130,7 +6111,7 @@ __metadata: languageName: node linkType: hard -"jsesc@npm:^3.0.2, jsesc@npm:^3.1.0": +"jsesc@npm:^3.0.2, jsesc@npm:^3.1.0, jsesc@npm:~3.1.0": version: 3.1.0 resolution: "jsesc@npm:3.1.0" bin: @@ -6139,15 +6120,6 @@ __metadata: languageName: node linkType: hard -"jsesc@npm:~3.0.2": - version: 3.0.2 - resolution: "jsesc@npm:3.0.2" - bin: - jsesc: bin/jsesc - checksum: 10/8e5a7de6b70a8bd71f9cb0b5a7ade6a73ae6ab55e697c74cc997cede97417a3a65ed86c36f7dd6125fe49766e8386c845023d9e213916ca92c9dfdd56e2babf3 - languageName: node - linkType: hard - "json-buffer@npm:3.0.1": version: 3.0.1 resolution: "json-buffer@npm:3.0.1" @@ -7321,7 +7293,7 @@ __metadata: eslint-plugin-n: "npm:17.23.1" eslint-plugin-regexp: "npm:2.10.0" eslint-plugin-simple-import-sort: "npm:12.1.1" - eslint-plugin-unicorn: "npm:61.0.2" + eslint-plugin-unicorn: "npm:62.0.0" esm-utils: "npm:4.4.2" espree: "npm:10.4.0" fast-glob: "npm:3.3.3" @@ -7564,14 +7536,14 @@ __metadata: languageName: node linkType: hard -"regjsparser@npm:^0.12.0": - version: 0.12.0 - resolution: "regjsparser@npm:0.12.0" +"regjsparser@npm:^0.13.0": + version: 0.13.0 + resolution: "regjsparser@npm:0.13.0" dependencies: - jsesc: "npm:~3.0.2" + jsesc: "npm:~3.1.0" bin: regjsparser: bin/parser - checksum: 10/c2d6506b3308679de5223a8916984198e0493649a67b477c66bdb875357e3785abbf3bedf7c5c2cf8967d3b3a7bdf08b7cbd39e65a70f9e1ffad584aecf5f06a + checksum: 10/eeaabd3454f59394cbb3bfeb15fd789e638040f37d0bee9071a9b0b85524ddc52b5f7aaaaa4847304c36fa37429e53d109c4dbf6b878cb5ffa4f4198c1042fb7 languageName: node linkType: hard @@ -7747,7 +7719,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.7.3, semver@npm:^7.3.5, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.2, semver@npm:^7.6.3, semver@npm:^7.7.2": +"semver@npm:7.7.3, semver@npm:^7.3.5, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.2, semver@npm:^7.6.3, semver@npm:^7.7.2, semver@npm:^7.7.3": version: 7.7.3 resolution: "semver@npm:7.7.3" bin: @@ -8114,7 +8086,7 @@ __metadata: languageName: node linkType: hard -"strip-indent@npm:^4.0.0": +"strip-indent@npm:^4.1.1": version: 4.1.1 resolution: "strip-indent@npm:4.1.1" checksum: 10/d322bfdc59855006791a4aebe2a66e0892eab7004a5c064d74b86a0c6ecff2818974c9a5eda54b16d8af6aadbc90a6c02635ffcbec11ab33dd8979b1a6346fc0