Skip to content
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

12$: warn on '} if' on same line with no 'else' #1217

Open
strager opened this issue Apr 24, 2024 · 5 comments
Open

12$: warn on '} if' on same line with no 'else' #1217

strager opened this issue Apr 24, 2024 · 5 comments
Labels
for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html

Comments

@strager
Copy link
Collaborator

strager commented Apr 24, 2024

if (x) {
} if (y) {  // warn please!
}
if (x) { } if (y) { }  // unsure if we should warn...

Inspiration: https://twitter.com/tsoding/status/1782676054093533328

@strager strager added good first issue Good for newcomers and C++ beginners for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html labels Apr 24, 2024
@strager
Copy link
Collaborator Author

strager commented Apr 24, 2024

Proposed logic:

After parsing the { } body of an if, check if the next token is Token_Type::kw_if and if has_leading_newline is false. If yes, then warn.

@qnguyen1013
Copy link

Hey Strager, I'm a recent cs college grad and am trying to get into open source, would love to try and tackle this issue!

@strager
Copy link
Collaborator Author

strager commented Apr 27, 2024

@qnguyen1013 Sure thing! Here are our contribution guides: https://quick-lint-js.com/contribute/

If you need any help, let me know.

@singalhimanshu
Copy link
Contributor

hi @strager would like to take this issue if no one else is actively working on it.

@NilayPatel10721
Copy link

hi @strager please assigned me this ,i want to work on this

@strager strager removed the good first issue Good for newcomers and C++ beginners label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html
Projects
None yet
Development

No branches or pull requests

4 participants