Bug 1230093 - Make the import-headjs-globals rule store variables correctly; r=Mossop

--HG--
extra : commitid : E3S2akSJ38y
extra : rebase_source : 3c7eea380147f97e290809f41bb8b8a95c05ea3c
This commit is contained in:
Patrick Brosset 2015-12-03 11:17:02 +01:00
Родитель 886206e422
Коммит c21276e895
2 изменённых файлов: 9 добавлений и 3 удалений

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

@ -254,9 +254,8 @@
// Disallow trailing whitespace at the end of lines. // Disallow trailing whitespace at the end of lines.
"no-trailing-spaces": 2, "no-trailing-spaces": 2,
// Disallow use of undeclared variables unless mentioned in a /*global */ // Disallow use of undeclared variables unless mentioned in a /*global */
// block. // block. Note that globals from head.js are automatically imported in tests
// This should really be a 2, but until we define all globals in comments // by the import-headjs-globals rule form the mozilla eslint plugin.
// and .eslintrc, keeping this as a 1.
"no-undef": 2, "no-undef": 2,
// Allow dangling underscores in identifiers (for privates). // Allow dangling underscores in identifiers (for privates).
"no-underscore-dangle": 0, "no-underscore-dangle": 0,

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

@ -129,6 +129,13 @@ module.exports = {
variable.eslintExplicitGlobal = false; variable.eslintExplicitGlobal = false;
variable.writeable = true; variable.writeable = true;
variables.push(variable); variables.push(variable);
// Since eslint 1.10.3, scope variables are now duplicated in the scope.set
// map, so we need to store them there too if it exists.
// See https://groups.google.com/forum/#!msg/eslint/Y4_oHMWwP-o/5S57U8jXd8kJ
if (scope.set) {
scope.set.set(name, variable);
}
}, },
/** /**