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

es6_arrow_functions transform leads to syntax error #238

Closed
unlight opened this issue Sep 29, 2024 · 1 comment · Fixed by #239
Closed

es6_arrow_functions transform leads to syntax error #238

unlight opened this issue Sep 29, 2024 · 1 comment · Fixed by #239
Labels
bug Something isn't working javascript

Comments

@unlight
Copy link

unlight commented Sep 29, 2024

// a.js
const dummyAnswer = type => {
  return {
    dataset: function (name, query) {
      return 1;
    },
  };
};

grit apply es6_arrow_functions ./grit --dry-run

    -const dummyAnswer = type => {
    -  return {
    -    dataset: function (name, query) {
    -      return 1;
    -    },
    +const dummyAnswer = (type) => {
    +    dataset: (name, query) => {
    +  return 1;
    +},
       };
    -};

Result:

const dummyAnswer = (type) => {
    dataset: (name, query) => {
  return 1;
},
  };

node a.js => SyntaxError: Unexpected token '}'

@morgante
Copy link
Contributor

Thanks for the report, fixed in #239.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working javascript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants