Fix Out-Of-Order Variable Declarations #989
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following #988, I decided to see if lgtm.com would be useful for enforcing chai's coding style guidelines. I'm not sure if this is the sort of thing you'd be interested in, but I'd love to hear feedback either way.
I wrote a query for variable declaration order, and you can see the results it produces for chai (and mozilla's pdf.js for comparison) here: https://lgtm.com/query/1983330216/lang:javascript/
Currently it's quite a broad query, and has many results in test code, but I can make it more specific if you'd like, and exclude certain results, e,g:
I'm not sure whether you'd like to include this query in this repository, but it does have some interesting results, some of which I've addressed in a separate commit, and we could start to write further queries. We do have plans to allow projects to run their own custom queries as part of pull request integration soon, but we don't currently have a timeline for that.
If you like this sort of contribution, I can write queries for some of your other guidelines to see what we can find.
Full Disclosure: I'm a core developer at lgtm.com