chore: udpate prettier to v3

This commit is contained in:
Nitin Kumar 2024-01-14 07:11:34 +05:30
parent 1f45925113
commit 412ae5425e
104 changed files with 518 additions and 499 deletions

View File

@ -208,9 +208,8 @@ class AssetModulesPlugin {
codeGenResult.data.get("fullContentHash")
});
} catch (e) {
/** @type {Error} */ (
e
).message += `\nduring rendering of asset ${module.identifier()}`;
/** @type {Error} */ (e).message +=
`\nduring rendering of asset ${module.identifier()}`;
throw e;
}
}

View File

@ -199,11 +199,18 @@ class IdleFileCachePlugin {
}s.`
);
}
idleTimer = setTimeout(() => {
idleTimer = setTimeout(
() => {
idleTimer = undefined;
isIdle = true;
resolvedPromise.then(processIdleTasks);
}, Math.min(isInitialStore ? idleTimeoutForInitialStore : Infinity, isLargeChange ? idleTimeoutAfterLargeChanges : Infinity, idleTimeout));
},
Math.min(
isInitialStore ? idleTimeoutForInitialStore : Infinity,
isLargeChange ? idleTimeoutAfterLargeChanges : Infinity,
idleTimeout
)
);
idleTimer.unref();
}
);

View File

@ -848,9 +848,8 @@ const applyOutputDefaults = (
} catch (e) {
if (/** @type {Error & { code: string }} */ (e).code !== "ENOENT") {
/** @type {Error & { code: string }} */
(
e
).message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`;
(e).message +=
`\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`;
throw e;
}
return "";

View File

