opennextjs / opennextjs-cloudflare

Open Next.js adapter for Cloudflare
https://opennext.js.org/cloudflare
MIT License
378 stars 8 forks source link

feat: Update ESLint config to fix imports/exports #109

Closed vicb closed 1 month ago

vicb commented 1 month ago

The previously used sort-imports can not fix the code.

Changed the plugins to ones that can auto-fix the code (i.e. on save, or via lint:fix). Getting an error without auto-fix was becoming frustrating.

changeset-bot[bot] commented 1 month ago

⚠️ No Changeset found

Latest commit: 1dc806d892d9124ec0ae686f1449ffce3987bc62

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

pkg-pr-new[bot] commented 1 month ago

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@109

commit: 1dc806d

petebacondarwin commented 1 month ago

In workers-sdk and in the vite-plugin-cloudflare projects we use Prettier to do the import ordering. See https://github.com/flarelabs-net/vite-plugin-cloudflare/pull/30/commits/1ad143fc19100534e473ac7873007a2e37d6bf55

This is nice because most people have formatting set up on-save in their IDEs, which keeps imports sorted all the time and avoids having to run eslint fix commands.

Could we consider that approach?

vicb commented 1 month ago

In workers-sdk and in the vite-plugin-cloudflare projects we use Prettier to do the import ordering. See flarelabs-net/vite-plugin-cloudflare@1ad143f

This is nice because most people have formatting set up on-save in their IDEs, which keeps imports sorted all the time and avoids having to run eslint fix commands.

Could we consider that approach?

Can we merge this PR to "unblock" me now and I'll create an issue for the follow up?

edit: it's also easy to run ESLint on save so that you does not have to execute the command edit2: also I have been delayed a bit but I still plan to work on a common eslint/prettier config to use across projects.