Bug 1230373 - Fix an issue with eslint-plugin-mozilla not detecting the global scope properly when arrow functions are used. r=mossop

MozReview-Commit-ID: IOCM8Fjl0xQ

--HG--
extra : rebase_source : 63face219569f50bdfb00bcd7384f334ec6113c2
This commit is contained in:
Mark Banner 2017-10-16 15:08:26 +01:00
Родитель 18a6b40049
Коммит d4ad271c61
2 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -10,7 +10,7 @@
"use strict";
window.onload = () => {
var canvas = document.querySelector("canvas"), ctx = canvas.getContext("2d");
let canvas = document.querySelector("canvas"), ctx = canvas.getContext("2d");
canvas.width = 1000;
canvas.height = 2000;
ctx.fillStyle = "red";

Просмотреть файл

@ -388,7 +388,8 @@ module.exports = {
getIsGlobalScope(ancestors) {
for (let parent of ancestors) {
if (parent.type == "FunctionExpression" ||
parent.type == "FunctionDeclaration") {
parent.type == "FunctionDeclaration" ||
parent.type == "ArrowFunctionExpression") {
return false;
}
}