Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: support bigint and dynamic import #415

Merged
merged 6 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity: this was added since eslint v6 don't support node <8?

we may consider dropping node <8, as it has been EOL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aladdin-add I assume that was the case (but hopefully @mysticatea can confirm). I think it makes sense to release a minor version of espree with this functionality if we can, and then we could do a major release to drop Node <8.


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