Bump the npm group with 2 updates (#2045)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.55.0 to 8.56.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0) Updates `eslint-plugin-import` from 2.29.0 to 2.29.1 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
511f073971
commit
144b7d5b16
32 changed files with 618 additions and 251 deletions
116
node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts
generated
vendored
116
node_modules/tsconfig-paths/src/__tests__/tsconfig-loader.test.ts
generated
vendored
|
|
@ -133,7 +133,7 @@ describe("walkForTsConfig", () => {
|
|||
});
|
||||
|
||||
describe("loadConfig", () => {
|
||||
it("It should load a config", () => {
|
||||
it("should load a config", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
|
|
@ -144,7 +144,7 @@ describe("loadConfig", () => {
|
|||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("It should load a config with comments", () => {
|
||||
it("should load a config with comments", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
|
|
@ -160,7 +160,7 @@ describe("loadConfig", () => {
|
|||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("It should load a config with trailing commas", () => {
|
||||
it("should load a config with trailing commas", () => {
|
||||
const config = { compilerOptions: { baseUrl: "hej" } };
|
||||
const res = loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
|
|
@ -175,7 +175,21 @@ describe("loadConfig", () => {
|
|||
expect(res).toStrictEqual(config);
|
||||
});
|
||||
|
||||
it("It should load a config with extends and overwrite all options", () => {
|
||||
it("should throw an error including the file path when encountering invalid JSON5", () => {
|
||||
expect(() =>
|
||||
loadTsconfig(
|
||||
"/root/dir1/tsconfig.json",
|
||||
(path) => path === "/root/dir1/tsconfig.json",
|
||||
(_) => `{
|
||||
"compilerOptions": {
|
||||
}`
|
||||
)
|
||||
).toThrowError(
|
||||
"/root/dir1/tsconfig.json is malformed JSON5: invalid end of input at 3:12"
|
||||
);
|
||||
});
|
||||
|
||||
it("should load a config with string extends and overwrite all options", () => {
|
||||
const firstConfig = {
|
||||
extends: "../base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
|
|
@ -221,7 +235,7 @@ describe("loadConfig", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("It should load a config with extends from node_modules and overwrite all options", () => {
|
||||
it("should load a config with string extends from node_modules and overwrite all options", () => {
|
||||
const firstConfig = {
|
||||
extends: "my-package/base-config.json",
|
||||
compilerOptions: { baseUrl: "kalle", paths: { foo: ["bar2"] } },
|
||||
|
|
@ -273,7 +287,7 @@ describe("loadConfig", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("Should use baseUrl relative to location of extended tsconfig", () => {
|
||||
it("should use baseUrl relative to location of extended tsconfig", () => {
|
||||
const firstConfig = { compilerOptions: { baseUrl: "." } };
|
||||
const firstConfigPath = join("/root", "first-config.json");
|
||||
const secondConfig = { extends: "../first-config.json" };
|
||||
|
|
@ -309,4 +323,94 @@ describe("loadConfig", () => {
|
|||
compilerOptions: { baseUrl: join("..", "..") },
|
||||
});
|
||||
});
|
||||
|
||||
it("should load a config with array extends and overwrite all options", () => {
|
||||
const baseConfig1 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
const baseConfig1Path = join("/root", "base-config-1.json");
|
||||
const baseConfig2 = { compilerOptions: { baseUrl: "." } };
|
||||
const baseConfig2Path = join("/root", "dir1", "base-config-2.json");
|
||||
const baseConfig3 = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar2"] } },
|
||||
};
|
||||
const baseConfig3Path = join("/root", "dir1", "dir2", "base-config-3.json");
|
||||
const actualConfig = {
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
};
|
||||
const actualConfigPath = join("/root", "tsconfig.json");
|
||||
|
||||
const res = loadTsconfig(
|
||||
join("/root", "tsconfig.json"),
|
||||
(path) =>
|
||||
[
|
||||
baseConfig1Path,
|
||||
baseConfig2Path,
|
||||
baseConfig3Path,
|
||||
actualConfigPath,
|
||||
].indexOf(path) >= 0,
|
||||
(path) => {
|
||||
if (path === baseConfig1Path) {
|
||||
return JSON.stringify(baseConfig1);
|
||||
}
|
||||
if (path === baseConfig2Path) {
|
||||
return JSON.stringify(baseConfig2);
|
||||
}
|
||||
if (path === baseConfig3Path) {
|
||||
return JSON.stringify(baseConfig3);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
expect(res).toEqual({
|
||||
extends: [
|
||||
"./base-config-1.json",
|
||||
"./dir1/base-config-2.json",
|
||||
"./dir1/dir2/base-config-3.json",
|
||||
],
|
||||
compilerOptions: {
|
||||
baseUrl: join("dir1", "dir2"),
|
||||
paths: { foo: ["bar2"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("should load a config with array extends without .json extension", () => {
|
||||
const baseConfig = {
|
||||
compilerOptions: { baseUrl: ".", paths: { foo: ["bar"] } },
|
||||
};
|
||||
const baseConfigPath = join("/root", "base-config-1.json");
|
||||
const actualConfig = { extends: ["./base-config-1"] };
|
||||
const actualConfigPath = join("/root", "tsconfig.json");
|
||||
|
||||
const res = loadTsconfig(
|
||||
join("/root", "tsconfig.json"),
|
||||
(path) => [baseConfigPath, actualConfigPath].indexOf(path) >= 0,
|
||||
(path) => {
|
||||
if (path === baseConfigPath) {
|
||||
return JSON.stringify(baseConfig);
|
||||
}
|
||||
if (path === actualConfigPath) {
|
||||
return JSON.stringify(actualConfig);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
);
|
||||
|
||||
expect(res).toEqual({
|
||||
extends: ["./base-config-1"],
|
||||
compilerOptions: {
|
||||
baseUrl: ".",
|
||||
paths: { foo: ["bar"] },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue