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

refactor(eslint)!: Prepare eslint for rollup 3 and upgrade eslint to newest version #1236

Closed
wants to merge 2 commits into from

Conversation

colingm
Copy link
Contributor

@colingm colingm commented Aug 9, 2022

Rollup Plugin Name: plugin-eslint

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

Prior to these changes, the eslint plugin was using an older
version of eslint that relied on a class called CLIEngine.
In newer versions this has now been deprecated and so upgrading
versions required also updating to using ESLint internally
instead. Ultimately this doesn't change the usage of the plugin
but some of the option names have changed for ESLint (notably
configFile needs to change to overrideConfigFile).

The main driving factor for this change is to prevent conflicts
that happen when using @rollup/plugin-typescript and this plugin
together. Without this update, eslint would run on the transpiled
code and so the error messages weren't as helpful. This update
will allow the two plugins to work well together and provide
helpful information about errors and warnings.

This work is also preparing eslint for the move to rollup 3 through
various package version updates.

BREAKING CHANGES:

This work is also based on this abandoned pr: #663

@colingm colingm changed the title Upgrading eslint to newest version refactor(eslint): Upgrading eslint to newest version Aug 9, 2022
Copy link
Collaborator

@shellscape shellscape left a comment

Choose a reason for hiding this comment

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

Nice work, thanks for taking this on.

I'd also like to update the engines in package.json https://github.com/rollup/plugins/pull/1236/files#diff-83ca08b9de9168d7d59366dc40f4e5a4590a7645790563ad6c9fbb9699e053a1R18-R20 to >= 14 so we're in line with LTS.

@shellscape shellscape changed the title refactor(eslint): Upgrading eslint to newest version refactor(eslint)!: upgrade eslint to newest version Aug 9, 2022
@colingm
Copy link
Contributor Author

colingm commented Aug 9, 2022

@shellscape I will update the readme and the engine. Quick question about working with pnpm, I noticed there were a ton of changes to the pnpm-lock.yaml and I didn't want to commit some of them (things like the image below). Should I just not worry about those and commit all changes to that file?
image

@shellscape
Copy link
Collaborator

Good eye. Those are because we're still on the lockfile format from pnpm v6.34.0. I have it on my list to update that, but haven't gotten around to it yet. You'll want to use pnpm v6.34.0 to update the lockfile (run pnpm install from the repo root). I'd recommend checking the lockfile out from master first.

@shellscape
Copy link
Collaborator

Looks like you might need to run pnpm lint

@colingm
Copy link
Contributor Author

colingm commented Aug 9, 2022

any ideas?
image

@shellscape
Copy link
Collaborator

You're going down the rabbit hole now. There may be a version conflict between the version of eslint installed for the repo, and the version installed for the rollup eslint plugin. We're hoisting eslint in the monorepo to make it work correctly across all the projects. The version installed for the repo is a direct dep of https://github.com/rollup/eslint-config-rollup/blob/master/package.json#L28.

I'll update that later today and we'll try running CI here again

@colingm
Copy link
Contributor Author

colingm commented Aug 9, 2022

yeah it looks like it is because @typescript-eslint: 4.90 in plugins only works with eslint v7, with this update I would need to update @typescript-eslint to v5

@shellscape
Copy link
Collaborator

Yeah I'll get that updated. It's about time anyhow

@colingm
Copy link
Contributor Author

colingm commented Aug 9, 2022

I'm sure you will find this out soon enough but as a heads up it looks like just a straight upgrade of @typescript-eslint results in quite a few things popping up for me
image

@shellscape
Copy link
Collaborator

Turns out my editor has a plugin that doesn't support ESLint v8 so I'm working on fixing that now. Then I'll get our eslint config updated, update master, and then you can rebase from upstream. I'll keep you posted.

@shellscape
Copy link
Collaborator

Updating ESLint nuked my editor (Atom) ability to format on the fly, so now I'm trying to fix an abandoned prettier-atom plugin lol. Rabbit hole.

@shellscape
Copy link
Collaborator

Tried to fix the config issues in your fork, but it's going to require a master branch fix. Will keep you posted.

@colingm
Copy link
Contributor Author

colingm commented Aug 9, 2022

@shellscape seems like I have cursed you 😅 if you want I can work on updating the @typescript-eslint in my fork as well as long as you have some guidance for what you would like to see happen with errors like the member-ordering ones in my image above (maybe the answer is turn off those rules)

@colingm
Copy link
Contributor Author

colingm commented Aug 16, 2022

@shellscape checking back in, anything I can do to help out with upgrading @typescript-eslint? I was able to upgrade locally and get lint to pass (had to move some constructors)

@shellscape
Copy link
Collaborator

I ran into a major hurdle with my editor (Atom. I know, I know) and the linter plugins and ESLint v8 that I'm still trying to resolve. Planning on getting back to that soon.

@shellscape
Copy link
Collaborator

