-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.triageWaiting for team members to take a lookWaiting for team members to take a look
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Relevant Package
utils
Playground Link
Repro Code
// @ts-check
import tseslint from "typescript-eslint";
import { includeIgnoreFile } from "@eslint/compat";
export default tseslint.config(includeIgnoreFile("gitignore"));
ESLint Config
n/a
tsconfig
Expected Result
There should be no type errors.
Actual Result
$ pnpm tsc
eslint.config.js:6:32 - error TS2345: Argument of type 'FlatConfig' is not assignable to parameter of type 'ConfigWithExtends'.
The types of 'languageOptions.globals' are incompatible between these types.
Type 'Globals' is not assignable to type 'GlobalsConfig'.
'string' index signatures are incompatible.
Type 'GlobalConf' is not assignable to type 'GlobalVariableOption'.
Type '"readable"' is not assignable to type 'GlobalVariableOption'.
6 export default tseslint.config(includeIgnoreFile("gitignore"));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in eslint.config.js:6
Additional Info
What's happening is that we don't allow 'readable
or 'writeable'
, while @types/eslint
does.
On the typescript-eslint side:
type GlobalVariableOptionBase = 'off' | 'readonly' | 'writable';
type GlobalVariableOption = GlobalVariableOptionBase | boolean;
interface GlobalsConfig {
[name: string]: GlobalVariableOption;
}
On the @types/eslint side:
type GlobalConf = boolean | "off" | "readable" | "readonly" | "writable" | "writeable";
interface Globals {
[name: string]: GlobalConf;
}
From https://archive.eslint.org/docs/7.0.0/user-guide/configuring:
For historical reasons, the boolean value false and the string value
"readable"
are equivalent to"readonly"
. Similarly, the boolean value true and the string value"writeable"
are equivalent to"writable"
. However, the use of older values is deprecated.
I think this means we'll need to add the two deprecated string literal types?
Originally reported by @romanstetsyk in https://discord.com/channels/1026804805894672454/1270028825857626193/1270028825857626193. Thanks! 🙌
Versions
package | version |
---|---|
@eslint/compat |
1.1.1 |
@typescript-eslint/utils |
8.0.0 |
TypeScript |
5.5.4 |
ESLint |
9.8.0 |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.triageWaiting for team members to take a lookWaiting for team members to take a look