Open yvele opened 6 months ago
Ok I find out that there is a conflict between the regexp/letter-case
default options: https://ota-meshi.github.io/eslint-plugin-regexp/rules/letter-case.html#options
{
"regexp/letter-case": ["error", {
"unicodeEscape": "lowercase"
}]
}
And the recommended unicorn/escape-case
rule: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/escape-case.md
Enforces defining escape sequence values with uppercase characters rather than lowercase ones. This promotes readability by making the escaped value more distinguishable from the identifier.
As an example let's see how core-js is doing: https://github.com/zloirock/core-js/blob/f1303f38bd80474f950cadb3e802db1c2618a2c5/tests/eslint/eslint.config.js#L705-L707C21
// require escape sequences to use uppercase values
'unicorn/escape-case': ERROR,
'regexp/letter-case': [ERROR, {
caseInsensitive: 'lowercase',
unicodeEscape: 'uppercase',
}],
Maybe we could explain that conflict in the doc? Because eslint-plugin-unicorn
is super widely used.
I welcome pull requests to add notes.
Information:
eslint-plugin-regexp
version: 2.6.0Description
With this rule elabled:
The following code:
is reported as error:
but should be automatically fixed to:
Same problem with the
u
flag/\u036F/u
Note that the rule doc specifies that: