-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
jshint has problems with .catch #257
Comments
im not seeing that ... did you check it against the jshintrc rules I provided in my repos? |
I tried using the JSHint settings provided in the JSHint Section, which look to be the same in the ng-demos/modular project, but I still kept getting the same error. If those are the same setting you're using I'm not sure why I'm getting this error and you're not. After looking a little closer at the JSHint Options, the es5 Setting set to From the Docs:
If this is something you feel adds value I can submit a PR, but I'm a little hesitant since you're not experiencing the same behavior. There are so many great insights in this style guide. I've benefited from it a ton. So thanks for making this public. Much appreciated. |
Yeah, this is odd ... I havent looked deep at it, but I do not get any issues when I copy your exact code into my editor and I do not set the es5 setting at all. Let's keep this open for now and see if others get it |
closing due to no other people seeing this |
I have just faced the same issue. function (credentials) {
return DataService.login(credentials)
.then(loginSuccess)
.catch(loginError);
function loginSuccess(response) {}
function loginError(response) {}
} My jshint: {
src: [
'<%= app_files.js %>'
],
options: {
curly: true,
immed: true,
newcap: true,
noarg: true,
sub: true,
boss: true,
eqnull: true,
debug: true
},
globals: {}
}, Version of {
"name": "grunt-contrib-jshint",
"version": "0.4.3",
...
} |
Were you missing 'use strict;' ? |
@wardbell no, |
Weird. I dint get this. Old version of jshint? You might look here: http://jslinterrors.com/expected-an-identifier-and-instead-saw-a-a-reserved-word/ It suggests either the But like John I've never had to do anything special. |
Setting |
@johnpapa I know this a closed issue but I noticed that ASP.NET MVC bundling also have issues with .catch throwing an error and actually does not menify the code. How the resulting bundle looks: /* Minification failed. Returning unminified contents.
(514,18-23): run-time error JS1137: 'catch' is a new reserved word and should not be used as an identifier: catch
...
*/
(all the code here without being minified) A possible solution would be to change styles Y035 and Y060 to use the regular promises described on the AngularJS official docs: $http(req).success(function(){...}).error(function(){...}); |
I really appreciate the thought and effort that has gone into this style guide.
I'm running into problems using jshint and some of the examples used in the guide. For instance:
When my grunt process runs jshint I get:
A simple workaround is to use bracket notation (ew) for
catch
, but I personally find this unsavory. I tried providing the recommended.jshintrc
settings but had no luck. This could use a little clarification, but it could be user error on my part too.Thanks!
The text was updated successfully, but these errors were encountered: