Enable the no-var linting rule in src/core/primitives.js

This commit is contained in:
Tim van der Meij 2021-02-27 12:51:01 +01:00
parent ed33727419
commit 24f80f1e38
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -12,13 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/* eslint-disable no-var */
import { assert, unreachable } from "../shared/util.js"; import { assert, unreachable } from "../shared/util.js";
var EOF = {}; const EOF = {};
var Name = (function NameClosure() { const Name = (function NameClosure() {
let nameCache = Object.create(null); let nameCache = Object.create(null);
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
@ -29,7 +28,7 @@ var Name = (function NameClosure() {
Name.prototype = {}; Name.prototype = {};
Name.get = function Name_get(name) { Name.get = function Name_get(name) {
var nameValue = nameCache[name]; const nameValue = nameCache[name];
// eslint-disable-next-line no-restricted-syntax // eslint-disable-next-line no-restricted-syntax
return nameValue ? nameValue : (nameCache[name] = new Name(name)); return nameValue ? nameValue : (nameCache[name] = new Name(name));
}; };
@ -41,7 +40,7 @@ var Name = (function NameClosure() {
return Name; return Name;
})(); })();
var Cmd = (function CmdClosure() { const Cmd = (function CmdClosure() {
let cmdCache = Object.create(null); let cmdCache = Object.create(null);
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
@ -52,7 +51,7 @@ var Cmd = (function CmdClosure() {
Cmd.prototype = {}; Cmd.prototype = {};
Cmd.get = function Cmd_get(cmd) { Cmd.get = function Cmd_get(cmd) {
var cmdValue = cmdCache[cmd]; const cmdValue = cmdCache[cmd];
// eslint-disable-next-line no-restricted-syntax // eslint-disable-next-line no-restricted-syntax
return cmdValue ? cmdValue : (cmdCache[cmd] = new Cmd(cmd)); return cmdValue ? cmdValue : (cmdCache[cmd] = new Cmd(cmd));
}; };
@ -64,8 +63,8 @@ var Cmd = (function CmdClosure() {
return Cmd; return Cmd;
})(); })();
var Dict = (function DictClosure() { const Dict = (function DictClosure() {
var nonSerializable = function nonSerializableClosure() { const nonSerializable = function nonSerializableClosure() {
return nonSerializable; // creating closure on some variable return nonSerializable; // creating closure on some variable
}; };
@ -165,7 +164,7 @@ var Dict = (function DictClosure() {
}, },
forEach: function Dict_forEach(callback) { forEach: function Dict_forEach(callback) {
for (var key in this._map) { for (const key in this._map) {
callback(key, this.get(key)); callback(key, this.get(key));
} }
}, },
@ -240,7 +239,7 @@ var Dict = (function DictClosure() {
return Dict; return Dict;
})(); })();
var Ref = (function RefClosure() { const Ref = (function RefClosure() {
let refCache = Object.create(null); let refCache = Object.create(null);
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow