eslint-config icon indicating copy to clipboard operation
eslint-config copied to clipboard

Allow setting `files` for each package (react, solid, astro etc.) in the options

Open m4rvr opened this issue 4 months ago • 2 comments

Clear and concise description of the problem

At the moment it's only possible to define true or overrides in this config:

export default antfu(
  {
    react: true,
    solid: {
      overrides: {
        // ...
      }
    }
  }
)

If you have a monorepo (like me) where you use React and Solid, the rules collide.

Suggested solution

It would be great to allow the files option in the settings for each package like it's already possible when calling the function like react() or solid(), so the scope can be changed like this:

export default antfu(
  {
    react: {
      files: ['packages/app1/**/*.tsx']
    },
    solid: {
      files: ['packages/app2/**/*.tsx']
    }
  }
)

Alternative

As an alternative, manually calling and adding the packages works too. It just feels a little bit hacky and the feature request is more convenient.

import antfu, { react, solid } from '@antfu/eslint-config'

export default antfu(
  {
    react: false,
    solid: false
  },
  react({
    files: ['packages/app1/**/*.tsx'],
  }),
  solid({
    files: ['packages/app2/**/*.tsx'],
  })
)

Additional context

This was discussed in #625 already.

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

m4rvr avatar Oct 20 '24 10:10 m4rvr