Disallow Reassignment of Native Objects (no-native-reassign)
Reports an error when they encounter an attempt to assign a value to built-in native object.
String = "hello world";
var String;
Rule Details
The following objects are considered a native objects:
ArrayBooleanDatedecodeURIdecodeURIComponentencodeURIencodeURIComponentErrorevalEvalErrorFunctionisFiniteisNaNJSONMathNumberObjectparseIntparseFloatRangeErrorReferenceErrorRegExpStringSyntaxErrorTypeErrorURIErrorMapNaNSetWeakMapInfinityundefined
The following patterns are considered warnings:
String = new Object();
var String;
Options
exceptions
Array of native object names that are permitted to be reassigned.
If provided, it must be an Array.
{
"rules": {
"no-native-reassign": [2, {"exceptions": ["Object"]}]
}
}
When Not To Use It
If you are trying to override one of the native objects.
Related Rules
Version
This rule was introduced in ESLint 0.0.9.