All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rules.jshint.W106.html Maven / Gradle / Ivy

Go to download

Consume reports generated by jshint for code quality. Also consume reports for code duplication (either simian or cpd). Consumes the unit/integration tests reports (generated by Jasmin) coverage report (lcov generated by Istanbul). The information generated by reports are added in Sonar

There is a newer version: 2.1.0
Show newest version

What does this option do?

The JSHint camelcase option is used to force all identifiers (function, variable and property) to either be written in camel case or in uppercase with underscores. It's common convention in JavaScript to use camel case for normal identifiers and uppercase for identifiers that represent constants. In the following example we have a couple of identifiers that break the camel case rule:

x
 
1
/*jshint camelcase: true */
2
var camel_case = 1;
3
var fake_constant = 2;
4
var obj = {
5
    not_good: 3
6
};
7
JSHint found 3 errorsVersion 2.5.0
Line 2:Identifier 'camel_case' is not in camel case.
Line 3:Identifier 'fake_constant' is not in camel case.
Line 5:Identifier 'not_good' is not in camel case.

In the next example we've changed the identifiers so they conform to the rules:

7
 
1
/*jshint camelcase: true */
2
var camelCase = 1;
3
var FAKE_CONSTANT = 2;
4
var obj = {
5
    notGood: 3
6
};
7
JSHint found no errorsVersion 2.5.0

When should I use this option?

The use of the camelcase JSHint option will cause an "Identifier '{a}' is not in camel case" error, where "{a}" is the identifier in question, any time it encounters an identifier that doesn't match the rules discussed above. You should only enable this option when you want to enforce a coding style throughout your program. This is generally a good idea when you're working on a project with multiple developers to help keep things consistent.

Note that this is an enforcing option which means JSHint does not apply it by default. If you do not explicitly set this option to true JSHint will allow the use of bitwise operators anywhere in your code.

Recommendation

Set this option to true (enforces the use of camel case and constant case).





© 2015 - 2025 Weber Informatics LLC | Privacy Policy