Fixes https://github.com/babel/babel-eslint/issues/603 (and the fixture from https://github.com/babel/babel-eslint/issues/609 works). Reworks our code that converts the format of Babylon template tokens to be a bit more robust, especially with things like nested templates with arrows. (Adapted the logic from https://github.com/eslint/espree/blob/master/lib/token-translator.js)
11 lines
311 B
JavaScript
11 lines
311 B
JavaScript
"use strict";
|
|
|
|
var convertTemplateType = require("./convertTemplateType");
|
|
var toToken = require("./toToken");
|
|
|
|
module.exports = function(tokens, tt, code) {
|
|
return convertTemplateType(tokens, tt)
|
|
.filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock")
|
|
.map(t => toToken(t, tt, code));
|
|
};
|