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

Move gjs/gts parser to ember-eslint-parser library #2028

Merged
merged 11 commits into from
Dec 22, 2023

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Dec 12, 2023

Collab with @patricklx and @vstefanovic97

Parser: https://github.com/NullVoxPopuli/ember-eslint-parser/

Why move the parser to a separate library?

  • the future of parsing gjs/gts is a bit unknown as far as implementation details go
  • eventually we'll want to gradually delete more JS code, and replace with Rust / content-tag
  • we may need an improved way to create a unified AST
    • but also, do we even need a unified AST?
      • because of this uncertainty, experimentation can happen outside of eslint-plugin-ember
  • we retain eslint-plugin-ember's identity as a configuration library, which is simpler, and easier for new contributors to feel comfortable in

Todo:

  • Copy code over to ember-eslint-parser and re-publish
  • Update this PR
    These existing tests currently fail (as do a few other things that use gjs/gts parsing)
    GOAL -- all tests should become passing without changes
    image

Related PRs that explored and introduced the parser:

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
Copy link
Member

@bmish bmish Dec 21, 2023

Choose a reason for hiding this comment

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

Since ember-eslint-parser now specifies dependencies we need:

Can we move these dependencies back to devDependencies:

  • @babel/eslint-parser

And remove these dependencies:

  • @babel/core
  • @typescript-eslint/parser
  • @typescript-eslint/scope-manager
  • @typescript-eslint/scope-manager

Can we also remove the TypeScript peerDependencies/peerDependenciesMeta?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • @babel/eslint-parser - yeah, looks like its only referenced in tests an dev config
  • @babel/core -- yep, nothing references it
  • @tyepscript-eslint/parser - nope, it's used in tests, and specified in eslint-remote-tester.config.js -- if that file is a dev-only dependency, we can move to devDeps tho
  • @typescript-eslint/scope-manager -- yup, nothing references it

Copy link
Member

Choose a reason for hiding this comment

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

eslint-remote-tester.config.js is only for testing, so yes let's move @tyepscript-eslint/parser to dev deps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

excellent, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Can we also remove the TypeScript peerDependencies/peerDependenciesMeta?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we have to keep typescript as a peer, because ember-eslint-parser declares it as a peer.
yarn won't complain, but pnpm would raise an eyebrow at you ✨

When a dep declares a peer, we as a middle-library, must either:

  • forward the peer
  • provide the dependency

We don't want to actually provide the dependency, and ember-eslint-parser doesn't want us to either.

We want the end-consumer's typescript copy to be the one that's used.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting, okay.

README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review December 22, 2023 00:16
Copy link
Member

Choose a reason for hiding this comment

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

  1. Does this file include sufficient integration tests to ensure the parser works with eslint-plugin-ember?
  2. Can tests be added inside https://github.com/NullVoxPopuli/ember-eslint-parser too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@bmish bmish Dec 22, 2023

Choose a reason for hiding this comment

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

Okay, I think we need tests in ember-eslint-parser ASAP, before v12 final, as that library could be at risk of breaking eslint-plugin-ember users if a bad/untested change gets into it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

absolutely -- @patricklx do you happened to have time for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

I might have a bit of time until beginning of January, afterwards only after end of January

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be possible to just copy the Tests. We do not need to test any ember specific rules there. Just use pure eslint as dev dependency

@bmish bmish added the breaking label Dec 22, 2023
@bmish bmish changed the title Move parser code to library, restoring eslint-plugin-ember to be "config + rule definitions" Move gjs/gts parser to ember-eslint-parser library Dec 22, 2023
@bmish
Copy link
Member

bmish commented Dec 22, 2023

Can you add some context about why this code is/should moving into a separate library in the PR description?

Copy link
Member

@bmish bmish left a comment

Choose a reason for hiding this comment

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

Thanks!

@bmish bmish merged commit ca54d94 into ember-cli:master Dec 22, 2023
8 checks passed
@NullVoxPopuli NullVoxPopuli deleted the move-parser-code-to-library branch December 22, 2023 20:54
@NullVoxPopuli
Copy link
Contributor Author

Can you add some context about why this code is/should moving into a separate library in the PR description?

done!

@NullVoxPopuli
Copy link
Contributor Author

Making sure no changes in ember-eslint-parser can break eslint-plugin-ember: ember-tooling/ember-eslint-parser#13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants