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

Type annotations #4789

Merged
merged 24 commits into from
Mar 29, 2022
Merged

Type annotations #4789

merged 24 commits into from
Mar 29, 2022

Conversation

trusktr
Copy link
Contributor

@trusktr trusktr commented Jan 26, 2022

closes #4793

Describe your changes:

  • mostly type annotations
  • some small code improvements to make types work better, removal of unused args, and small cleanups

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Unit tests included and/or updated with changes?
  • Command line build passes?
  • Has this been smoke tested?
  • Testing instructions included in associated issue?

Reviewer Checklist

  • Changes appear to address issue?
  • Changes appear not to be breaking changes?
  • Appropriate unit tests included?
  • Code style and in-line documentation are appropriate?
  • Commit messages meet standards?
  • Has associated issue been labelled unverified? (only applicable if this PR closes the issue)
  • Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)

@trusktr trusktr mentioned this pull request Jan 26, 2022
8 tasks
@@ -7,6 +7,8 @@
"@percy/cli": "^1.0.0-beta.73",
"@percy/playwright": "^1.0.1",
"@playwright/test": "^1.18.0",
"@types/eventemitter3": "^1.0.0",
"@types/lodash": "^4.14.178",
Copy link
Contributor Author

@trusktr trusktr Jan 26, 2022

Choose a reason for hiding this comment

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

This doesn't update the packages we're currently using, this only adds types (hence the @types/) of the package's we're using which gives us intellisense in IDEs.

// TODO useless makePoint call?
this.makePoint(point, series);
this.removePoint(removalPoint);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's the point of this makePoint call? I left it in place just in case there's a side-effect I don't know about (is there?), but this.removePoint() is not using it.

Seems like copy/paste left overs from a long time ago. What's the point of making a point just to remove a another point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shefalijoshi can you take a look at this?

insertionPoint,
pointsRequired
);
this.addPoint(this.makePoint(point, series), insertionPoint);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed another unused arg that didn't do anything.

@trusktr trusktr requested a review from a team January 26, 2022 20:01
@trusktr trusktr mentioned this pull request Jan 26, 2022
unlikelyzero
unlikelyzero previously approved these changes Jan 26, 2022
Copy link
Collaborator

@unlikelyzero unlikelyzero left a comment

Choose a reason for hiding this comment

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

This follows the conventions that I've seen with my limited exposure to typescript. I need to defer to someone with more familiarity with the src/api to validate the rest of these changes.

@unlikelyzero
Copy link
Collaborator

@trusktr added the mocha types from our interactive demo of this functionality during testathon

@trusktr
Copy link
Contributor Author

trusktr commented Jan 31, 2022

@unlikelyzero Hey, looks like tests fail because Node is too old for our build setup. My guess is that something had an in-range change that introduced syntax that causes a syntax error in older versions of Node. It'd be nice to be testing on Node 16/17. The new Node 18 LTS is coming out in April.

I think this would be a fine change, as our version of Node is what we build with, and not something that impacts consumers. If they want to build from node_modules like Vista does, they'll use whatever build tools and Node version they want.

@unlikelyzero
Copy link
Collaborator

unlikelyzero commented Feb 1, 2022

@unlikelyzero Hey, looks like tests fail because Node is too old for our build setup. My guess is that something had an in-range change that introduced syntax that causes a syntax error in older versions of Node. It'd be nice to be testing on Node 16/17. The new Node 18 LTS is coming out in April.

I think this would be a fine change, as our version of Node is what we build with, and not something that impacts consumers. If they want to build from node_modules like Vista does, they'll use whatever build tools and Node version they want.

I don't think there's any particular project keeping us on 12. 18 will be what we need for VIPER Flight. I would imagine that we would want to continue to support 14 for open source users. Are statistics on node version information by project available from npm's regististry (i.e. openmct is built 88% of the time by node12)?

It sounds like there are at least 4 PRs stuck on node 16 support. I think we may need to bite the bullet and figure out why this is failing on node16+ #3966

@unlikelyzero
Copy link
Collaborator

@trusktr node16 has been merged in as of monday. I've rebased to pick up that change along with our circleci changes

@jvigliotta
Copy link
Contributor

