
rules.eslint-angular.ng_definedundefined.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-web-frontend-angular-eslint Show documentation
Show all versions of sonar-web-frontend-angular-eslint Show documentation
Consume eslint-angular reports and add report information into Sonar
The newest version!
Details
angular.isDefined
and angular.isUndefined
instead of other undefined checks
definedundefined - use You should use the angular.isUndefined or angular.isDefined methods instead of using the keyword undefined.
We also check the use of !angular.isUndefined and !angular.isDefined (should prefer the reverse function)
ExamplesThe following patterns are considered problems;
/*eslint angular/definedundefined: 2*/
// invalid
value === undefined // error: You should not use directly the "undefined" keyword. Prefer angular.isUndefined or angular.isDefined
// invalid
value !== undefined // error: You should not use directly the "undefined" keyword. Prefer angular.isUndefined or angular.isDefined
// invalid
!angular.isUndefined(value) // error: Instead of !angular.isUndefined, you can use the out-of-box angular.isDefined method
// invalid
!angular.isDefined(value) // error: Instead of !angular.isDefined, you can use the out-of-box angular.isUndefined method
The following patterns are not considered problems;
/*eslint angular/definedundefined: 2*/
// valid
angular.isUndefined(value)
// valid
angular.isDefined(value)
VersionThis rule was introduced in eslint-plugin-angular 0.1.0
Links
© 2015 - 2025 Weber Informatics LLC | Privacy Policy