oxc
oxc copied to clipboard
linter: Improve config generation for website to support string-based configs
There is no way currently to generate the config docs correctly for a rule like prefer_es6_class. In this case, there isn't a config object, but rather just a string value for the mode to run the rule in:
"react/prefer-es6-class": ["error", "always"]
Right now the auto-generated config doesn't really handle this pattern correctly and we need to update the website generation logic to allow this.
Other rules with this behavior that need this change:
-
vue/define-emits-declaration -
vue/define-props-declaration(although this is technically defined as taking a bool, which is somewhat wrong?) -
eslint/operator-assignment -
jest/no_restricted_matchers.rsthis one isn't string-based, but does have the same problem. -
eslint/yodaaccepts a string argument ofalways -
eslint/func-names- this supports one string config option and then a keyword argument as well. -
unicorn/switch-case-braces -
import/extensions, accepts both a string or an object. -
eslint/no-restricted-globals, this currently has incorrect docs because of this problem.
Doing this will involve modifying the code here, I believe. Not just that location, but that'll be part of it at least.