sonarjs/no-misleading-array-reverse
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-misleading-array-reverse": "error",
},
},
];Array-mutating methods should not be used misleadingly
var b = a.reverse(); // Noncompliant
var d = c.sort(); // Noncompliantvar b = [...a].reverse(); // de-structure and create a new array, so reverse doesn't impact 'a'
a.reverse();
c.sort(); // this sorts array in placeExamples from the ESLint documentation.
sonarjs/no-misleading-array-reverse
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-misleading-array-reverse": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Browsers should not be allowed to perform MIME type sniffing
Unicode Grapheme Clusters should be avoided inside regex character classes
Reactive state should not be unconditionally mutated inside Vue's "updated" lifecycle hook
Assignments should not be made from within sub-expressions