Closed henrist closed 6 months ago
If I'm not mistaken, this means we can now do this?
{
extends: [vitest.configs.recommended],
files: ["tests/**", "test/**"],
languageOptions: {
globals: {
...vitest.environments.env.globals,
},
},
},
instead of
{
files: ["tests/**", "test/**"],
languageOptions: {
globals: {
...vitest.environments.env.globals,
},
},
plugins: {
vitest,
},
rules: {
...vitest.configs.recommended.rules,
},
},
@Sparticuz I think I would have done this for something like that:
export default tseslint.config(
// ...
{
...vitest.configs.recommended,
...vitest.configs.env,
files: ["tests/**", "test/**"],
},
)
The extends
property doesn't behave the way you think (I believe), and it's actually no longer part of core ESLint. See the comment here: https://github.com/typescript-eslint/typescript-eslint/blob/e44a1a280f08f9fd0d29f74e5c3e73b7b64a9606/packages/typescript-eslint/src/config-helper.ts#L22-L62
If you don't depend on the files filter it can even be top level.
export default tseslint.config(
// ...
vitest.configs.recommended,
vitest.configs.env,
)
I'm new to the flat config myself though.
Fixes #427
This also fixes the globals values of
env
config. It was previouslywriteable
but the correct iswritable
(all though I don't understand why it's specified as writable in the first place). This was not type checked previously since there are no type constraints withObject.assign
.Side note: I'm noticing that the CI pipeline don't typecheck the code.
pnpm tsc
fails on main for me.