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

This commit is contained in:
Patrick Brosset 2015-12-03 11:17:02 +01:00
parent ba0deaa3cd
commit 2c7f2d2f7d
2 changed files with 9 additions and 3 deletions

View File

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

View File

@ -129,6 +129,13 @@ module.exports = {
variable.eslintExplicitGlobal = false;
variable.writeable = true;
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);
}
},
/**