Skip to content

chore: de-duplicate lint config #10978

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

Closed
wants to merge 3 commits into from

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Mar 21, 2025

This just simplifies the lint config slightly by doing the following:

  • Separate vitest and jest rules from regular rules, so we can declare the regular rules once for both
  • Change vitestFiles to be computed in preparation for us moving more packages to vitest (so we don't end up with a bunch of very similar globs)

PR Checklist

This just simplifies the lint config slightly by doing the following:

- Separate vitest and jest rules from regular rules, so we can declare
  the regular rules once for both
- Change `vitestFiles` to be computed in preparation for us moving more
  packages to vitest (so we don't end up with a bunch of _very similar_
globs)
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @43081j!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Mar 21, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 2a12bdd
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/67df1994c274ec00087625c9
😎 Deploy Preview https://deploy-preview-10978--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 89 (🔴 down 10 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

nx-cloud bot commented Mar 21, 2025

View your CI Pipeline Execution ↗ for commit 2a12bdd.

Command Status Duration Result
nx test scope-manager ✅ Succeeded <1s View ↗
nx test eslint-plugin-internal ✅ Succeeded <1s View ↗
nx run types:build ✅ Succeeded <1s View ↗
nx test eslint-plugin ✅ Succeeded <1s View ↗
nx run-many --target=build --exclude website --... ✅ Succeeded 2s View ↗
nx run-many --target=clean ✅ Succeeded 17s View ↗
nx test visitor-keys ✅ Succeeded <1s View ↗
nx test utils ✅ Succeeded <1s View ↗
Additional runs (25) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-03-22 20:19:56 UTC

@@ -392,7 +394,6 @@ export default tseslint.config(
'packages/integration-tests/tools/integration-test-base.ts',
'packages/integration-tests/tools/pack-packages.ts',
],
ignores: vitestFiles,
Copy link
Contributor Author

@43081j 43081j Mar 21, 2025

Choose a reason for hiding this comment

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

this meant the various loosening rule options were not applying to vitest tests, but should be. so the previous PR duplicated them below in their own vitest section

moving it into a generic block that applies to all tests fixes this

Copy link
Member

Choose a reason for hiding this comment

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

TBH I'm kinda -1 on this. It's true that it's DRYer in the moment but the duplication will go away on its own once everything is in vitest, and if we need there to be drift between the jest/vitest parts then this makes it less flexible. So I think as-is makes good sense as a transitional approach, but it's marginal difference either way 🤷 Can go either way if others have opinions.

Copy link
Contributor Author

@43081j 43081j Mar 23, 2025

Choose a reason for hiding this comment

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

🤷‍♂️ I'm not tied to it enough to mind either way. It's very unlikely we will alter these rules between test frameworks since they're more to do with syntax and casts

Eventually the vitest rules merge into this block, and you remove the jest block. Or your duplicate in both and remove the jest block.

We achieve the same either way, just we duplicate the rules in the latter

kirkwaiblinger
kirkwaiblinger previously approved these changes Mar 22, 2025
Comment on lines +32 to +36
const vitestPackages = ['eslint-plugin-internal'];

const vitestFiles = vitestPackages.map(
name => `packages/${name}/tests/**/*.test.{ts,tsx,cts,mts}`,
);
Copy link
Member

Choose a reason for hiding this comment

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

IMO let's revert this part. It creates merge conflicts on all the vitest PRs for very marginal gain. We can trivially DRY this up once the in-progress PRs are merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise we're repeating somewhat lengthy globs an increasing amount over time. Hoping they stay in sync

I'd rather fix this now while there's only one instead of doing it later when there's many

@43081j
Copy link
Contributor Author

43081j commented Mar 23, 2025

Given you disagree with both parts of this pr, it seems pretty pointless now

I disagree with you on both counts for what it's worth. We shouldn't be duplicating rules, that's just a sign we got it wrong. And we shouldn't be duplicating globs because it increases maintenance burden as we add more and more of what's basically the same glob. It doesn't make sense to do this, it makes sense to have one glob that covers many packages

@kirkwaiblinger
Copy link
Member

Closing since I think this is fully superseded by the changes now on main (notably #11078)

@43081j 43081j deleted the simplify-lint-config branch April 29, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants