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

ESLint: error on missing lint ignore comments #7829

Merged
merged 9 commits into from
Mar 6, 2024
Merged

Conversation

fungairino
Copy link
Collaborator

@fungairino fungairino commented Mar 6, 2024

What does this PR do?

  • Starts to fix the newly enabled rule for enforcing explanations on eslint ignores
  • I updated the new-cap rule so we don't have to ignore it a bunch
  • There is one functional change I pointed out.

102 errors remaining

values: serviceContext,
});
}
await Promise.all(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only functional change in the PR. This should be safe (and more efficient)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have an asyncForEach helper so you don't have to use a map that doesn't return anything

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember that helper, but it looks like it no longer exists?

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.63%. Comparing base (c315c5d) to head (8b82924).
Report is 3 commits behind head on main.

❗ Current head 8b82924 differs from pull request most recent head 90580d9. Consider uploading reports for the commit 90580d9 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7829      +/-   ##
==========================================
- Coverage   72.63%   72.63%   -0.01%     
==========================================
  Files        1274     1274              
  Lines       39886    39882       -4     
  Branches     7403     7404       +1     
==========================================
- Hits        28973    28969       -4     
  Misses      10913    10913              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@twschiller twschiller changed the title enforce comments ESLint: error on missing lint ignore comments Mar 6, 2024
.eslintrc.js Outdated
"new-cap": [
"error",
{
capIsNewExceptionPattern: "(TEST_|INTERNAL_|HACK_)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

src/mods/useMods.test.ts Outdated Show resolved Hide resolved
// https://github.com/pixiebrix/pixiebrix-extension/issues/7725
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion
// https://github.com/pixiebrix/pixiebrix-extension/issues/7725
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion -- email is required
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ! comments, I'd expect to see an explanation of how we know it's non null

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this one in particular will be fixed soon by @BLoe 's work.

// https://github.com/pixiebrix/pixiebrix-extension/issues/7725
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion
// https://github.com/pixiebrix/pixiebrix-extension/issues/7725
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always assumed "comment on top" was supported. It turns out it isn't yet :(

I think it's supported for @ts-* comments though

.eslintrc.js Show resolved Hide resolved
src/background/setToolbarIconFromTheme.test.ts Outdated Show resolved Hide resolved
containerElement.children[0].children[0].children[0] = listElement;

const { container } = renderDocumentPreview(containerElement);

// Select a dropdown inside a Col in List and open it
await userEvent.click(
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access -- see test's TODO comment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: A single /* eslint-disable testing-library/no-container, testing-library/no-node-access */ might be best

Copy link

github-actions bot commented Mar 6, 2024

No loom links were found in the first post. Please add one there if you'd like to it to appear on Slack.

Do not edit this comment manually.

@fungairino fungairino merged commit 3a22a20 into main Mar 6, 2024
19 checks passed
@fungairino fungairino deleted the enforce-comments branch March 6, 2024 16:52
@twschiller twschiller added this to the 1.8.11 milestone Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants