Skip to content
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

feat: typescript.tsconfigPath array support #306

Merged
merged 2 commits into from Oct 31, 2023

Conversation

rost-git
Copy link
Contributor

@rost-git rost-git commented Oct 31, 2023

Description

Multiple tsconfigs support

typescript: {
  tsconfigPath: ['tsconfig.json', 'tsconfig.node.json']
}

Linked Issues

close #305

Additional context

@@ -36,6 +36,12 @@ export function typescript(
'ts/unbound-method': 'error',
}

const tsconfigPath = typeof tsc === 'string' && tsc.trim()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why trim is needed?

Copy link
Contributor Author

@rost-git rost-git Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty string check (or if spaces only)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const tsconfigPath = typeof tsc === 'string' && tsc.trim()
const tsconfigPath = typeof tsc === 'string' ? (
tsc.trim() !== '' ? [tsc] : null
) : ...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a change. I think that setting tsconfigPath: " " should be a user error, and we shouldn't tolerant that implicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, thanks
just a habit to deal with user input - but here we have 'advanced' users

README.md Outdated
@@ -328,6 +328,8 @@ import antfu from '@antfu/eslint-config'
export default antfu({
typescript: {
tsconfigPath: 'tsconfig.json',
// or if you have multiple tsconfigs
tsconfigPath: ['tsconfig.json', 'tsconfig.node.json'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copypasted code should "just work", so this line should be commented

It supports globs so I'd recommend adding "packages/*/tsconfig.json" here to imply that
And possibly "tsconfig.eslint.json" to imply you can make one especially for linting

@antfu antfu merged commit 546526a into antfu:main Oct 31, 2023
5 checks passed
@rost-git rost-git deleted the feat/tsconfig-path-array branch October 31, 2023 18:11
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.

Add array support for typescript.tsconfigPath
3 participants