sonarjs/file-name-differ-from-class
eslint-plugin-sonarjs
No autofix
eslint.config.js
export default [
{
rules: {
"sonarjs/file-name-differ-from-class": "error",
},
},
];// file path: myclass.js -- Noncompliant
class MyClass {
// ...
}
export default MyClass;// file path: MyClass.js
class MyClass {
// ...
}
export default MyClass;Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
sonarjs/file-name-differ-from-class
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/file-name-differ-from-class": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
"if ... else if" constructs should end with "else" clauses
Function and method names should comply with a naming convention
Destructuring syntax should be used for assignments