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

feat(ast-spec): specify PunctuatorToken's value type #3496

Merged
merged 8 commits into from Jun 14, 2021

Conversation

MichaelDeBoey
Copy link
Contributor

As discussed in #3461 (comment)


This is technically a breaking change, but ast-spec is never published, so we shouldn't care I think.

CC/ @bradzacher

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @MichaelDeBoey!

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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@MichaelDeBoey
Copy link
Contributor Author

@bradzacher Looking at the error, I don't really know how to fix it tbh.
Can you point me into the right direction please?

@MichaelDeBoey MichaelDeBoey force-pushed the patch-10 branch 2 times, most recently from f37ecc1 to 71aba31 Compare June 12, 2021 11:57
@MichaelDeBoey
Copy link
Contributor Author

@bradzacher @JamesHenry Is there anything I still need to do for this one?

@nx-cloud
Copy link

nx-cloud bot commented Jun 12, 2021

Nx Cloud Report

CI ran the following commands for commit edb5087. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=build --all --parallel
#000000 nx run-many --target=typecheck --all --parallel

Sent with 💌 from NxCloud.

@nx-cloud
Copy link

nx-cloud bot commented Jun 12, 2021

Nx Cloud Report

CI ran the following commands for commit 71aba31. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=build --all --parallel
#000000 nx run-many --target=typecheck --all --parallel

Sent with 💌 from NxCloud.

Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

Ideally I wouldn't want us to have to keep track of this 60 element union ourselves AND duplicate it into a separate interface map PunctuatorTokenToText or other.

So if you can refactor the types so that we have

  • PunctuatorTokenToText,
  • TokenToText extends PunctuatorTokenToText, and
  • PunctuatorToken['value'] === values<PunctuatorTokenToText>

I'm all for that approach

packages/typescript-estree/src/node-utils.ts Outdated Show resolved Hide resolved
@bradzacher bradzacher added the enhancement New feature or request label Jun 13, 2021
@bradzacher bradzacher changed the title fix(ast-spec): specify PunctuatorToken's value type feat(ast-spec): specify PunctuatorToken's value type Jun 13, 2021
@MichaelDeBoey
Copy link
Contributor Author

@bradzacher Where do you want me to have PunctuatorTokenToText to live then?
TokenToText is living in typescript-estree and ast-spec currently doesn't have any dependencies

@bradzacher
Copy link
Member

ast-spec is not a published package. It is built and copied across to the types package.
So we don't care if we add dependencies to it.

As long as you explicitly mark the TS import as an import type then it should be built and copied fine.

You can add this block to the types package.json to ensure we have an implicit peer dependency on it.

"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},

@MichaelDeBoey
Copy link
Contributor Author

@bradzacher Just pushed the commits you asked for.

I'm happy to change some things around if needed.

Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

lgtm - thanks for this!

@bradzacher bradzacher merged commit fdb1d81 into typescript-eslint:master Jun 14, 2021
@MichaelDeBoey MichaelDeBoey deleted the patch-10 branch June 14, 2021 20:58
@MichaelDeBoey
Copy link
Contributor Author

Always happy to help out!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants