unicorn/no-uncalled-method
eslint-plugin-unicorn
No autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-uncalled-method": "error",
},
},
];const sorted = array.sort;function normalize(string) {
return string.toLowerCase;
}const sorted = array.sort();function normalize(string) {
return string.toLowerCase();
}array.sort.call(array);Examples from the ESLint documentation.
unicorn/no-uncalled-method
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/no-uncalled-method": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow top-level side effects in exported modules.
Require class members to be declared.
Disallow unnecessary use of Array#flatMap().
Disallow optional chaining on undeclared variables.
Disallow unnecessary comparisons against boolean literals.