-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Proposed eslint rule additions #5456
Comments
If anyone has any thoughts on the above rules, or recommend additional rules that we should look into, please speak up. I'm hoping to have these rules added sometime over the next few weeks otherwise. |
@mramato can I get started on adding some of these to Cesium? |
👍
👍, except Does this apply to Cesium yet since it doesn't use Generally, I would say yes, but I'm not sure we should commit to it since this allows for some nice graphics code like http://www.realtimerendering.com/blog/looping-through-polygon-edges/ Perhaps just enable it and see how many exceptions the current code base needs. If it is only a few, just stay with it.
👎 This will be hard to reasonably enforce throughout the codebase, especially in areas of high algorithmic intensity. I expect there will be little return here and lots of frustration.
👍 Finally, please update the Coding Guide to be include anything new here. Throughout the Coding Guide, it would be useful to link to the specific ESLint doc as it often has more details and motivation than our guide. |
I've just been playing around to see how breaking these would be. no-use-before-define is the biggest I've tested with >900 errors. |
Many PR's open, which include these rules:
|
Should I enable the rule and silence the errors inline? |
Probably, unless there are dozens of these cases. We may come up with ideas to clean things up in the pull request. |
I might have assumed it does since
The rule has a special case for for loops (which I agree is a common and often desired use of sequences). So this rule is exactly what we do in our own code already and will allow for the code you linked to. |
I removed rules we either agreed worry worth it or were not what we ultimately wanted. I also moved |
All sounds good. |
@mramato Pretty sure it's ready to be bumped to 2.0! |
Open a PR to enable the 3 node rules, it most likely won't require any Cesium code changes (but update CHANGES.md to mention them), also bump the version. Once that's done, we'll merge and deploy and then we can update all of the other repositories. |
Ok! See #5540 |
2.0.0 has been published. Thanks @omh1280! |
I did a pass on all available rules on http://eslint.org/docs/rules/ and picked out ones that we probably want in Cesium. We'll want to test these out one by one to make sure the rule isn't already handled by some of the other rules we are already using. We can turn a bunch of these on at once, assuming they don't require a bunch of code changes. Rules that do require a bunch of code changes should be done separately. I didn't include any style rules since they will be part of #5369. I also didn't include rules that were likely never to come up (for example explicitly disallowing eval).
Things we definitely want (almost all of these were part of jsHint and long when moved to eslint)
Things we probably want (Similar guidelines already exist in our documentation)
Node only (only apply to other Cesium ecosystem projects)
Still want to evaluate, but level of effort not worth it right now
The text was updated successfully, but these errors were encountered: