Skip to content

Commit 87b8cad

Browse files
author
Mat Brown
committed
Upgrade esprima
Upgrades esprima to 4.0.0. This required switching from a default import to named imports, which somehow stymied me for months, but I’m pretty sure was all we needed to do the whole time.
1 parent 43316a3 commit 87b8cad

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
"css": "^2.2.1",
161161
"enumify": "^1.0.4",
162162
"es6-set": "^0.1.4",
163-
"esprima": "^3.0.0",
163+
"esprima": "^4.0.0",
164164
"github-api": "^3.0.0",
165165
"hast-util-sanitize": "^1.1.1",
166166
"highlight.js": "^9.12.0",

src/validations/javascript/esprima.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import esprima from 'esprima';
1+
import {parse, tokenize} from 'esprima';
22
import find from 'lodash/find';
33
import inRange from 'lodash/inRange';
44
import Validator from '../Validator';
@@ -80,10 +80,10 @@ class EsprimaValidator extends Validator {
8080

8181
async _getRawErrors() {
8282
try {
83-
esprima.parse(this._source);
83+
parse(this._source);
8484
} catch (error) {
8585
try {
86-
const tokens = esprima.tokenize(
86+
const tokens = tokenize(
8787
this._source,
8888
{range: true, comment: true},
8989
);

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3760,7 +3760,7 @@ espree@^3.5.2:
37603760
acorn "^5.4.0"
37613761
acorn-jsx "^3.0.0"
37623762

3763-
esprima@3.x.x, esprima@^3.0.0, esprima@^3.1.3:
3763+
esprima@3.x.x, esprima@^3.1.3:
37643764
version "3.1.3"
37653765
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
37663766

0 commit comments

Comments
 (0)