-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(config): Deprecate JSHint in favor of ESLint #1097
Conversation
One thing to keep in mind is that we've decided on using John Papa's Angular Style-guide. I haven't taken a close look at this PR, but does the ESLint configuration take this into consideration? Or are there conflicting styles? |
ESLint itself has only general purpose JS linting, but the plugin I've added has the ability to lint Angular apps. As they write in the summary: "some rules defined in John Papa's Guideline have been implemented". I just don't know how the defaults follow your conventions. |
@feimosi Thanks for the PR! I am in favor of ESLINT, however, it doesn't match our style guide currently. There are a lot of linting errors, and the handful that I picked out and looked at I do not agree with. Ex.) Ex.) Can you go through the errors and see if we can adjust the linter accordingly. If there are actual issues somewhere, fix those in a separate PR to make this PR pass the tests. Thanks! |
@codydaig Ok, sure, I'll go through them when I find some time. |
@codydaig, I am confused by this - typo?
|
@feimosi I am in favor of this PR, but have questions about maintaining a single eslintrc file for this project. I noticed that you have added the reference to angular default config, but I am curious what you have noticed when running these rules against the server-side files. Also, I have not seen much progress with adopting the style guide - are these rules failing? Should nodejs lint rules be separated from angularjs rules? Can they be the same and still be restrictive enough? |
@rhutchison sorry, I wasn't available lately to take care of this PR. |
@feimosi still have lots of errors in the build. Can you take a look at them? |
@@ -66,6 +66,9 @@ | |||
}, | |||
"devDependencies": { | |||
"coveralls": "^2.11.4", | |||
"eslint-config-airbnb": "^2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be ~
@feimosi can you rebase and fix up some of the changes requested above so we can merge? |
@ilanbiala I need some more time for this PR. Too busy these days. |
I had too disable eslint and rely only on jshint because it gave me too many warnings on code I migrated. The --fix option in the command line eslint is also broken so I couldn't fix the thousands of indentation errors which were cluttering my screen. |
@trendzetter I don't think anyone has corrected errors automatically. |
dc678ad
to
c642da7
Compare
@trendzetter Last time I tried autocorrect it was working pretty badly, so I wouldn't rely on it. |
@feimosi there shouldn't be any errors. JSHint never had any, so we should be able to switch to ESLint with whatever properties there and still not have any errors. |
@ilanbiala The linting rules are already very loose and there are many inconsistencies throughout the codebase. If I mute the given errors, the sense of using ESLint slowly fades out. |
I could reduce the indentation and other styling errors for code I imported from close to 2000 to 10 using js-beautify |
It's quite obvious that this PR should bring with it actual fixes to all the errors and warnings so that eslint can actually go in. |
@ilanbiala we can figure out which rules trigger errors and discuss on whether we should 'drop the rule' to make it compatible with what we have today or adopt that rule and make the necessary changes. |
Yeah, that sounds fine. First we need to rebase and go over each type of error we currently get. Though I'd rather rebase because some code will change and the errors may disappear/more may appear. |
That was exactly my point. ESLint introduces much more new rules, so they should be discussed by the core team and decided whether to keep them or not. |
@feimosi can you point us to the new ones/ones we don't use specifically? Also, can you rebase before we go any further? |
c642da7
to
858f98b
Compare
@ilanbiala These rules are failing:
You can always check it with this command: |
I'm all up for it. |
@lirantal I think that's fine that we have console statements and putting the comment above seems like clutter, no? |
@feimosi can you rebase and squash? |
@ilanbiala yeah not the end of the world. |
8f3562d
to
62d3e91
Compare
Done, you'd better hurry with that merge. It starts to get boring fixing the merge conflicts all the time. |
@feimosi there are some build errors, can you take a look? |
@@ -68,6 +68,8 @@ | |||
}, | |||
"devDependencies": { | |||
"coveralls": "~2.11.6", | |||
"eslint": "~2.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete JSHint dependencies too and remove .jshintrc.
62d3e91
to
717470c
Compare
717470c
to
349f16d
Compare
Add basic ESLint setup extending well-known Airbnb code style. Fixes meanjs#1072, meanjs#1097
349f16d
to
d14d513
Compare
@ilanbiala everything's done |
I just restarted the build. Looks like a connectivity/time-out error. |
LGTM, merging. @feimosi thanks for the hard work and following up on this every time! |
feat(config): Deprecate JSHint in favor of ESLint
@feimosi Yes, thank you for all the hard work! No more complex/unnecessary ternary's, among other styling issues you fixed here ;) |
Thanks too, I'm glad I could help! :) |
WooHoo!! |
Add basic ESLint setup extending well-known Airbnb code style. Fixes meanjs#1072, meanjs#1097
I am not happy, has any of you written any amount of code with this enabled? It's really unbearable. It should be possible to turn this strict cosmetic mode off when you are not writing code for the meanjs framework itself. If you are writing application logic this is just too distracting, you just want to get something moving first and then brush it up. |
// fileName: 'access-%DATE%.log', // if rotating logs are active, this fileName setting will be used | ||
// frequency: 'daily', | ||
// verbose: false | ||
// } | ||
//} | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That extra space breaks indentation here, now space to the next level is 1 space. Was it required by eslint? Should the whole block be moved by one space instead?
These lint errors are making me angry, sorry for the ranting. I found I can skip rules by setting them them 0 in .eslintrc rules. I am giving it another shot at cleaning things up with the best beautification tricks found so far. |
Just tried the eslint cli again and it has improved in recent times. It now is able to fix some issues automatically using the --fix flag. You would expect it to fix more issues automatically but at least its a beginning. |
This is the basic ESLint setup extending well-known Airbnb code style and dedicated Angular rules.
What also has changed:
client.views
path in gulp watch, possibly we can think of using some html linterenvironment
property, still I'd recommend not using / limit the use of global variables by dependency injectionReferences #1072