mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Update for-in loop to work with eslint:recommended (#99721)
The code in the automatic template will fail this eslint rule: https://eslint.org/docs/rules/no-prototype-builtins. This is just plain annoying. This change will make the snippet generated code not fail the linter. It will also avoid the subtle bugs that the eslint rule was made to avoid in the first place.
This commit is contained in:
parent
6a927e6bb5
commit
f3ffbedd41
|
@ -151,7 +151,7 @@
|
|||
"prefix": "forin",
|
||||
"body": [
|
||||
"for (const ${1:key} in ${2:object}) {",
|
||||
"\tif (${2:object}.hasOwnProperty(${1:key})) {",
|
||||
"\tif (Object.prototype.hasOwnProperty.call(${2:object}, ${1:key})) {",
|
||||
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
|
||||
"\t\t$0",
|
||||
"\t}",
|
||||
|
|
Loading…
Reference in a new issue