Skip to content

fix: nonsensible intersection #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/AliasFieldPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ module.exports = class AliasFieldPlugin {
if (fieldData === null || typeof fieldData !== "object") {
if (resolveContext.log) {
resolveContext.log(
`Field '${
this.field
}' doesn't contain a valid alias configuration`,
`Field '${this.field}' doesn't contain a valid alias configuration`,
);
}
return callback();
Expand Down
4 changes: 1 addition & 3 deletions lib/AliasPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ module.exports = class AliasPlugin {
return resolver.doResolve(
target,
obj,
`aliased with mapping '${item.name}': '${alias}' to '${
newRequestStr
}'`,
`aliased with mapping '${item.name}': '${alias}' to '${newRequestStr}'`,
resolveContext,
(err, result) => {
if (err) return callback(err);
Expand Down
8 changes: 4 additions & 4 deletions lib/DescriptionFilePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ module.exports = class DescriptionFilePlugin {
}
return callback();
}
const relativePath = `.${path.slice(result.directory.length).replace(/\\/g, "/")}`;
const relativePath = `.${path
.slice(result.directory.length)
.replace(/\\/g, "/")}`;
/** @type {ResolveRequest} */
const obj = {
...request,
Expand All @@ -78,9 +80,7 @@ module.exports = class DescriptionFilePlugin {
resolver.doResolve(
target,
obj,
`using description file: ${result.path} (relative path: ${
relativePath
})`,
`using description file: ${result.path} (relative path: ${relativePath})`,
resolveContext,
(err, result) => {
if (err) return callback(err);
Expand Down
5 changes: 4 additions & 1 deletion lib/DescriptionFileUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ function getField(content, field) {
current = null;
break;
}
current = /** @type {JsonObject} */ (current)[field[j]];
current = /** @type {JsonValue} */ (
/** @type {JsonObject} */
(current)[field[j]]
);
}
return current;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/LogInfoPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ module.exports = class LogInfoPlugin {
}
if (request.relativePath) {
log(
`${prefix}Relative path from description file is: ${
request.relativePath
}`,
`${prefix}Relative path from description file is: ${request.relativePath}`,
);
}
callback();
Expand Down
8 changes: 4 additions & 4 deletions lib/Resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const {
/** @typedef {string | number | boolean | null} JsonPrimitive */
/** @typedef {JsonValue[]} JsonArray */
/** @typedef {JsonPrimitive | JsonObject | JsonArray} JsonValue */
/** @typedef {{[Key in string]: JsonValue} & {[Key in string]?: JsonValue | undefined}} JsonObject */
/** @typedef {{ [Key in string]?: JsonValue | undefined }} JsonObject */

// eslint-disable-next-line jsdoc/require-property
/** @typedef {object} Context */
Expand Down Expand Up @@ -365,9 +365,9 @@ class Resolver {
static createStackEntry(hook, request) {
return `${hook.name}: (${request.path}) ${request.request || ""}${
request.query || ""
}${request.fragment || ""}${
request.directory ? " directory" : ""
}${request.module ? " module" : ""}`;
}${request.fragment || ""}${request.directory ? " directory" : ""}${
request.module ? " module" : ""
}`;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@
"homepage": "http://github.com/webpack/enhanced-resolve",
"scripts": {
"prepare": "husky install",
"lint": "yarn lint:code && yarn lint:types && yarn lint:types-test && yarn lint:special && yarn lint:spellcheck",
"lint": "yarn lint:code && yarn lint:types && yarn lint:types-test && yarn lint:special && yarn fmt:check && yarn lint:spellcheck",
"lint:code": "eslint --cache .",
"lint:special": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-file-header && node node_modules/tooling/generate-types",
"lint:types": "tsc",
"lint:types-test": "tsc -p tsconfig.types.test.json",
"lint:spellcheck": "cspell --no-must-find-files \"**/*.*\"",
"fmt": "yarn fmt:base --loglevel warn --write",
"fmt:check": "yarn fmt:base --check",
"fmt:base": "prettier --cache --ignore-unknown .",
"fmt:base": "node_modules/prettier/bin/prettier.cjs --cache --ignore-unknown .",
"fix": "yarn fix:code && yarn fix:special",
"fix:code": "yarn lint:code --fix",
"fix:special": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/generate-types --write",
"type-report": "rimraf coverage && yarn cover:types && yarn cover:report && open-cli coverage/lcov-report/index.html",
"pretest": "yarn lintqqq",
"pretest": "yarn lint",
"test": "yarn test:coverage",
"test:only": "jest",
"test:watch": "yarn test:only --watch",
Expand Down
4 changes: 1 addition & 3 deletions test/missing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ describe("missing", () => {
resolve(testCase[0], testCase[1], { missingDependencies }, callback);
});

it(`should report error details exactly once when trying to resolve ${
testCase[1]
}`, (done) => {
it(`should report error details exactly once when trying to resolve ${testCase[1]}`, (done) => {
/**
* @param {Error & { details: string } | null} err err
* @param {string} _filename _filename
Expand Down
4 changes: 2 additions & 2 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ declare interface Iterator<T, Z> {
i: number,
): void;
}
type JsonObject = { [index: string]: JsonValue } & {
declare interface JsonObject {
[index: string]:
| undefined
| null
Expand All @@ -551,7 +551,7 @@ type JsonObject = { [index: string]: JsonValue } & {
| boolean
| JsonObject
| JsonValue[];
};
}
type JsonValue = null | string | number | boolean | JsonObject | JsonValue[];
declare interface KnownHooks {
/**
Expand Down
Loading