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

8$: Warn on unused arrow expression #659

Open
strager opened this issue Mar 2, 2022 · 6 comments
Open

8$: Warn on unused arrow expression #659

strager opened this issue Mar 2, 2022 · 6 comments
Assignees
Labels
for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html good first issue Good for newcomers and C++ beginners

Comments

@strager
Copy link
Collaborator

strager commented Mar 2, 2022

useEffect(() => {
  // BUG: async arrow function not used.
  async () => {
    const userReviewsForEachAudiobook = await Promise.all(
      reviewsUrlList.map((review) => {
        return fetch(review).then((res) => res.json());
      })
    );
  };
}, [reviewsUrlList]);
@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 Mar 2, 2022
@strager
Copy link
Collaborator Author

strager commented Mar 2, 2022

I think this should be simple. In parse_and_visit_statement, when we parse an expression, and the expression is an arrow function, report a warning.

@singalhimanshu
Copy link
Contributor

I claim this for-hire task. I expect payment after I complete this task. I will email the quick-lint-js team if I am assigned this task.

@singalhimanshu
Copy link
Contributor

@strager which of these should report error_unused_arrow_function:

// 1.
async => {}
async => rhs;
// 2.
let => {}
// 3.
x => {}
// 4.
=> x + y

@strager
Copy link
Collaborator Author

strager commented Mar 19, 2022

@strager which of these should report error_unused_arrow_function:

1, 2, and 3.

4 should report a different diagnostic (E0105).

@jr-boney
Copy link

useEffect(() => {
(async () => {
const userReviewsForEachAudiobook = await Promise.all(
reviewsUrlList.map((review) => {
return fetch(review).then((res) => res.json());
})
);
})();
}, [reviewsUrlList]);

@strager
Copy link
Collaborator Author

strager commented Apr 27, 2024

@jr-boney I don't see any unused arrow expressions in your code. Are you seeing a bug in quick-lint-js related to your code?

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 good first issue Good for newcomers and C++ beginners
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants