forked from lightscript/lightscript-eslint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'babel-eslint/7.x' into prerelease/3.0.0
# Conflicts: # README.md # babylon-to-espree/toAST.js # index.js # package.json # test/non-regression.js # yarn.lock
- Loading branch information
Showing
19 changed files
with
561 additions
and
540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use strict"; | ||
|
||
// comment fixes | ||
module.exports = function (ast, comments, tokens) { | ||
if (comments.length) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use strict"; | ||
|
||
module.exports = function (comments) { | ||
for (var i = 0; i < comments.length; i++) { | ||
var comment = comments[i]; | ||
if (comment.type === "CommentBlock") { | ||
comment.type = "Block"; | ||
} else if (comment.type === "CommentLine") { | ||
comment.type = "Line"; | ||
} | ||
// sometimes comments don't get ranges computed, | ||
// even with options.ranges === true | ||
if (!comment.range) { | ||
comment.range = [comment.start, comment.end]; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"use strict"; | ||
|
||
module.exports = function (tokens, tt) { | ||
var startingToken = 0; | ||
var currentToken = 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,36 @@ | ||
exports.attachComments = require("./attachComments"); | ||
|
||
exports.toTokens = require("./toTokens"); | ||
exports.toAST = require("./toAST"); | ||
|
||
exports.convertComments = function (comments) { | ||
for (var i = 0; i < comments.length; i++) { | ||
var comment = comments[i]; | ||
if (comment.type === "CommentBlock") { | ||
comment.type = "Block"; | ||
} else if (comment.type === "CommentLine") { | ||
comment.type = "Line"; | ||
} | ||
// sometimes comments don't get ranges computed, | ||
// even with options.ranges === true | ||
if (!comment.range) { | ||
comment.range = [comment.start, comment.end]; | ||
} | ||
} | ||
"use strict"; | ||
|
||
var attachComments = require("./attachComments"); | ||
var convertComments = require("./convertComments"); | ||
var toTokens = require("./toTokens"); | ||
var toAST = require("./toAST"); | ||
|
||
module.exports = function (ast, traverse, tt, code) { | ||
// remove EOF token, eslint doesn't use this for anything and it interferes | ||
// with some rules see https://github.com/babel/babel-eslint/issues/2 | ||
// todo: find a more elegant way to do this | ||
ast.tokens.pop(); | ||
|
||
// convert tokens | ||
ast.tokens = toTokens(ast.tokens, tt, code); | ||
|
||
// add comments | ||
convertComments(ast.comments); | ||
|
||
// transform esprima and acorn divergent nodes | ||
toAST(ast, traverse, code); | ||
|
||
// ast.program.tokens = ast.tokens; | ||
// ast.program.comments = ast.comments; | ||
// ast = ast.program; | ||
|
||
// remove File | ||
ast.type = "Program"; | ||
ast.sourceType = ast.program.sourceType; | ||
ast.directives = ast.program.directives; | ||
ast.body = ast.program.body; | ||
delete ast.program; | ||
delete ast._paths; | ||
|
||
attachComments(ast, ast.comments, ast.tokens); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule eslint
deleted from
fdce86
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.