Fix to convert hash token. (babel/babel-eslint#753)
This commit is contained in:
parent
025fff7871
commit
3fcfc90a12
@ -44,6 +44,7 @@ module.exports = function(token, tt, source) {
|
|||||||
type === tt.bang ||
|
type === tt.bang ||
|
||||||
type === tt.tilde ||
|
type === tt.tilde ||
|
||||||
type === tt.doubleColon ||
|
type === tt.doubleColon ||
|
||||||
|
type === tt.hash ||
|
||||||
type.isAssign
|
type.isAssign
|
||||||
) {
|
) {
|
||||||
token.type = "Punctuator";
|
token.type = "Punctuator";
|
||||||
|
|||||||
@ -267,6 +267,17 @@ describe("babylon-to-espree", () => {
|
|||||||
assert.strictEqual(babylonAST.tokens[1].type, "Punctuator");
|
assert.strictEqual(babylonAST.tokens[1].type, "Punctuator");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Espree doesn't support the private fields yet
|
||||||
|
it("hash (token)", () => {
|
||||||
|
const code = "class A { #x }";
|
||||||
|
const babylonAST = babelEslint.parseForESLint(code, {
|
||||||
|
eslintVisitorKeys: true,
|
||||||
|
eslintScopeManager: true,
|
||||||
|
}).ast;
|
||||||
|
assert.strictEqual(babylonAST.tokens[3].type, "Punctuator");
|
||||||
|
assert.strictEqual(babylonAST.tokens[3].value, "#");
|
||||||
|
});
|
||||||
|
|
||||||
it.skip("empty program with line comment", () => {
|
it.skip("empty program with line comment", () => {
|
||||||
parseAndAssertSame("// single comment");
|
parseAndAssertSame("// single comment");
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user