Repository: babel/babel-eslint (js)

Issue:
The `type` of the hash(#) token is not a string.
I'm using babel-eslint@8.2.6.

Parsing the following source code with `babel-eslint` creates an invalid token.

```js
  export default class TouristNumber extends Vue {
    #pro1='hello'
  }
```

token:

```ts
Token {
  type: 
   TokenType {
     label: '#',
     keyword: undefined,
     beforeExpr: false,
     startsExpr: false,
     rightAssociative: false,
     isLoop: false,
     isAssign: false,
     prefix: false,
     postfix: false,
     binop: null,
     updateContext: null },
  value: undefined,
  start: 92,
  end: 93,
  loc: SourceLocation { start: { line: 4, column: 0 }, end: { line: 4, column: 1 } },
  range: [ 92, 93 ] }
```

The `type` of the token must be a string.
https://eslint.org/docs/developer-guide/working-with-custom-parsers#the-ast-specification

But the result is not a string.

I think that you should add `tt.hash` to [convertToken.js](https://github.com/babel/babel-eslint/blob/master/lib/babylon-to-espree/convertToken.js)

---

ref https://github.com/vuejs/eslint-plugin-vue/issues/814

Pull request description:
Fix to convert hash token.
Fixed #752 

This pull request makes the hash token of the class private field to be converted to the token specification of ESLint.

Patch:
diff --git a/lib/babylon-to-espree/convertToken.js b/lib/babylon-to-espree/convertToken.js
index 3e0ba45..2d8e9b1 100644
--- a/lib/babylon-to-espree/convertToken.js
+++ b/lib/babylon-to-espree/convertToken.js
@@ -44,6 +44,7 @@ module.exports = function(token, tt, source) {
     type === tt.bang ||
     type === tt.tilde ||
     type === tt.doubleColon ||
+    type === tt.hash ||
     type.isAssign
   ) {
     token.type = "Punctuator";


Test patch:
diff --git a/test/specs/babel-eslint.js b/test/specs/babel-eslint.js
index 849e37a..02328e8 100644
--- a/test/specs/babel-eslint.js
+++ b/test/specs/babel-eslint.js
@@ -267,6 +267,17 @@ describe("babylon-to-espree", () => {
     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", () => {
     parseAndAssertSame("// single comment");
   });