Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: flat config incorrectly places sourceType #8518

Closed
4 tasks done
Dremora opened this issue Feb 20, 2024 · 1 comment · Fixed by #8622
Closed
4 tasks done

Bug: flat config incorrectly places sourceType #8518

Dremora opened this issue Feb 20, 2024 · 1 comment · Fixed by #8622
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: typescript-eslint Issues related to the typescript-eslint package

Comments

@Dremora
Copy link

Dremora commented Feb 20, 2024

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

typescript-eslint

Playground Link

No response

Repro Code

Migrating from legacy to flat config started crashing ESLint on our large repository with OOM. Note that this is not related to upgrading to v7 of the package, which works fine.

I've compared final config from typescript-eslint with the regular config (converted to flat via FlatCompat) from @typescript-eslint/eslint-plugin, and the only difference is in the placement of sourceType inside the config.

ESLint Config

tseslint.configs.recommended

tsconfig

No response

Expected Result

Part of the final ESLint config:

"languageOptions": {
  "parser": {
    "meta": {
      "name": "typescript-eslint/parser",
      "version": "7.0.2"
    }
  },
  "sourceType": "module"
}

Actual Result

"languageOptions": {
  "parser": {
    "meta": {
      "name": "typescript-eslint/parser",
      "version": "7.0.2"
    }
  },
  "parserOptions": {
    "sourceType": "module"
  }
}

Additional Info

sourceType should be nested directly under languageOptions unless typescript-eslint has another option with the same name.

Versions

package version
@typescript-eslint/eslint-plugin 7.0.2
@typescript-eslint/parser 7.0.2
typescript-eslint 7.0.2
@Dremora Dremora added bug Something isn't working triage Waiting for maintainers to take a look labels Feb 20, 2024
@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue package: typescript-eslint Issues related to the typescript-eslint package and removed triage Waiting for maintainers to take a look labels Feb 20, 2024
@bradzacher
Copy link
Member

The old style was to place it under parserOptions!
The reason this wasn't caught was because:

  1. ParserOptions is declared as a loose object with an index signature to support all parsers.
  2. our tooling really doesn't use that field at all because TS has its own inbuilt handling.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: typescript-eslint Issues related to the typescript-eslint package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants