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

Breaking: acorn to 8.1.0 (fixes #470) #473

Merged
merged 4 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"license": "BSD-2-Clause",
"dependencies": {
"acorn": "^7.4.0",
"acorn": "^8.1.0",
"acorn-jsx": "^5.3.1",
"eslint-visitor-keys": "^2.0.0"
},
Expand Down
16 changes: 15 additions & 1 deletion tests/lib/parse.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @fileoverview Tests for tokenize().
* @fileoverview Tests for parse().
aladdin-add marked this conversation as resolved.
Show resolved Hide resolved
* @author Nicholas C. Zakas
*/

Expand Down Expand Up @@ -105,5 +105,19 @@ describe("parse()", () => {
);
});

// https://github.com/eslint/espree/issues/470
it("Should throw on invaid `(a = 1) = t`", () => {
aladdin-add marked this conversation as resolved.
Show resolved Hide resolved
assert.throws(() => {
espree.parse("(a = 1) = t");
});
aladdin-add marked this conversation as resolved.
Show resolved Hide resolved
});

// https://github.com/eslint/espree/issues/472
it("Should throw on invaid `async () => await 5 ** 6;`", () => {
aladdin-add marked this conversation as resolved.
Show resolved Hide resolved
assert.throws(() => {
espree.parse("async () => await 5 ** 6;");
});
Copy link
Member

Choose a reason for hiding this comment

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

Similar to the above, we should set a higher ecmaVersion to confirm that #472 has been fixed, because this code with the default ecmaVersion already has syntax errors aside from await 5 ** 6.

Actually, it seems that this particular example doesn't throw in the latest Acorn 8.

Copy link
Member Author

Choose a reason for hiding this comment

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

interesting! if adding a {}, it will throw an error.

> acorn.parse('async() => { await 5 ** 6 }', {ecmaVersion: 10})
Uncaught [SyntaxError: Unexpected token (1:21)
] {
  pos: 21,
  loc: Position { line: 1, column: 21 },
  raisedAt: 23
}

sounds like a bug in acorn?

Copy link
Member Author

Choose a reason for hiding this comment

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

just removed the case, as it was not fixed in latest acorn. :)

});

});
});