mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 22:08:08 -05:00
[eslint config] [base] [patch] add error messages to no-restricted-syntax
Fixes #1353.
This commit is contained in:
@@ -256,10 +256,22 @@ module.exports = {
|
||||
// http://eslint.org/docs/rules/no-restricted-syntax
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
'ForInStatement',
|
||||
'ForOfStatement',
|
||||
'LabeledStatement',
|
||||
'WithStatement',
|
||||
{
|
||||
selector: 'ForInStatement',
|
||||
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
|
||||
},
|
||||
{
|
||||
selector: 'ForOfStatement',
|
||||
message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
|
||||
},
|
||||
{
|
||||
selector: 'LabeledStatement',
|
||||
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
|
||||
},
|
||||
{
|
||||
selector: 'WithStatement',
|
||||
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
|
||||
},
|
||||
],
|
||||
|
||||
// disallow space between function identifier and application
|
||||
|
||||
Reference in New Issue
Block a user