Skip to content

Commit

Permalink
fix: handle array extends in tsconfig
Browse files Browse the repository at this point in the history
Fix #854
  • Loading branch information
alexeyr-ci authored and alexeyr committed Jan 12, 2024
1 parent bef901f commit 6a1309d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/parser/tsconfig.js
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions test/fake_modules/tsconfig/package.json
Expand Up @@ -3,6 +3,7 @@
"dependencies": {},
"devDependencies": {
"@mybrand/tsconfig": "*",
"@tsconfig/recommended": "*",
"@types/node": "*",
"@types/unused": "*",
"typescript-eslint-language-service": "*"
Expand Down
3 changes: 3 additions & 0 deletions test/fake_modules/tsconfig/tsconfig.array-extends.json
@@ -0,0 +1,3 @@
{
"extends": ["tsconfig-base/tsconfig.base.json", "@tsconfig/recommended"]
}
5 changes: 3 additions & 2 deletions test/spec.js
Expand Up @@ -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'],
},
},
Expand Down

0 comments on commit 6a1309d

Please sign in to comment.