id-match
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"id-match": "error",
},
},
];const my_favorite_color = "#112C85";
const _myFavoriteColor = "#112C85";
const myFavoriteColor_ = "#112C85";
const MY_FAVORITE_COLOR = "#112C85";
function do_something() {
// ...
}
class My_Class {}
class myClass {
do_something() {}
}
class anotherClass {
#do_something() {}
}const obj = {
my_pref: 1
};
obj.do_something = function() {
// ...
};class myClass {
my_pref = 1;
}
class anotherClass {
#my_pref = 1;
}const myFavoriteColor = "#112C85";
const foo = bar.baz_boom;
const buz = { qux: bar.baz_boom };
do_something();
const obj = {
my_pref: 1
};
class myClass {}
class anotherClass {
doSomething() {}
}
class oneMoreClass {
#doSomething() {}
}foo = __dirname;const { category_id } = query;
const { category_Id = 1 } = query;
const { category_alias: category_alias } = query;Examples from the ESLint documentation.
id-match
eslint
export default [
{
rules: {
"id-match": "error",
},
},
];id-match
eslint plugin · style
{
"rules": {
"id-match": "error"
}
}Biome does not have this rule.
Require variables within the same declaration block to be sorted
Enforce the consistent use of either function declarations or expressions assigned to variables