-
-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Labels
Status: ReleasedIt's now live.It's now live.Type: BugInconsistencies or issues which will cause a problem for users or implementors.Inconsistencies or issues which will cause a problem for users or implementors.
Description
Bug Report
Rules such as functional/type-declaration-immutability don’t work when using the flat config with ESM modules.
test.ts:
type Test = readonly string[]eslint.config.js:
import tseslint from 'typescript-eslint'
import functional from 'eslint-plugin-functional/flat'
export default tseslint.config(
{
files: ['**/*.ts'],
languageOptions: {
ecmaVersion: 2022,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
tseslint.configs.base,
functional.configs.strict,
{
rules: {
'functional/type-declaration-immutability': 'error',
},
},
)Expected behavior
No errors.
Actual behavior
/path/to/file/test.ts
1:1 error This type is declare to have an immutability of at least "Immutable" (actual: "Unknown") functional/type-declaration-immutability
Steps to reproduce
- Install [email protected]
- Run
eslint test.ts
Proposed changes
| export default (() => { | |
| try { | |
| return require("typescript") as typeof ts; | |
| } catch { | |
| return undefined; | |
| } | |
| })(); |
typescript can’t be imported in an ESM module as require is not defined.
Metadata
Metadata
Assignees
Labels
Status: ReleasedIt's now live.It's now live.Type: BugInconsistencies or issues which will cause a problem for users or implementors.Inconsistencies or issues which will cause a problem for users or implementors.