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

chore(eslint): add rules to enforce consistent type imports and deterministic import orders #5531

Merged
merged 13 commits into from
Feb 12, 2024

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Jan 20, 2024

Description

Enforcing consistent type imports and deterministic (ordered by type + alphabetical) import orders will help us reduce time spent on resolving diffs conflicts & performing code reviews

What to review

This PR consists of discrete commits that could be reviewed individually:

  • Removes usage of import React from 'react' (thanks to @binoy14 for chore: removes React imports due to new jsx transform #5522), and enables jsx: 'automatic' with esbuild-register in dev server
  • upgrades various eslint dependencies to latest
  • adds rules to enforce consistent imports and type imports
  • runs eslint --autofix on all sourcefiles (this is the big one, and can be skipped)
  • a handful commits that manually fixes some issues that surfaced after rewriting import statements

Note: looks like the eslint CI workflow is being run with config from next, so it currently fails here, but it passes locally, and will likely pass once we merge this branch.

I have tested quite extensively and not found any issues beyon the ones already fixed here.

Testing

Notes for release

n/a

@bjoerge bjoerge requested a review from a team January 20, 2024 13:30
@bjoerge bjoerge requested a review from a team as a code owner January 20, 2024 13:30
@bjoerge bjoerge requested review from sjelfull and juice49 and removed request for a team January 20, 2024 13:30
Copy link

vercel bot commented Jan 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Feb 9, 2024 1:12pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 9, 2024 1:12pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Feb 9, 2024 1:12pm

@bjoerge bjoerge requested review from rexxars and robinpyon and removed request for thebiggianthead January 20, 2024 13:30
Copy link

socket-security bot commented Jan 20, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@eslint-community/[email protected] None 0 431 kB eslint-community-bot
npm/@types/[email protected] None 0 23.2 kB types
npm/@typescript-eslint/[email protected] Transitive: environment, eval, filesystem, shell, unsafe +119 56.9 MB jameshenry
npm/@typescript-eslint/[email protected] Transitive: environment, eval, filesystem, shell, unsafe +114 53.8 MB jameshenry
npm/@typescript-eslint/[email protected] None +2 787 kB jameshenry
npm/@typescript-eslint/[email protected] None 0 156 kB jameshenry
npm/@typescript-eslint/[email protected] Transitive: environment, filesystem +33 42.8 MB jameshenry
npm/@typescript-eslint/[email protected] None +1 175 kB jameshenry
npm/[email protected] Transitive: environment, eval, filesystem, shell, unsafe +91 10.6 MB lydell
npm/[email protected] Transitive: environment, eval, filesystem, shell, unsafe +106 11.2 MB javierbrea
npm/[email protected] filesystem, unsafe Transitive: environment, eval, shell +168 16.8 MB ljharb
npm/[email protected] Transitive: environment, eval, filesystem, shell, unsafe +98 19.3 MB jounqin
npm/[email protected] Transitive: environment, eval, filesystem, shell, unsafe +91 10.6 MB lydell
npm/[email protected] Transitive: environment, eval, filesystem, shell, unsafe +121 56.9 MB sweepline
npm/[email protected] environment, filesystem Transitive: eval, shell, unsafe +90 10.6 MB eslintbot
npm/[email protected] environment, filesystem, unsafe +4 355 kB jonaskello

🚮 Removed packages: npm/@eslint-community/[email protected], npm/@sanity/[email protected], npm/@types/[email protected], npm/@typescript-eslint/[email protected], npm/@typescript-eslint/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

Copy link
Contributor

github-actions bot commented Jan 20, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Jan 20, 2024

Component Testing Report Updated Feb 9, 2024 1:15 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 32s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 13s 3 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 13s 4 2 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 33s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 19s 9 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 59s 18 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 15s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 20s 9 0 0

@bjoerge bjoerge force-pushed the chore/consistent-imports branch from 7d06695 to 4b97f76 Compare January 20, 2024 15:02
@bjoerge bjoerge force-pushed the chore/consistent-imports branch from 4b97f76 to 98b17d1 Compare January 20, 2024 19:18
@bjoerge bjoerge force-pushed the chore/consistent-imports branch from 98b17d1 to 31b67d7 Compare January 20, 2024 21:44
@bjoerge bjoerge force-pushed the chore/consistent-imports branch from 31b67d7 to f1e404f Compare January 21, 2024 16:41
@bjoerge bjoerge force-pushed the chore/consistent-imports branch from f1e404f to 5d47343 Compare January 21, 2024 16:54
@bjoerge bjoerge force-pushed the chore/consistent-imports branch from 5d47343 to 3cbc5c3 Compare January 21, 2024 19:55
Copy link
Contributor

@binoy14 binoy14 left a comment

Choose a reason for hiding this comment

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

Hard to review the files, github just crashes and even typing this there is so much lag 😅 but all checks passes so trusting it works. Maybe we can do a canary bump and check in couple studios to be sure.

Also thanks a lot for getting it across the line!

@bjoerge bjoerge added this pull request to the merge queue Feb 12, 2024
Merged via the queue into next with commit c96bf52 Feb 12, 2024
41 checks passed
@bjoerge bjoerge deleted the chore/consistent-imports branch February 12, 2024 07:13
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