Skip to content

Commit

Permalink
Lint and fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianheine committed Feb 7, 2019
1 parent c4fdd0f commit 9c99356
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion acorn/src/parseutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pp.strictDirective = function(start) {
// Skip semicolon, if any.
skipWhiteSpace.lastIndex = start
start += skipWhiteSpace.exec(this.input)[0].length
if (this.input[start] === ';')
if (this.input[start] === ";")
start++
}
}
Expand Down
10 changes: 5 additions & 5 deletions acorn/src/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pp.exitScope = function() {
// > At the top level of a function, or script, function declarations are
// > treated like var declarations rather than like lexical declarations.
pp.treatFunctionsAsVarInScope = function(scope) {
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP);
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
}

pp.declareName = function(name, bindingType, pos) {
Expand All @@ -39,14 +39,14 @@ pp.declareName = function(name, bindingType, pos) {
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1
scope.lexical.push(name)
if (this.inModule && (scope.flags & SCOPE_TOP))
delete this.undefinedExports[name];
delete this.undefinedExports[name]
} else if (bindingType === BIND_SIMPLE_CATCH) {
const scope = this.currentScope()
scope.lexical.push(name)
} else if (bindingType === BIND_FUNCTION) {
const scope = this.currentScope()
if (this.treatFunctionsAsVar)
redeclared = scope.lexical.indexOf(name) > -1;
redeclared = scope.lexical.indexOf(name) > -1
else
redeclared = scope.lexical.indexOf(name) > -1 || scope.var.indexOf(name) > -1
scope.functions.push(name)
Expand All @@ -60,7 +60,7 @@ pp.declareName = function(name, bindingType, pos) {
}
scope.var.push(name)
if (this.inModule && (scope.flags & SCOPE_TOP))
delete this.undefinedExports[name];
delete this.undefinedExports[name]
if (scope.flags & SCOPE_VAR) break
}
}
Expand All @@ -71,7 +71,7 @@ pp.checkLocalExport = function(id) {
// scope.functions must be empty as Module code is always strict.
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
this.scopeStack[0].var.indexOf(id.name) === -1) {
this.undefinedExports[id.name] = id;
this.undefinedExports[id.name] = id
}
}

Expand Down
2 changes: 1 addition & 1 deletion acorn/src/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class Parser {
// Labels in scope.
this.labels = []
// Thus-far undefined exports.
this.undefinedExports = {};
this.undefinedExports = {}

// If enabled, skip leading hashbang line.
if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!")
Expand Down
18 changes: 9 additions & 9 deletions acorn/src/statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pp.parseTopLevel = function(node) {
}
if (this.inModule)
for (let name of Object.keys(this.undefinedExports))
this.raiseRecoverable(this.undefinedExports[name].start, `Export '${name}' is not defined`);
this.raiseRecoverable(this.undefinedExports[name].start, `Export '${name}' is not defined`)
this.adaptDirectivePrologue(node.body)
this.next()
if (this.options.ecmaVersion >= 6) {
Expand Down Expand Up @@ -488,7 +488,7 @@ pp.parseVar = function(node, isFor, kind) {

pp.parseVarId = function(decl, kind) {
if ((kind === "const" || kind === "let") && this.isContextual("let")) {
this.raiseRecoverable(this.start, "let is disallowed as a lexically bound name");
this.raiseRecoverable(this.start, "let is disallowed as a lexically bound name")
}
decl.id = this.parseBindingAtom()
this.checkLVal(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false)
Expand Down Expand Up @@ -517,7 +517,7 @@ pp.parseFunction = function(node, statement, allowExpressionBody, isAsync) {
// subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding
// mode depends on properties of the current scope (see
// treatFunctionsAsVar).
this.checkLVal(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);
this.checkLVal(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION)
}

let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos
Expand Down Expand Up @@ -552,8 +552,8 @@ pp.parseClass = function(node, isStatement) {

// ecma-262 14.6 Class Definitions
// A class definition is always strict mode code.
const oldStrict = this.strict;
this.strict = true;
const oldStrict = this.strict
this.strict = true

this.parseClassId(node, isStatement)
this.parseClassSuper(node)
Expand All @@ -572,7 +572,7 @@ pp.parseClass = function(node, isStatement) {
}
}
node.body = this.finishNode(classBody, "ClassBody")
this.strict = oldStrict;
this.strict = oldStrict
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
}

Expand Down Expand Up @@ -636,13 +636,13 @@ pp.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper)

pp.parseClassId = function(node, isStatement) {
if (this.type === tt.name) {
node.id = this.parseIdent();
node.id = this.parseIdent()
if (isStatement === true)
this.checkLVal(node.id, BIND_LEXICAL, false)
} else {
if (isStatement === true)
this.unexpected();
node.id = null;
this.unexpected()
node.id = null
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if (parseInt(process.versions.node) > 4) {
var join = require("path").join
try {
require("child_process").execSync(
join("node_modules", ".bin", "eslint") + " " + join(__dirname, "..", "src"),
join("node_modules", ".bin", "eslint") + " " + join(__dirname, "..", "*", "src"),
{encoding: "utf8", stdio: "inherit"}
)
console.log("OK")
Expand Down

0 comments on commit 9c99356

Please sign in to comment.