-
Notifications
You must be signed in to change notification settings - Fork 149
feat: 🎸 support extends prop in tsconfig #302
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
Conversation
if (typeof config.extends === 'string') { | ||
const parentConfigPath = join( | ||
process.cwd(), | ||
dirname(tsconfigFile), | ||
config.extends, | ||
); | ||
|
||
Object.assign( | ||
compilerOptionsJSON, | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires, node/global-require, @typescript-eslint/no-require-imports | ||
require(parentConfigPath).compilerOptions, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the important bit
const importTransformer: ts.TransformerFactory<ts.SourceFile> = (context) => { | ||
const visit: ts.Visitor = (node) => { | ||
if (ts.isImportDeclaration(node)) { | ||
if (node.importClause?.isTypeOnly) { | ||
return ts.createEmptyStatement(); | ||
} | ||
|
||
return ts.createImportDeclaration( | ||
node.decorators, | ||
node.modifiers, | ||
node.importClause, | ||
node.moduleSpecifier, | ||
); | ||
} | ||
|
||
return ts.visitEachChild(node, (child) => visit(child), context); | ||
}; | ||
|
||
return (node) => ts.visitNode(node, visit); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just moved this
// Support extending another tsconfig | ||
if (typeof config.extends === 'string') { | ||
const parentConfigPath = join( | ||
process.cwd(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about using cwd as base here, but we need an absolute path here.
Closes #300