Skip to content

Duplicate type-aware rules under certain conditions #135

Open
@qlonik

Description

@qlonik

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},

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions