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

WIP: Feature/update ts transform plugin #1751

Closed

Conversation

thekip
Copy link
Contributor

@thekip thekip commented Sep 18, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number:#1346

What is the new behavior?

This PR brings changes in how current ts transform plugin is working.

To Do:

  • Option to work in isolatedModules (no typeChecker available)
  • Introspection for @deprecated jsdoc tag
  • Support for GraphQL scalar types: Int, Float, ID (please refer to the issue Are there any plans of extending GraphQL CLI Plugin functionality? #1346 i rised a discussion there)
  • Support more complicated cases in no-typechecker mode.
  • More tests covering edge cases in no-typechecker mode.

What was changed internally:

  1. JSDoc Comments now parsed using Typescript AST (built-it typescript support) instead of regular expressions
  2. Removed code related to imports and merging existing factories (please see linked issue)
  3. Test rewritten, Jest Snapshots used

Does this PR introduce a breaking change?

[x] Yes
[ ] No

There is a defenetely changes which can impact users.
TODO: eliminate them or at least find and clearly state what can go wrong.

Other information

prettier/@typescript-eslint has been removed in eslint-config-prettier v8.0.0.
https://stackoverflow.com/a/66342626/2210610
sourcemaps allows to put breakpoints during
 writing and debugging tests.
Follow features was added:
Introspection of @deprecated jsdoc tag
Using plugin in transpile only context (without typeChecker)
@@ -9,7 +9,6 @@ module.exports = {
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

const defaultOptions: PluginOptions = {
typeFileNameSuffix: ['.input.ts', '.args.ts', '.entity.ts', '.model.ts'],
introspectComments: false,
advancedTypeIntrospection: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this flag enables "old" behavior and aimed to eliminate most of breaking changes.

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

Successfully merging this pull request may close these issues.

None yet

2 participants