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

Issue: Targeted files skip tsconfig #1435

Open
lveillard opened this issue Jun 10, 2024 · 1 comment
Open

Issue: Targeted files skip tsconfig #1435

lveillard opened this issue Jun 10, 2024 · 1 comment

Comments

@lveillard
Copy link

Description

When using lint-staged like this:

{
  "*.{js,jsx,ts,tsx}": ["eslint --fix", "eslint"],
  "**/*.ts?(x)": "pnpm run types",
  "*.json": ["prettier --write"]
}

Being the pnpm run types just tsc --noEmit command that works if invoked manually as it targets the folder and not individual files.

On the other hand, when invoked by lint-staged It tends to throw errors as it does ignore the tsconfig.ts. This is not a lint-staged bug but a limitation in tsc, as it is apparently not possible to target a file and config a project.

Steps to reproduce

in my case is a monorepo with nextjs but should happen in other scenarios where --skipLibCheck and --esModuleInterop are necessary

Environment

WSL windows and windows
node 18l
int staged version: 15.2.5

@iiroj
Copy link
Member

iiroj commented Jun 10, 2024

Not sure I get what you mean, but if use the JS config format you can configure like this to avoid filenames:

export default {
  "*.{js,jsx,ts,tsx}": ["eslint --fix", "eslint"],
  "**/*.ts?(x)": (filenames) => "pnpm run types", // do not pass filenames
  "*.json": ["prettier --write"]
}

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

No branches or pull requests

2 participants