OK got everything working. Now, it gets dicey how this has to happen. Because of the hoisting of ESLint, we need to update the dependency only on the eslint rollup plugin in packages, and then update the eslint-config-rollup package in the root, then fix all of the errors (the import plugin is especially heinous as there were some breaking changes with how it views *.d.ts files without an accompanying .js file), and then push that to master. Once that's done, we need to rebase your fork+branch off of upstream/master. It's bananas but this eslint plugin is a special case. I should have some time in the next few days to make all that happen and then we can get this moving foward.

@colingm
Copy link
Contributor Author

colingm commented Aug 24, 2022

@shellscape I know you are probably quite busy so I don't want to bother you too much, but let me know if there is any step of the above process I can help with to make it smoother, would love to unblock this

@shellscape
Copy link
Collaborator

I still have this on my radar, not to worry

@colingm
Copy link
Contributor Author

colingm commented Sep 22, 2022

@shellscape anything I can do to help out?

@shellscape
Copy link
Collaborator

Thanks for checking in. I haven't lost track of this yet, not to worry.

@lukastaegert
Copy link
Member

lukastaegert commented Oct 1, 2022

Hi! I just created a bunch of PRs to update all plugins for Rollup 3. These will be major version bumps as we explicitly drop Node < 14 compatibility. It would be nice if we could merge the ESLint PR with yours. It so happens that the repo ESLint issues should be solved now as well as I also updated the Repo-wide ESLint version in the process.

I also wanted to update all plugin dependencies but actually happened to give up on this one 😱

Suggestion:

  • Can you rebase on the branch repo/rollup-3-updates and merge the changes from fix(eslint): prepare for Rollup 3 #1296 into your PR?
  • Change the PR target to the branch repo/rollup-3-updates instead of master
  • Make sure to list both your breaking change and Node 14 compatibility in the BREAKING CHANGES of the commit message
  • Adapt the PR title to include "prepare for Rollup 3" so that I do not overlook it?

If you do that, then I will close #1296 and merge your PR instead together with the other PRs in the next days.

@colingm
Copy link
Contributor Author

colingm commented Oct 2, 2022

@lukastaegert i will go ahead and take care of all that on Monday morning EST, thank you!

Prior to these changes, the eslint plugin was using an older
version of eslint that relied on a class called CLIEngine.
In newer versions this has now been deprecated and so upgrading
versions required also updating to using ESLint internally
instead. Ultimately this doesn't change the usage of the plugin
but some of the option names have changed for ESLint (notably
configFile needs to change to overrideConfigFile).

The main driving factor for this change is to prevent conflicts
that happen when using @rollup/plugin-typescript and this plugin
together. Without this update, eslint would run on the transpiled
code and so the error messages weren't as helpful. This update
will allow the two plugins to work well together and provide
helpful information about errors and warnings.

This change also includes some necessary package updates to prepare
eslint for Rollup 3.

BREAKING CHANGES:
- options structure has changed due to moving from CLIEngine t
  ESlint. Review the new supported options below:
https://eslint.org/docs/latest/developer-guide/nodejs-api#-new-eslintoptions
- requires Node 14
@colingm colingm changed the base branch from master to repo/rollup3-updates October 4, 2022 12:34
@colingm colingm changed the title refactor(eslint)!: upgrade eslint to newest version refactor(eslint)!: Prepare eslint for rollup 3 and upgrade eslint to newest version Oct 4, 2022
@colingm
Copy link
Contributor Author

colingm commented Oct 4, 2022

@lukastaegert I have gone ahead and done all of the requested rebases and merges, let me know if everything looks alright or if there are any other requested changes.

Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

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

Looks great! Happy to merge this in the next days.

[npm]: https://img.shields.io/npm/v/@rollup/plugin-eslint
[npm-url]: https://www.npmjs.com/package/@rollup/plugin-eslint
[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-eslint
[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-eslint
Copy link
Member

Choose a reason for hiding this comment

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

Ooops...

@lukastaegert lukastaegert deleted the branch rollup:repo/rollup3-updates October 7, 2022 18:41
@colingm
Copy link
Contributor Author

colingm commented Oct 7, 2022

@lukastaegert it looks like this auto closed since you deleted the base branch maybe, is there something else you need me to do here?

@lukastaegert
Copy link
Member

lukastaegert commented Oct 7, 2022

Damn it, I hoped it would just change your target branch to master as I merged the original branch into master. Can you somehow reopen the PR and point it to master instead?

Apparently, it worked for all other PRs pointing to that branch except yours, maybe this does not work for PRs from forks.

@colingm
Copy link
Contributor Author

colingm commented Oct 7, 2022

yeah, I will rebase real quick but I will probably need to open a new PR since it won't let me change base on this one

@colingm
Copy link
Contributor Author

colingm commented Oct 7, 2022

@lukastaegert #1309

@colingm
Copy link
Contributor Author

colingm commented Oct 7, 2022

Github doesn't like it when you delete target branches for open PRs, it chokes and dies

@lukastaegert
Copy link
Member

Thanks so much

@lukastaegert
Copy link
Member

Ok, auto-publish did not work, probably because refactor does not trigger releases. Will sort this out later.

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.

3 participants