Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

kaisermann
Copy link
Member

@kaisermann kaisermann commented Jan 29, 2021

Closes #300

Comment on lines +70 to +82
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,
);
}
Copy link
Member Author

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

Comment on lines +109 to +128
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);
};
Copy link
Member Author

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(),
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support "extends" tsconfig directive
1 participant