sonarjs/no-misleading-character-class
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-misleading-character-class": "error",
},
},
];Unicode Grapheme Clusters should be avoided inside regex character classes
"cc̈d̈d".replace(/[c̈d̈]/g, "X"); // result is "XXXXXX" and not expected "cXXd""cc̈d̈d".replace(/c̈|d̈/g, "X"); // result is "cXXd"Examples from the ESLint documentation.
sonarjs/no-misleading-character-class
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-misleading-character-class": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow characters which are made with multiple code points in character class syntax
Array-mutating methods should not be used misleadingly
Reactive state should not be unconditionally mutated inside Vue's "updated" lifecycle hook
Browsers should not be allowed to perform MIME type sniffing
Assignments should not be made from within sub-expressions