sonarjs/anchor-precedence
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/anchor-precedence": "error",
},
},
];Alternatives in regular expressions should be grouped when used with anchors
^a|b|c$^(?:a|b|c)$^a$|^b$|^c$(?:^a)|b|(?:c$)Examples from the ESLint documentation.
sonarjs/anchor-precedence
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/anchor-precedence": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Template literals should not be nested
Arguments to built-in functions should match documented types
Callbacks of array methods should have return statements
Assertions should be placed inside test cases or hooks