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

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

Open
3 tasks done
m4rvr opened this issue Oct 20, 2024 · 2 comments
Open
3 tasks done
Labels
enhancement New feature or request pr welcome

Comments

@m4rvr
Copy link

m4rvr commented Oct 20, 2024

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

@m4rvr m4rvr added the enhancement New feature or request label Oct 20, 2024
@pauliesnug
Copy link

pauliesnug commented Oct 21, 2024

This is already implemented in most configurations, however the resolveSubOptions aren't passed (only getOverrides) in the factory, despite the fact that almost all configurations support OptionsFiles. All that would need to happen is for the sub options to be resolved as well, so you can override the files per-config, as this is already supported in the options spread types of both Solid and React.

This is a pretty simple fix. I can make a PR

@antfu
Copy link
Owner

antfu commented Oct 21, 2024

PR welcome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pr welcome
Projects
None yet
Development

No branches or pull requests

3 participants