linter: `extends` should resolve the path to workspace package
What version of Oxlint are you using?
0.16.6
What command did you run?
both cli and vsc extension
What does your .oxlintrc.json config file look like?
{
"extends": [
// "../packages/oxlint-config/index.json",
"@monkeytype/oxlint-config"
],
"overrides": [
{
"files": ["__tests__/**"],
"plugins": ["jest", "vitest"],
"rules": {
// "no-unused-vars": "off"
}
}
]
}
What happened?
When trying to use monorepo local workspace packages, the path is not resolved correctly (in ESLint this works fine).
This doesn't work - when switching these around, everything works as expected.
"extends": [
// "../packages/oxlint-config/index.json",
"@monkeytype/oxlint-config"
],
Verified its installed as a dev dependency:
The file is exported (yes, its called index.json)
Not working
Working (unused var is now an error)
This is explicit behavior for the moment, we decided not to add any resolution to the config file paths initially because it is faster and simpler. For now, you can specify the file path explicitly. I'll leave this issue open for discussion though.
This is explicit behavior for the moment, we decided not to add any resolution to the config file paths initially because it is faster and simpler. For now, you can specify the file path explicitly. I'll leave this issue open for discussion though.
It would be a nice-to-have to support both fast relative path and slower resolved paths. In large mono-repos if the base config ever changes path, you would need to update .oxlintrc.json in every package.
Unless the performance hit would be felt on every run, then i guess im fine with that.
It's much easier to create a template package when the configs are also packages and the paths resolved. I would love to see this!
Also, would plugins require this anyways? Since the JSON would need to resolve the path to the installed package? https://github.com/oxc-project/oxc/issues/9905
In our case, we have a shared standards package where we export common base configurations for stuff like eslint, prettier, tsconfig among others. I wanted to add the oxlint config too but ran into the same issue. We can't extend a package.
I think we should either allow the JSON to resolve paths or allow programatic configurations (.ts/.js files) so we can resolve this ourselves.
I am doing this too. As an ugly workaround you can have the path go directly to node_modules.
{
"extends": ["node_modules/@config/oxlint/base.json"]
}