-
-
Notifications
You must be signed in to change notification settings - Fork 949
linter: oxlint-tsgolint failing when no typescript files passed in #13501
Description
What version of Oxlint are you using?
1.14.0
What command did you run?
oxlint --type-aware
What does your .oxlintrc.json config file look like?
What happened?
TL;DR: tsgolint should not throw an error when no TypeScript files are passed into it from OxLint
It seems that OxLint's tsgolint depends on at least one TypeScript file being passed in when the --type-aware flag is being used. In a repo with non-typescript files that get linted, e,g. a Svelte files, oxlint errors with the following:
$ yarn oxlint --type-aware app/frontend/javascripts/components/alerts/alert.svelte
Error running tsgolint: "exit status: exit status: 1, error: no files specified in config"%
Where this becomes really noticeable is when you want to only lint files that are about to be committed, but those all files changed are only svelte files. To get the pre-commit functionality, I use lefthook. The config for that looks like this:
pre-commit:
parallel: true
commands:
"OxLint":
glob:
- "app/frontend/**/*.{js,ts,svelte}"
- "playwright/**/*.{js,ts}"
- "stories/**/*.{js,ts,svelte}"
run: yarn oxlint --type-aware {staged_files}Lefthook finds changes about to be committed matching the glob patterns, and if it finds any matching files, it passes the file list into oxlint. When I edit only a Svelte files though, OxLint only gets Svelte file paths, and tsgolint fails.
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackPriority
Effort
{ "$schema": "./node_modules/oxlint/configuration_schema.json", "ignorePatterns": ["/node_modules", "/*.{js,ts}"], "plugins": ["eslint", "oxc", "typescript", "import", "promise", "unicorn"], "categories": { "correctness": "error", "nursery": "error", "pedantic": "error", "perf": "error", "restriction": "error", "style": "error", "suspicious": "error" } }