-
-
Notifications
You must be signed in to change notification settings - Fork 334
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
feat(chore): add lint using CI #2501
Conversation
Yes, code linting is definitely something we need to implement. I started using myself eslint at work and this is something i don't regret at all. But... 😅 We cannot implement it, and already use it to enforce merge requests. I think that first we need to define which rules we want to use and the level of error it'll raise. Then we can do some merge requests to fix the code. But we can't fix all the code in one PR, maybe a PR per component. Once this is done, then we can enforce lint check trough the CI pipeline. |
dc1171e
to
344266f
Compare
I have updated the PR, instead of using In another PR, more eslint rules can be added. Also don't worry about merge conflicts (from changes based on code before this PR), they can be easily resolved, just cherry pick the eslint rules and run |
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.
As the PR is basically ok now, i just comment instead of requesting changes as i would like to hear opinion of other maintainers. See my comments below
bc011e3
to
9074205
Compare
Maybe we need another eslint rule for semicolon, I will have a look on a solution for it. |
The solution is to run eslint Multiline expr. is indented correctly, thus IMHO it is better to have the semicolon on the same/last expr line, as the 2nd (and following) multiline expressions are indented visually already. related issue: eslint/eslint#15752 (the solution with |
Well, when adding the semicolon to the end of the last line, why the indention at all then (in such cases)? Also, you added the rule to add a trailing comma in object literals. The linter idea behind that is to easily exchange/adding/removing single lines without the need to also add another comma to the previous attribute notation. So: Adding the trailing comma but also adding a semicolon to the last entry is not consistent anymore (IMHO even worse) Now we have the discussion i basically want to avoid ;) And now imagine new contributors trying to help and we are going to argue about "correct" whitespacing :) Don't get me wrong, I am not against the linting. But indentin the semicolons would be the cleaner approach. Yes, this possibly needs a (onetime) manual adjustment if there is no 100% automatic solution. |
chained method call indentation is defacto standard (at least has always been in all codebase I have worked with) and it makes sense, as
is IMHO visually more readable and more compact than
You are right here, I have reviewed the changes and there are at least two usecases with semicolon on a NL: a) ternary: I have never seen semicolon on NL for them, also no reason for easier diffing, as ternary operator is always binary. b) var declaration: I will fix these manually 👍 |
For the record, I am positive on introducing linter. |
My point basically was about comparison to the trailing comma rule.
Thx 😊 |
((?:var|const|let)\n[^;]+^( +) [^;\n]+);\n +
regex: ;\n +\n + eslint fix /w review
(-|\+|%|/|\*|\|\||&&)(?<!( |\n) \*)$
PR is done, I added more whitespaces rules to match AirBnB CS (basically the rules are copied from their ruleset). The hash of minified Later, I plan to create another PR which will fix |
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.
LGTM! Thanks for doing this and your patience 😉
Like #2501, but for LESS. No functionality change.
Description
Unified CS improves readability, prevents hidden mistakes and enforce unified contribution standards. And in a long term, it also simplifies merge conflicts.
The CS rules are based on industry standard
eslint-config-airbnb-base
, but all rules might be too hard to fix at once. This PR focuses on whitespace CS which can be autofixed /wo having to review each line manually.related #29
nicely integrated with Github Actions like: