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: config function from typescript-eslint doesn't use ignores when extends is provided. #8511

Closed
4 tasks done
Dremora opened this issue Feb 20, 2024 · 3 comments · Fixed by #8567
Closed
4 tasks done
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

I want to apply type-checked rules to most of my codebase with some exceptions. This is the config I have:

ESLint Config

tseslint.config({
    files: ['**/*.{ts,tsx}'],
    ignores: ['libs/legacy-lib/**'],
    extends: [
      ...tseslint.configs.strictTypeChecked,
      ...tseslint.configs.stylisticTypeChecked,
    ],
  })

tsconfig

No response

Expected Result

I expect the final config to have ignores applied to each of the configs I'm extending from.

Actual Result

Only files are applied, not ignores.

Additional Info

I can see from the code that ignores is not supported. This is somewhat surprising, given that files and ignores are two sides of the same coin - the ability to provide a list of files which to apply the rules to.

However, adding this functionality will likely be considered a breaking change.

Versions

package version
typescript-eslint 7.0.1
@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 bradzacher changed the title Bug: config function from typescript-eslint doesn't use ignores Bug: config function from typescript-eslint doesn't use ignores when extends is provided. Feb 20, 2024
@Flayms
Copy link

Flayms commented Feb 27, 2024

You have any workaround for this?

@auvred
Copy link
Member

auvred commented Feb 27, 2024

You have any workaround for this?

@Flayms - as a temporary workaround, you can manually map over configs as described in the docs - https://typescript-eslint.io/packages/typescript-eslint#flat-config-extends

Using the example from the original issue, the config can be rewritten as follows:

[
  ...tseslint.configs.strictTypeChecked,
  ...tseslint.configs.stylisticTypeChecked,
].map(conf => ({
  ...conf,
  files: ['**/*.{ts,tsx}'],
  ignores: ['libs/legacy-lib/**'],
}))

However, I hope that the fix (#8567) will be merged this week, so that a new version containing it will be released next Monday.

@bradzacher
Copy link
Member

This will release next monday as per our release schedule.
Until that time you can use the canary version

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 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
4 participants