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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃搸 Implement lint/noUselessLoneBlockStatements - eslint/no-lone-block #42

Closed
Conaclos opened this issue Aug 23, 2023 · 13 comments 路 Fixed by #499
Closed

馃搸 Implement lint/noUselessLoneBlockStatements - eslint/no-lone-block #42

Conaclos opened this issue Aug 23, 2023 · 13 comments 路 Fixed by #499
Assignees
Labels
A-Linter Area: linter good first issue Good for newcomers L-JavaScript Language: JavaScript and super languages

Comments

@Conaclos
Copy link
Member

Conaclos commented Aug 23, 2023

Description

no-lone-blocks.

Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide and analyzer contributing guide.

@Conaclos Conaclos added the A-Linter Area: linter label Aug 23, 2023
@Conaclos Conaclos changed the title 馃搸 Implement lint/noUselessLoneBlockStatements - eslint/no-lone-block` 馃搸 Implement lint/noUselessLoneBlockStatements - eslint/no-lone-block Aug 23, 2023
@Conaclos Conaclos added L-JavaScript Language: JavaScript and super languages good first issue Good for newcomers labels Aug 23, 2023
@ematipico
Copy link
Member

I think, in our case, the word "lone" can be dropped. I suggest noUselessBlock

@Conaclos
Copy link
Member Author

Conaclos commented Aug 28, 2023

I think, in our case, the word "lone" can be dropped. I suggest noUselessBlock

Not sure, because the rule concerns only "lone" block statements, i.e. block statements that are not attached to a if, else, while, function, ...

EDIT: The rule prohibits lone blocks that don't include any variables declaration.

Example of incorrect code:

{
  f();
}

{}

Example of correct ode:

{
  let x = 1;
}

// This is not a lone block
if (cond) {}

@ematipico
Copy link
Member

Thank you for clarifying! I would still remove "statement" from the word :) it's not beginner friendly

@emab
Copy link
Contributor

emab commented Oct 3, 2023

Hey there. I've been using Biome so would love to contribute. I'm fairly new to Rust, but willing to give this a go if you're ok with that?

@ematipico
Copy link
Member

Go ahead @emab , feel free to use this issue to ask any question, or even a draft pr

@emab
Copy link
Contributor

emab commented Oct 3, 2023

Great! Thank you.

@emab
Copy link
Contributor

emab commented Oct 8, 2023

Hi @ematipico, please can I check if I'm on the right path?

emab@62e85fe

@emab
Copy link
Contributor

emab commented Oct 8, 2023

I wasn't sure how to check for strict mode in one of my functions...

@Conaclos
Copy link
Member Author

Conaclos commented Oct 8, 2023

Please open a PR so that we can add comments :)

@emab
Copy link
Contributor

emab commented Oct 8, 2023

Opened, link above!

@emab
Copy link
Contributor

emab commented Oct 8, 2023

@Conaclos may I ask how I can have multiple valid / invalid test files? I want to include ones which are a module (by adding exports {}) and ones which are not in order to properly test the detection of functions in block statements.

@Conaclos
Copy link
Member Author

Conaclos commented Oct 8, 2023

@emab simply add other files, for example invalidXXXX.js.

For esm use js or ts extension. For script file (non-strict mode) you can use cjs extension.

@emab
Copy link
Contributor

emab commented Oct 8, 2023

@emab simply add other files, for example invalidXXXX.js.

For esm use js or ts extension. For script file (non-strict mode) you can use cjs extension.

Brilliant thank you, have updated the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter good first issue Good for newcomers L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants