Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
Some small fixes for ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
scastiel committed Nov 10, 2017
1 parent 2411ace commit 38c5b0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
7 changes: 4 additions & 3 deletions babylon-to-espree/convertTemplateType.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// beginning of the next one…
// * and so on till end of the template string, the last token containing
// the closing backquote.
//
// Examples: (the resulting template tokens are underlined with successive '^')
// var a = `Result: ${result}.`;
// ^^^^^^^^^^^ ^^^
Expand Down Expand Up @@ -43,12 +44,12 @@ module.exports = function(tokens, tt) {
if (token.type === tt.dollarBraceL) {
// If '${', then we begin a new expression with its own context. This means that
// we add a new context to the stack, and define it as the current context.
index = createTemplateTokenAndReturnNewIndex(index, token);
index = createTemplateTokenAndReturnNewIndex(index);
contextStack.pushNewNonTemplateContext();
} else if (token.type === tt.backQuote) {
// If '`', then we go back to the previous expression (the one before the template
// string began). We restore the previous context, with its numOfBraces.
index = createTemplateTokenAndReturnNewIndex(index, token);
index = createTemplateTokenAndReturnNewIndex(index);
contextStack.popContext();
}

Expand Down Expand Up @@ -114,7 +115,7 @@ module.exports = function(tokens, tt) {

// Create a template token to aggregate previous tokens, and returns
// the new current index.
function createTemplateTokenAndReturnNewIndex(index, token) {
function createTemplateTokenAndReturnNewIndex(index) {
const startIndex = contextStack.current().startIndex;
replaceWithTemplateType(startIndex, index);
return startIndex;
Expand Down
14 changes: 6 additions & 8 deletions test/non-regression.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@ function verifyAndAssertMessages(

if (messages.length !== expectedMessages.length) {
throw new Error(
`Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify(
messages,
null,
2
)}`
`Expected ${expectedMessages.length} message(s), got ${
messages.length
}\n${JSON.stringify(messages, null, 2)}`
);
}

messages.forEach((message, i) => {
var formatedMessage = `${message.line}:${message.column} ${message.message}${message.ruleId
? ` ${message.ruleId}`
: ""}`;
var formatedMessage = `${message.line}:${message.column} ${
message.message
}${message.ruleId ? ` ${message.ruleId}` : ""}`;
if (formatedMessage !== expectedMessages[i]) {
throw new Error(
unpad(`
Expand Down

0 comments on commit 38c5b0a

Please sign in to comment.