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

🐛 lint/a11y/noBlankTarget hangs while applying fix #676

Closed
1 task done
cianx opened this issue Nov 5, 2023 · 7 comments · Fixed by #686
Closed
1 task done

🐛 lint/a11y/noBlankTarget hangs while applying fix #676

cianx opened this issue Nov 5, 2023 · 7 comments · Fixed by #686
Assignees
Labels
A-CLI Area: CLI A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Comments

@cianx
Copy link

cianx commented Nov 5, 2023

Environment information

I have a simple react project I created with "yarn create vite", selecting  "react" and "Javascript" 

In the project directory, I run

yarn
yarn dlx @biomejs/biome init
yarn dlx @biomejs/biome check ./src

the check returns that it found 5 errors

if I run yarn dlx @biomejs/biome check ./src --apply biome hangs

What happened?

  1. biome hangs, with a cpu at 100%.

Expected result

A successful check run with any fixable errors fixed

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@cianx cianx changed the title 🐛 <TITLE> Check with "--apply" hangs Nov 5, 2023
@nhedger
Copy link
Member

nhedger commented Nov 5, 2023

Hi @cianx, thanks for opening an issue.

Are you able to share a repository that reproduces this behavior?

@cianx
Copy link
Author

cianx commented Nov 5, 2023

I included instruction to generate the code in the bug report. If you run yarn create vite and select "react" and "javascript" you will have the code. This is template code auto generated for the project.

@nhedger
Copy link
Member

nhedger commented Nov 5, 2023

Yes, thank you for these instructions, as they are vital.

If you allow me, I'd like to explain why providing a reproduction repository is important.

Between the moment you submit an issue, and when someone attempts to reproduce it, the skeleton on which the yarn create vite command is based may have changed. By providing a repository, you ensure that everyone has a copy of the same code, and you also help us troubleshoot faster.

Hope you understand.

@nhedger nhedger added the S-Needs repro Status: needs a reproduction label Nov 5, 2023
@nhedger nhedger changed the title Check with "--apply" hangs 🐛 Check with "--apply" hangs Nov 5, 2023
@cianx
Copy link
Author

cianx commented Nov 5, 2023

@nhedger
Copy link
Member

nhedger commented Nov 5, 2023

Thanks, much appreciated!

@nhedger nhedger added A-CLI Area: CLI and removed S-Needs repro Status: needs a reproduction labels Nov 5, 2023
@nhedger
Copy link
Member

nhedger commented Nov 6, 2023

I was able to narrow down the issue to the lint/a11y/noBlankTarget rule.

The following minimal reproduction produces the issue on Biome 1.3.3

function Reproduction () {
    return (
        <a href="https://vitejs.dev" target="_blank">
            <img src={viteLogo} className="logo" alt="Vite logo" />
        </a>
    )
}

Fixing the rule manually confirms that it's the one blocking the rest.

function Reproduction () {
    return (
-        <a href="https://vitejs.dev" target="_blank">
+		 <a href="https://vitejs.dev" target="_blank" rel="noreferrer">
            <img src={viteLogo} className="logo" alt="Vite logo" />
        </a>
    )
}

We seem to end up in a loop when applying the fix.

log (truncated for brevity)
biome lint --apply --log-level=debug ./test.jsx
  2023-11-06T16:04:29.511197Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.511250Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.511283Z DEBUG   changes [CommitChange { parent_depth: 10, parent: Some([email protected]), parent_range: Some((39, 93)), new_node_slot: 3, new_node: Some(Node([email protected])) }]
    at crates/biome_rowan/src/ast/batch.rs:310 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.511681Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.511704Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.511721Z DEBUG   changes [CommitChange { parent_depth: 13, parent: Some([email protected]), parent_range: Some((96, 109)), new_node_slot: 1, new_node: Some(Node([email protected])) }]
    at crates/biome_rowan/src/ast/batch.rs:310 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.512041Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.512059Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.512074Z DEBUG   changes [CommitChange { parent_depth: 13, parent: Some([email protected]), parent_range: Some((96, 122)), new_node_slot: 1, new_node: Some(Node([email protected])) }]
    at crates/biome_rowan/src/ast/batch.rs:310 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.512363Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.512380Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.512393Z DEBUG   changes [CommitChange { parent_depth: 13, parent: Some([email protected]), parent_range: Some((96, 135)), new_node_slot: 1, new_node: Some(Node([email protected])) }]
    at crates/biome_rowan/src/ast/batch.rs:310 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.512662Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

  2023-11-06T16:04:29.512678Z DEBUG  pushing change...
    at crates/biome_rowan/src/ast/batch.rs:294 on biome::worker_5
    in Processes linting with path: "./test.jsx"

@ematipico ematipico added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Nov 6, 2023
@nhedger nhedger changed the title 🐛 Check with "--apply" hangs 🐛 int/a11y/noBlankTarget hangs while applying fix Nov 6, 2023
@nhedger nhedger changed the title 🐛 int/a11y/noBlankTarget hangs while applying fix 🐛 lint/a11y/noBlankTarget hangs while applying fix Nov 6, 2023
@nhedger
Copy link
Member

nhedger commented Nov 6, 2023

Applying the quick fix via VS Code works.

Screen.Recording.2023-11-06.at.21.47.06.mov

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

Successfully merging a pull request may close this issue.

3 participants