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

Fix TypeScript lint errors #6567

Merged
merged 1 commit into from
May 4, 2023
Merged

Fix TypeScript lint errors #6567

merged 1 commit into from
May 4, 2023

Conversation

somebody1234
Copy link
Contributor

Pull Request Description

Should fix TypeScript lint errors.
These errors do not show up locally as the imports point to built assets.

Important Notes

None

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@somebody1234
Copy link
Contributor Author

somebody1234 commented May 4, 2023

opening as draft to trigger a CI run to confirm whether the fixes actually work

@somebody1234 somebody1234 added the CI: No changelog needed Do not require a changelog entry for this PR. label May 4, 2023
@somebody1234
Copy link
Contributor Author

not quite sure whether this actually works. lint is green, however it's entirely possible it's because this runner already has the relevant build artifacts from a previous run. (i don't know how exactly the CI runners work around here)

@somebody1234 somebody1234 marked this pull request as ready for review May 4, 2023 17:26
@somebody1234
Copy link
Contributor Author

This PR does make this change for consistency:
To make sure that it does the same thing, I'm running ide watch which imports content-config via content/index.ts. To test it I think making sure option parsing still works should be sufficient.

-import * as linkedDist from '../../../../../target/ensogl-pack/linked-dist/index'
+import * as linkedDist from '../../../../../target/ensogl-pack/linked-dist'

import * as linkedDist from '../../../../../target/ensogl-pack/linked-dist'

@somebody1234
Copy link
Contributor Author

status update: wasm failed to build with the classic:

 INFO ide_ci::program::command: npx⚠️ ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️     pkg.js:4214:39:
 INFO ide_ci::program::command: npx⚠️       4214 │         input = new URL('pkg_bg.wasm', import.meta.url);
 INFO ide_ci::program::command: npx⚠️            ╵                                        ~~~~~~~~~~~
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️   You need to set the output format to "esm" for "import.meta" to work correctly.
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️ ✘ [ERROR] Could not resolve "env"
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️     pkg.js:16:29:
 INFO ide_ci::program::command: npx⚠️       16 │ import * as __wbg_star3 from 'env';
 INFO ide_ci::program::command: npx⚠️          ╵                              ~~~~~
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️   You can mark the path "env" as external to exclude it from the bundle, which will remove this error.
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️ ▲ [WARNING] The CommonJS "exports" variable is treated as a global variable in an ECMAScript module and may not work as expected [commonjs-variable-in-esm]
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️     snippets/ensogl-text-msdf-a35c812d6b3d67d9/msdfgen_wasm.js:1:940548:
 INFO ide_ci::program::command: npx⚠️       1 │ ...f(typeof exports==="object"){exports.ccall=ccall;exports.getValu...
 INFO ide_ci::program::command: npx⚠️         ╵                                 ~~~~~~~
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️   This file is considered to be an ECMAScript module because of the "export" keyword here:
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️     snippets/ensogl-text-msdf-a35c812d6b3d67d9/msdfgen_wasm.js:2:2:
 INFO ide_ci::program::command: npx⚠️       2 │ ; export { ccall, getValue, _msdfgen_getKerning, _msdfgen_setVariat...
 INFO ide_ci::program::command: npx⚠️         ╵   ~~~~~~
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️ 2 warnings and 1 error

@somebody1234
Copy link
Contributor Author

mini self QA (highly recommend for someone else to do a real QA):
✔️ ./run watch + ide
✔️ ./run watch + dashboard
✔️ npm run typecheck
✔️ npx eslint .

@wdanilo
Copy link
Member

wdanilo commented May 4, 2023

status update: wasm failed to build with the classic:

 INFO ide_ci::program::command: npx⚠️ ▲ [WARNING] "import.meta" is not available with the "cjs" output format and will be empty [empty-import-meta]
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️     pkg.js:4214:39:
 INFO ide_ci::program::command: npx⚠️       4214 │         input = new URL('pkg_bg.wasm', import.meta.url);
 INFO ide_ci::program::command: npx⚠️            ╵                                        ~~~~~~~~~~~
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️   You need to set the output format to "esm" for "import.meta" to work correctly.
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️ ✘ [ERROR] Could not resolve "env"
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️     pkg.js:16:29:
 INFO ide_ci::program::command: npx⚠️       16 │ import * as __wbg_star3 from 'env';
 INFO ide_ci::program::command: npx⚠️          ╵                              ~~~~~
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️   You can mark the path "env" as external to exclude it from the bundle, which will remove this error.
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️ ▲ [WARNING] The CommonJS "exports" variable is treated as a global variable in an ECMAScript module and may not work as expected [commonjs-variable-in-esm]
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️     snippets/ensogl-text-msdf-a35c812d6b3d67d9/msdfgen_wasm.js:1:940548:
 INFO ide_ci::program::command: npx⚠️       1 │ ...f(typeof exports==="object"){exports.ccall=ccall;exports.getValu...
 INFO ide_ci::program::command: npx⚠️         ╵                                 ~~~~~~~
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️   This file is considered to be an ECMAScript module because of the "export" keyword here:
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️     snippets/ensogl-text-msdf-a35c812d6b3d67d9/msdfgen_wasm.js:2:2:
 INFO ide_ci::program::command: npx⚠️       2 │ ; export { ccall, getValue, _msdfgen_getKerning, _msdfgen_setVariat...
 INFO ide_ci::program::command: npx⚠️         ╵   ~~~~~~
 INFO ide_ci::program::command: npx⚠️
 INFO ide_ci::program::command: npx⚠️ 2 warnings and 1 error

Damn, I thought it is fixed ... we had discussion about it and recently it stopped showing up :( Ehh, so bad it's still there :(

Comment on lines +17 to +20
declare module '*/ensogl-pack/linked-dist' {
// eslint-disable-next-line no-restricted-syntax
export * from '../../../../lib/rust/ensogl/pack/js/src/runner/index'
}
Copy link
Member

@wdanilo wdanilo May 4, 2023

Choose a reason for hiding this comment

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

  1. What does it do and why it is better than the previous version? I'm asking just to understand what is the difference here.
  2. It was working fine earlier without that change. Did it stop working because of some new lints enabled? What are these lints? I'm asking about it as it makes the code extremely verbose here and I'm not sure it gives any benefits to us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. i have no clue whether this is a proper fix - but the idea is that this removes the dependency on the built module, so we are now pointing at the actual source (which always exists) instead of the built .d.ts
  2. i don't think so - as mentioned elsewhere i think it only happens on clean runners (?!). the issue happens on the typecheck run, so what's happening is, typescript is looking for the type definitions but cannot find them

@wdanilo
Copy link
Member

wdanilo commented May 4, 2023

Oh, I understand this is fixing the CI errors we have now? If so, few questions:

  • Why did we merge a PR to develop which is breaking the CI? Was the CI working on the merged PR? How did it happen?
  • You've written These errors do not show up locally as the imports point to built assets. - but the CI is doing exactly the same things what you do locally, it is just running the ./run script, so how the results could be different?

@wdanilo
Copy link
Member

wdanilo commented May 4, 2023

As this fixes CI, Im merging it, but let's continue the discussion about the points above here please @somebody1234 .

@wdanilo wdanilo merged commit 0a8f809 into develop May 4, 2023
@wdanilo wdanilo deleted the wip/sb/fix-lint-ci branch May 4, 2023 18:39
@somebody1234
Copy link
Contributor Author

why did we merge a PR that broke the CI?

afaict, CI was working. still not sure why it breaks sometimes

the CI is doing exactly the same things what you do locally

i'm guessing the issue only appears on a fresh runner, which doesn't have build.json and ensogl-pack/linked-dist, so when TS tries to find the files, it can't find anything

@wdanilo
Copy link
Member

wdanilo commented May 5, 2023

why did we merge a PR that broke the CI?

afaict, CI was working. still not sure why it breaks sometimes

the CI is doing exactly the same things what you do locally

i'm guessing the issue only appears on a fresh runner, which doesn't have build.json and ensogl-pack/linked-dist, so when TS tries to find the files, it can't find anything

Ah, gotcha! Ok, that makes sense. Would you be so nice and also take a look at my code comment above? :)

somebody1234 added a commit that referenced this pull request May 8, 2023
mwu-tow pushed a commit that referenced this pull request May 8, 2023
* Revert "Fix lint CI (#6567)"

This reverts commit 0a8f809.

* Revert "Run typecheck and eslint on `./run lint` (#6314)"

This reverts commit 7885145.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants