diff --git a/src/parser/tsconfig.js b/src/parser/tsconfig.js index 1a5ec46a..a0bc7a85 100644 --- a/src/parser/tsconfig.js +++ b/src/parser/tsconfig.js @@ -22,7 +22,11 @@ export default function tsconfigParser(filePath, deps) { }); } if (tsconfigJson.extends) { - foundDeps.push(tsconfigJson.extends); + if (Array.isArray(tsconfigJson.extends)) { + foundDeps.push(...tsconfigJson.extends); + } else { + foundDeps.push(tsconfigJson.extends); + } } return foundDeps.map((p) => requirePackageName(p)).filter(Boolean); } diff --git a/test/fake_modules/tsconfig/package.json b/test/fake_modules/tsconfig/package.json index a3876199..28d2dff9 100644 --- a/test/fake_modules/tsconfig/package.json +++ b/test/fake_modules/tsconfig/package.json @@ -3,6 +3,7 @@ "dependencies": {}, "devDependencies": { "@mybrand/tsconfig": "*", + "@tsconfig/recommended": "*", "@types/node": "*", "@types/unused": "*" } diff --git a/test/fake_modules/tsconfig/tsconfig.array-extends.json b/test/fake_modules/tsconfig/tsconfig.array-extends.json new file mode 100644 index 00000000..0048771e --- /dev/null +++ b/test/fake_modules/tsconfig/tsconfig.array-extends.json @@ -0,0 +1,3 @@ +{ + "extends": ["tsconfig-base/tsconfig.base.json", "@tsconfig/recommended"], +} diff --git a/test/spec.js b/test/spec.js index 810812ef..bdec159e 100755 --- a/test/spec.js +++ b/test/spec.js @@ -247,13 +247,14 @@ export default [ devDependencies: ['@types/unused'], missing: { '@types/jest': ['tsconfig.json'], - 'tsconfig-base': ['tsconfig.build.json'], + 'tsconfig-base': ['tsconfig.array-extends.json', 'tsconfig.build.json'], }, using: { '@mybrand/tsconfig': ['tsconfig.json'], + '@tsconfig/recommended': ['tsconfig.array-extends.json'], '@types/jest': ['tsconfig.json'], '@types/node': ['tsconfig.json'], - 'tsconfig-base': ['tsconfig.build.json'], + 'tsconfig-base': ['tsconfig.array-extends.json', 'tsconfig.build.json'], }, }, expectedErrorCode: -1,