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

arrow functions failing to be parsed correctly #49

Open
end-user opened this issue May 13, 2016 · 4 comments
Open

arrow functions failing to be parsed correctly #49

end-user opened this issue May 13, 2016 · 4 comments

Comments

@end-user
Copy link

If I use an arrow function in my js file, gulp-angular-filesort is throwing an error (e.g. "Error in parsing: "expert\controllers\ExpertViewController.js", Line 14: Unexpected token =>")

@cathrinevaage
Copy link

cathrinevaage commented Jun 20, 2016

Hardly any ES6 is supported I believe.
A workaround is to run the stream through babel before sorting it.

Make sure you have babel-preset-es2015 installed, and pipe the stream to gulp-babel like so

.pipe(babel({ presets: ['es2015'] }))
.pipe(angularFilesort())

@caffed
Copy link

caffed commented Jun 22, 2016

I believe it's the outdated version of ng-dependencies@0.3.0 it's using.

gulp
  .src('./**/*.js')
  .pipe(angularFilesort())
  .on('error', gutil.log)

[DATESTAMP] { [Error: Error in parsing: "FILE", Line NUMBER: Unexpected token =>]
  message: 'Error in parsing: "FILE", Line NUMBER: Unexpected token =>',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-angular-filesort',
  __safety: { toString: [Function: bound ] } }

This error is not present if I change the ng-dependencies version in ./node_modules/gulp-angular-filesort/package.json to 0.5.0.

Seems like overkill to babelify when it really only needs to parse the angular.module('name', [deps]) portion.

Were there any changes to ng-dependencies@0.5.0 in regard to AST building?

@voltuer
Copy link

voltuer commented Nov 17, 2017

this project is definitely abandoned, time for a fork i guess

@bbspearo12
Copy link

So is streaming through babel the only work around for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants