If I check for ESLint docs there is a perfect plugin available for camel case properties, whereas the same thing I'm trying to identify functions if they are either camelcase or not.
index.js
var first_name;
var lastName;
function getFirstName(a,b){
return firstName;
}
.eslintrc
module.exports = {
"rules": {
"camelcase": [2, {"properties": "always"}]
}
}
if I ran eslint index.js, I will be getting a proper lint error like this
2:5 error Identifier 'first_name' is not in camel case camelcase
✖ 1 problem (1 error, 0 warnings)
Similarly, I want to achieve this for functions too. Here, getfirstname
is not in proper camelcase. I need to get a lint error, so I have changed the rule to
module.exports = {
"rules": {
**"camelcase": [2, {"functions": "always"}]**
}
}
if I set the above, I'm not getting the error. what should I do to validate linting for functions using the eslint module? please suggest another way to identify this linting.