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

Duplicate type-aware rules under certain conditions #135

Open
qlonik opened this issue Jan 21, 2025 · 0 comments
Open

Duplicate type-aware rules under certain conditions #135

qlonik opened this issue Jan 21, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@qlonik
Copy link

qlonik commented Jan 21, 2025

Hey, I have an issue that I get duplicate type-aware rules, when I'm using eslint's inspect config functionality. I was digging through the code and saw that here you are mutating a global list of rules.

const userTypeAwareConfigs: ExtractedConfig[] = []

From what I understand eslint inspect config reloads the configuration file, once it changes, so the same set of rules runs through this partitioning function and the same rules get added second time to this array. This also would happen if for example I use defineConfigWithVueTs twice while constructing my eslint.config.mjs. I think the proper solution would be to have that array as a local variable per call to defineConfigWithVueTs function.

Also, while we are on the topic of this partitioning functionality, I think it would be a good idea if the name of a rule that is being extracted would also be preserved. Otherwise I get a lot of anonymous rules, and I put some time and thought in naming all my rules.

I suggest this object construction

userTypeAwareConfigs.push({
rules: Object.fromEntries(typeAwareRuleEntries),
...(config.files && { files: config.files }),
})
should have something like this in there too:

      ...config.name && {name: '@vue/typescript/mod/' + config.name},
@haoqunjiang haoqunjiang added the enhancement New feature or request label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants