noShadowRestrictedNames
诊断类别:lint/suspicious/noShadowRestrictedNames
¥Diagnostic Category: lint/suspicious/noShadowRestrictedNames
自从:v1.0.0
¥Since: v1.0.0
来源:
¥Sources:
-
与以下相同:
no-shadow-restricted-names
¥Same as:
no-shadow-restricted-names
禁止标识符隐藏受限名称。
¥Disallow identifiers from shadowing restricted names.
¥Examples
¥Invalid
code-block.js:1:10 lint/suspicious/noShadowRestrictedNames ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Do not shadow the global “NaN” property.
> 1 │ function NaN() {}
│ ^^^
2 │
ℹ Consider renaming this variable. It’s easy to confuse the origin of variables when they’re named after a known global.
code-block.js:1:5 lint/suspicious/noShadowRestrictedNames ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Do not shadow the global “Set” property.
> 1 │ let Set;
│ ^^^
2 │
ℹ Consider renaming this variable. It’s easy to confuse the origin of variables when they’re named after a known global.
code-block.js:1:15 lint/suspicious/noShadowRestrictedNames ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Do not shadow the global “Object” property.
> 1 │ try { } catch(Object) {}
│ ^^^^^^
2 │
ℹ Consider renaming this variable. It’s easy to confuse the origin of variables when they’re named after a known global.
code-block.js:1:10 lint/suspicious/noShadowRestrictedNames ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Do not shadow the global “Array” property.
> 1 │ function Array() {}
│ ^^^^^
2 │
ℹ Consider renaming this variable. It’s easy to confuse the origin of variables when they’re named after a known global.
code-block.js:1:15 lint/suspicious/noShadowRestrictedNames ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Do not shadow the global “JSON” property.
> 1 │ function test(JSON) {console.log(JSON)}
│ ^^^^
2 │
ℹ Consider renaming this variable. It’s easy to confuse the origin of variables when they’re named after a known global.
¥Related links