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 missing semicolon before (expression) or [array] #1090

Open
strager opened this issue Oct 10, 2023 · 2 comments
Open

12$: warn on missing semicolon before (expression) or [array] #1090

strager opened this issue Oct 10, 2023 · 2 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 Oct 10, 2023

    nextConfig.push({
      proxied_site: "http://localhost:1337",
      port: 8084,
      early_hints: [
        {
          type: "style",
          url: "/style.css",
        },
        {
          type: "script",
          url: "/script.js",
        },
      ],
    })  // WARNING: Missing semicolon or confusing indentation
    ({ statusLine, headers } = await makeProxyRequest());
foo()  // WARNING: Missing semicolon or confusing indentation
[a, b].forEach(f)
@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 Oct 10, 2023
@strager
Copy link
Collaborator Author

strager commented Oct 10, 2023

Idea for the logic for when to report the warning:

  1. Found a ( or [ in parse_expression_remainder
  2. ( or [ has a leading newline
  3. The ('s or ['s column is equal to the statement start's column

Logic 3 is hard to implement currently because quick-lint-js does not track column numbers. Perhaps we can get away with just logic 1 and 2. We would need to check the rate of false positives to decide whether we need logic 3 or not.

@strager strager changed the title 12$: warn on missing semicolon before (expression) 12$: warn on missing semicolon before (expression) or [array] Oct 10, 2023
@strager
Copy link
Collaborator Author

strager commented Oct 10, 2023

We need to make sure that a semicolon is legal before reporting the warning. In the following example, a semicolon is not legal before (y) or [z], so we should not report any diagnostic:

let x = (
  f()
  (y)
  [z]
);

@strager strager removed the good first issue Good for newcomers and C++ beginners label Oct 10, 2023
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

1 participant