@ -288,8 +288,7 @@ module.exports = function () {
updatedModules
);
return promises;
},
[])
}, [])
).then(function () {
return waitForBlockingPromises(function () {
if (applyOnUpdate) {

View File

@ -62,7 +62,8 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule {
Template.indent(
chunkIds
.map(
id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})`
id =>
`${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})`
)
.join(",\n")
),

View File

@ -236,7 +236,10 @@ const SIMPLE_PRINTERS = {
"modules"
)}`
: undefined,
"compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) =>
"compilation.filteredAssets": (
filteredAssets,
{ compilation: { assets } }
) =>
filteredAssets > 0
? `${moreCount(assets, filteredAssets)} ${plural(
filteredAssets,

View File

@ -451,11 +451,7 @@ exports.stringifyHoley = json => {
exports.parseVersionRuntimeCode = runtimeTemplate =>
`var parseVersion = ${runtimeTemplate.basicFunction("str", [
"// see webpack/lib/util/semver.js for original code",
`var p=${
runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"
}{return p.split(".").map((${
runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"
}{return+p==p?+p:p}))},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;`
`var p=${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return p.split(".").map((${runtimeTemplate.supportsArrowFunction() ? "p=>" : "function(p)"}{return+p==p?+p:p}))},n=/^([^-+]+)?(?:-([^+]+))?(?:\\+(.+))?$/.exec(str),r=n[1]?p(n[1]):[];return n[2]&&(r.length++,r.push.apply(r,p(n[2]))),n[3]&&(r.push([]),r.push.apply(r,p(n[3]))),r;`
])}`;
//#endregion

View File

@ -59,7 +59,7 @@
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-jsdoc": "^43.0.5",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.1.3",
"file-loader": "^6.0.0",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"hash-wasm": "^4.9.0",
@ -84,7 +84,7 @@
"mini-svg-data-uri": "^1.2.3",
"nyc": "^15.1.0",
"open-cli": "^7.2.0",
"prettier": "^2.7.1",
"prettier": "^3.2.1",
"pretty-format": "^29.5.0",
"pug": "^3.0.0",
"pug-loader": "^2.4.0",

View File

@ -634,9 +634,9 @@ const describeCases = config => {
) {
return testConfig.modules[module];
} else {
return require(module.startsWith("node:")
? module.slice(5)
: module);
return require(
module.startsWith("node:") ? module.slice(5) : module
);
}
};

View File

@ -348,10 +348,9 @@ const describeCases = config => {
let testConfig = {};
try {
// try to load a test file
testConfig = require(path.join(
testDirectory,
"test.config.js"
));
testConfig = require(
path.join(testDirectory, "test.config.js")
);
} catch (e) {
// empty
}

View File

@ -7,7 +7,6 @@ module.exports = {
},
plugins: [
new webpack.DllReferencePlugin({
// eslint-disable-next-line n/no-missing-require
manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"),
name: "../0-create-dll/dll.js",
scope: "dll",

View File

@ -7,7 +7,6 @@ module.exports = {
},
plugins: [
new webpack.DllReferencePlugin({
// eslint-disable-next-line n/no-missing-require
manifest: require("../../../js/config/dll-plugin-entry/manifest0.json"),
name: "../0-create-dll/dll.js",
scope: "dll",

View File

@ -4,7 +4,6 @@ var webpack = require("../../../../");
module.exports = {
plugins: [
new webpack.DllReferencePlugin({
// eslint-disable-next-line n/no-missing-require
manifest: require("../../../js/config/dll-plugin-side-effects/manifest0.json"),
name: "../0-create-dll/dll.js",
scope: "dll",

View File

@ -4,7 +4,6 @@ var webpack = require("../../../../");
module.exports = {
plugins: [
new webpack.DllReferencePlugin({
// eslint-disable-next-line n/no-missing-require
manifest: require("../../../js/config/dll-plugin/issue-10475.json"),
name: "../0-issue-10475/dll.js",
scope: "dll",

View File

@ -7,7 +7,6 @@ module.exports = {
},
plugins: [
new webpack.DllReferencePlugin({
// eslint-disable-next-line n/no-missing-require
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
name: "../0-create-dll/dll.js",
scope: "dll",

View File

@ -26,7 +26,6 @@ module.exports = {
},
plugins: [
new webpack.DllReferencePlugin({
// eslint-disable-next-line n/no-missing-require
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
name: "../0-create-dll/dll.js",
context: path.resolve(__dirname, "../0-create-dll"),

View File

@ -23,7 +23,6 @@ module.exports = {
},
plugins: [
new webpack.DllReferencePlugin({
// eslint-disable-next-line n/no-missing-require
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
name: "../0-create-dll/dll.js",
context: path.resolve(__dirname, "../0-create-dll"),

View File

@ -7,7 +7,6 @@ module.exports = {
},
plugins: [
new webpack.DllReferencePlugin({
// eslint-disable-next-line n/no-missing-require
manifest: require("../../../js/config/dll-plugin/manifest0.json"),
name: "../0-create-dll-with-contenthash/dll.js",
scope: "dll",

View File

@ -75,8 +75,8 @@ exports.${name}RuntimeCode = runtimeTemplate => \`var ${name} = \${runtimeTempla
match = regexp.exec(content);
}
const prettierConfig = prettier.resolveConfig.sync(filePath);
const newContent = prettier.format(
const prettierConfig = await prettier.resolveConfig(filePath);
const newContent = await prettier.format(
content.replace(regexp, match => replaces.get(match)),
{ filepath: filePath, ...prettierConfig }
);

View File

@ -1024,6 +1024,11 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
"@pkgr/core@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.0.tgz#7d8dacb7fdef0e4387caf7396cbd77f179867d06"
integrity sha512-Zwq5OCzuwJC2jwqmpEQt7Ds1DTi6BWSwoGkbb1n9pO3hzb35BoJELx7c0T23iDkBGkh2e7tvOtjF3tr3OaQHDQ==
"@sinclair/typebox@^0.27.8":
version "0.27.8"
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e"
@ -2692,12 +2697,13 @@ eslint-plugin-n@^16.6.2:
resolve "^1.22.2"
semver "^7.5.3"
eslint-plugin-prettier@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==
eslint-plugin-prettier@^5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1"
integrity sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==
dependencies:
prettier-linter-helpers "^1.0.0"
synckit "^0.8.6"
eslint-scope@5.1.1, eslint-scope@^5.1.1:
version "5.1.1"
@ -5132,11 +5138,16 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
prettier@^2.0.5, prettier@^2.7.1:
prettier@^2.0.5:
version "2.8.8"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
prettier@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.1.tgz#babf33580e16c796a9740b9fae551624f7bfeaab"
integrity sha512-qSUWshj1IobVbKc226Gw2pync27t0Kf0EdufZa9j7uBSJay1CC+B3K5lAAZoqgX3ASiKuWsk6OmzKRetXNObWg==
pretty-format@^29.0.0, pretty-format@^29.5.0, pretty-format@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
@ -5945,6 +5956,14 @@ supports-preserve-symlinks-flag@^1.0.0:
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
synckit@^0.8.6:
version "0.8.8"
resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7"
integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==
dependencies:
"@pkgr/core" "^0.1.0"
tslib "^2.6.2"
tapable@^2.1.1, tapable@^2.2.0, tapable@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
@ -6117,6 +6136,11 @@ tslib@^2.1.0, tslib@^2.3.0, tslib@^2.5.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
tslib@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"