diff --git a/src/parser/tsconfig.js b/src/parser/tsconfig.js index 9a4f15fe..6b200513 100644 --- a/src/parser/tsconfig.js +++ b/src/parser/tsconfig.js @@ -24,7 +24,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); + } } const plugins = tsconfigJson.compilerOptions?.plugins; diff --git a/test/fake_modules/tsconfig/package.json b/test/fake_modules/tsconfig/package.json index 2f262ed4..a45687d0 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": "*", "typescript-eslint-language-service": "*" 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..6c1f7b6f --- /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 cc311a99..a97031ad 100755 --- a/test/spec.js +++ b/test/spec.js @@ -248,14 +248,15 @@ export default [ missing: { '@types/jest': ['tsconfig.json'], 'ts-graphql-plugin': ['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'], 'ts-graphql-plugin': ['tsconfig.json'], - 'tsconfig-base': ['tsconfig.build.json'], + 'tsconfig-base': ['tsconfig.array-extends.json', 'tsconfig.build.json'], 'typescript-eslint-language-service': ['tsconfig.json'], }, },