Skip to content

Commit

Permalink
Update: support bigint and dynamic import (#415)
Browse files Browse the repository at this point in the history
* fix a failing test with acorn 6.2.0

* update acorn

* fix CI failure

* update eslint-visitor-keys

* Upgrade: acorn@^7.0.0, eslint-visitor-keys@^1.1.0

* Chore: Fix invalid-new-import fixture index/column

Looks like the fixture previously assumed the `expression` node would be where the error is located, but it looks like the error is located at the `import` token instead.
  • Loading branch information
mysticatea authored and platinumazure committed Aug 14, 2019
1 parent d34c40e commit f5e58cc
Show file tree
Hide file tree
Showing 41 changed files with 1,693 additions and 714 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
!.eslintrc.js
/node_modules
/tests/fixtures
/tools
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: node_js
sudo: false
node_js:
- 6
- 7
Expand All @@ -8,5 +7,10 @@ node_js:
- 10
- 11
- 12

script:
- if [ $TRAVIS_NODE_VERSION -ge 8 ]; then node Makefile.js lint; fi
- node Makefile.js test

after_success:
- npm run coveralls
2 changes: 1 addition & 1 deletion espree.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ exports.Syntax = (function() {
}

for (name in astNodeTypes) {
if (astNodeTypes.hasOwnProperty(name)) {
if (Object.hasOwnProperty.call(astNodeTypes, name)) {
types[name] = astNodeTypes[name];
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/espree.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function normalizeEcmaVersion(ecmaVersion = DEFAULT_ECMA_VERSION) {
case 8:
case 9:
case 10:
case 11:
return version;

// no default
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
},
"license": "BSD-2-Clause",
"dependencies": {
"acorn": "^6.0.7",
"acorn": "^7.0.0",
"acorn-jsx": "^5.0.0",
"eslint-visitor-keys": "^1.0.0"
"eslint-visitor-keys": "^1.1.0"
},
"devDependencies": {
"browserify": "^7.0.0",
"chai": "^1.10.0",
"eslint": "^5.7.0",
"eslint": "^6.0.1",
"eslint-config-eslint": "^5.0.1",
"eslint-plugin-node": "^8.0.0",
"eslint-release": "^1.0.0",
Expand Down
77 changes: 77 additions & 0 deletions tests/fixtures/ecma-version/11/bigint/binary.result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"range": [
0,
7
],
"body": [
{
"type": "ExpressionStatement",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"range": [
0,
7
],
"expression": {
"type": "Literal",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"range": [
0,
7
],
"value": null,
"raw": "0b0101n",
"bigint": "0b0101"
}
}
],
"sourceType": "script",
"tokens": [
{
"type": "Numeric",
"value": "0b0101n",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"range": [
0,
7
]
}
]
};
1 change: 1 addition & 0 deletions tests/fixtures/ecma-version/11/bigint/binary.src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0b0101n
77 changes: 77 additions & 0 deletions tests/fixtures/ecma-version/11/bigint/decimal.result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
},
"range": [
0,
2
],
"body": [
{
"type": "ExpressionStatement",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
},
"range": [
0,
2
],
"expression": {
"type": "Literal",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
},
"range": [
0,
2
],
"value": null,
"raw": "1n",
"bigint": "1"
}
}
],
"sourceType": "script",
"tokens": [
{
"type": "Numeric",
"value": "1n",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 2
}
},
"range": [
0,
2
]
}
]
};
1 change: 1 addition & 0 deletions tests/fixtures/ecma-version/11/bigint/decimal.src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1n
77 changes: 77 additions & 0 deletions tests/fixtures/ecma-version/11/bigint/hex.result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 5
}
},
"range": [
0,
5
],
"body": [
{
"type": "ExpressionStatement",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 5
}
},
"range": [
0,
5
],
"expression": {
"type": "Literal",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 5
}
},
"range": [
0,
5
],
"value": null,
"raw": "0x80n",
"bigint": "0x80"
}
}
],
"sourceType": "script",
"tokens": [
{
"type": "Numeric",
"value": "0x80n",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 5
}
},
"range": [
0,
5
]
}
]
};
1 change: 1 addition & 0 deletions tests/fixtures/ecma-version/11/bigint/hex.src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x80n
6 changes: 6 additions & 0 deletions tests/fixtures/ecma-version/11/bigint/invalid-float.result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
"index": 3,
"lineNumber": 1,
"column": 4,
"message": "Identifier directly after number"
};
1 change: 1 addition & 0 deletions tests/fixtures/ecma-version/11/bigint/invalid-float.src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0n
77 changes: 77 additions & 0 deletions tests/fixtures/ecma-version/11/bigint/octal.result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"range": [
0,
6
],
"body": [
{
"type": "ExpressionStatement",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"range": [
0,
6
],
"expression": {
"type": "Literal",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"range": [
0,
6
],
"value": null,
"raw": "0o755n",
"bigint": "0o755"
}
}
],
"sourceType": "script",
"tokens": [
{
"type": "Numeric",
"value": "0o755n",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"range": [
0,
6
]
}
]
};
1 change: 1 addition & 0 deletions tests/fixtures/ecma-version/11/bigint/octal.src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0o755n
Loading

0 comments on commit f5e58cc

Please sign in to comment.