-
-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
Description
First of all, thank you @stephenjason89 and @JounQin for getting the extensions autofix contribution merged in #327. I’ve been eager to use Stephen’s PR since I first saw the attempt in import-js/eslint-plugin-import#1749.
I've been finding it difficult to configure the extensions rule autofix to work. I'm suspicious that the behavior I'm seeing is unintentional and might be a bug.
What I've found is that the extensions rule autofix only works when both of the following are true:
- a
fix: true
option is set - a
pattern: {}
option is set, even if empty (the contents of the pattern object do not seem to matter)
Steps to Reproduce
In my testing, these do not enable autofix:
'import-x/extensions': ['warn', 'never'],
'import-x/extensions': ['warn', 'never', { fix: true }],
'import-x/extensions': ['warn', 'never', { pattern: {} }],
But this does enable autofix:
'import-x/extensions': ['warn', 'never', { fix: true, pattern: {} }],
Questions
- Is autofix intended to be opt-in via
fix: true
? I saw this comment suggesting it might be, but this isn’t documented, and no other rules in this project use a fix option. I was only able to discover thefix: boolean
option by looking through the PR history and source code. - Is requiring a pattern object to enable autofix intentional? It seems like an oversight, especially since an empty object works.
Thanks again for all the work on this plugin.
jnesta-lh
Metadata
Metadata
Assignees
Labels
No labels