Need to follow up with @akhenry before merge as this will remove lower versions of Node support.

@trusktr
Copy link
Contributor Author

trusktr commented Mar 15, 2022

14 for open source users

I normally think open source users prefer the latest, and that orgs and corporations are the ones stuck behind.

@trusktr
Copy link
Contributor Author

trusktr commented Mar 15, 2022

The Node 16 build has the same issue:

  An error was thrown in afterAll
  Uncaught Error: Module build failed (from ./node_modules/istanbul-instrumenter-loader/dist/cjs.js):
  SyntaxError: Unexpected token (146:66)
      at Parser.pp$5.raise (/root/project/node_modules/babylon/lib/index.js:4454:13)
      at Parser.pp.unexpected (/root/project/node_modules/babylon/lib/index.js:1761:8)

I wonder where that problem is.

@trusktr
Copy link
Contributor Author

trusktr commented Mar 15, 2022

The app works fine though, and the current log-plots stuff is branched off of this, and that works too.

@trusktr
Copy link
Contributor Author

trusktr commented Mar 15, 2022

I am able to get test and test:e2e:local (with tweaks needed to both, to specify DISPLAY and CHROME_BIN) to run, no syntax error.

@jvigliotta
Copy link
Contributor

@trusktr can you resolve the conflicts? @akhenry can you take a look at this and let us know if we're ok to lose Node 12 support?

@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #4789 (4d75aa3) into master (d30ec4c) will decrease coverage by 0.03%.
The diff coverage is 70.27%.

❗ Current head 4d75aa3 differs from pull request most recent head f25aab5. Consider uploading reports for the commit f25aab5 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4789      +/-   ##
==========================================
- Coverage   50.13%   50.09%   -0.04%     
==========================================
  Files         513      513              
  Lines       18848    18854       +6     
  Branches     1669     1669              
==========================================
- Hits         9449     9445       -4     
- Misses       8982     8992      +10     
  Partials      417      417              
Impacted Files Coverage Δ
src/api/time/TimeContext.js 84.14% <ø> (ø)
src/plugins/plot/MctPlot.vue 51.92% <ø> (ø)
src/plugins/plot/chart/MCTChartAlarmLineSet.js 82.14% <ø> (ø)
src/plugins/plot/chart/MCTChartLineLinear.js 100.00% <ø> (ø)
src/plugins/plot/chart/MCTChartLineStepAfter.js 0.00% <ø> (ø)
src/plugins/plot/chart/MCTChartPointSet.js 100.00% <ø> (ø)
src/plugins/plot/chart/MctChart.vue 44.65% <0.00%> (ø)
src/plugins/plot/configuration/LegendModel.js 90.00% <ø> (ø)
src/plugins/plot/draw/DrawWebGL.js 52.47% <ø> (ø)
src/plugins/plot/lib/eventHelpers.js 86.20% <ø> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d30ec4c...f25aab5. Read the comment docs.

@unlikelyzero
Copy link
Collaborator

@trusktr @akhenry PR To Remove Node 12 support is here: #4963

@@ -210,8 +215,8 @@ export default {
if (this.shouldRegenerateTicks(range, forceRegeneration)) {
let newTicks = this.getTicks();
this.tickRange = {
min: Math.min.apply(Math, newTicks),
max: Math.max.apply(Math, newTicks),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Our coverage tool has recently been updated, we can freely use modern syntax now.

legend: _.cloneDeep(_.get(options.domainObject, 'configuration.legend', {}))
xAxis: {},
yAxis: _.cloneDeep(options.domainObject.configuration?.yAxis ?? {}),
legend: _.cloneDeep(options.domainObject.configuration?.legend ?? {})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

modern syntax ftw!

@trusktr trusktr enabled auto-merge (squash) March 29, 2022 19:28
@trusktr trusktr requested a review from a team March 29, 2022 19:28
Copy link
Contributor

@shefalijoshi shefalijoshi left a comment

Choose a reason for hiding this comment

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

Looks good.

@trusktr trusktr merged commit 651e619 into master Mar 29, 2022
@shefalijoshi shefalijoshi deleted the type-annotations branch March 29, 2022 22:17
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.

add type annotations
5 participants