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

Run typecheck and eslint on ./run lint #6314

Merged
merged 7 commits into from
May 4, 2023
Merged

Conversation

somebody1234
Copy link
Contributor

@somebody1234 somebody1234 commented Apr 17, 2023

Pull Request Description

Fixes #6244

Important Notes

The lint check will fail because there are eslint errors. #6267 should fix this.
The typecheck check should be tested by making some code invalid. the simplest way to do this would be to change a variable name.

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 somebody1234 requested a review from mwu-tow as a code owner April 17, 2023 15:39
@somebody1234
Copy link
Contributor Author

somebody1234 commented Apr 17, 2023

not sure whether i'm missing something (since a 3 line change is a really small change) but it seems to work
styles should be fine too since ./run lint also runs and diffs against rust formatter output.

Output from new checks
TRACE ide_ci::program::command: npmℹ️ 
TRACE ide_ci::program::command: npm⚠️ 
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️ > [email protected] typecheck
 INFO ide_ci::program::command: npmℹ️ > npm run typecheck --workspace enso; npm run typecheck --workspace enso-content; npm run typecheck --workspace enso-dashboard; npm run typecheck --workspace enso-authentication
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️ > [email protected] typecheck
 INFO ide_ci::program::command: npmℹ️ > tsc --noEmit
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️ > [email protected] typecheck
 INFO ide_ci::program::command: npmℹ️ > tsc --noEmit
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️ > [email protected] typecheck
 INFO ide_ci::program::command: npmℹ️ > tsc --noEmit
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️
 INFO ide_ci::program::command: npmℹ️ > [email protected] typecheck
 INFO ide_ci::program::command: npmℹ️ > tsc --noEmit
 INFO ide_ci::program::command: npmℹ️
TRACE ide_ci::program::command: npmℹ️ 
TRACE ide_ci::program::command: npm⚠️ 
 INFO main_internal:Running process.{command=Command:
	cd "/home/me/git/enso/app/ide-desktop" && "/usr/bin/npm" "run" "typecheck"
	with working directory: /home/me/git/enso/app/ide-desktop pid=27315 status=0}: ide_ci::program::command: close
 INFO main_internal:Running process.: ide_ci::program::command: new
DEBUG main_internal:Running process.{command=Command:
	cd "/home/me/git/enso/app/ide-desktop" && "/usr/bin/npx" "eslint" "."
	with working directory: /home/me/git/enso/app/ide-desktop}: ide_ci::program::command: Spawning.
TRACE ide_ci::program::command: npxℹ️ 
TRACE ide_ci::program::command: npx⚠️ 
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/client/electron-builder-config.ts
 INFO ide_ci::program::command: npxℹ️   22:1  error  Expected 'multiple' syntax before 'single' syntax  sort-imports
 INFO ide_ci::program::command: npxℹ️   22:1  error  No {} imports and exports                          no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/client/src/authentication.ts
 INFO ide_ci::program::command: npxℹ️    77:1   error    Expected 'all' syntax before 'single' syntax                                                          sort-imports
 INFO ide_ci::program::command: npxℹ️    77:1   error    Import node modules before npm modules, our modules, and relative imports, separated by a blank line  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️    78:1   error    Import node modules before npm modules, our modules, and relative imports, separated by a blank line  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️    79:1   error    Import node modules before npm modules, our modules, and relative imports, separated by a blank line  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️   168:21  warning  'err' is already declared in the upper scope on line 161 column 64                                    @typescript-eslint/no-shadow
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/client/src/bin/project-manager.ts
 INFO ide_ci::program::command: npxℹ️   26:9  error  No early returns  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/client/src/file-associations.ts
 INFO ide_ci::program::command: npxℹ️   149:9  error  No early returns  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/client/src/index.ts
 INFO ide_ci::program::command: npxℹ️   285:59  warning  '_event' is defined but never used                                                                                                                                  @typescript-eslint/no-unused-vars
 INFO ide_ci::program::command: npxℹ️   287:17  error    Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator  @typescript-eslint/no-floating-promises
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/client/src/project-management.ts
 INFO ide_ci::program::command: npxℹ️    53:13  error  No early returns  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️   101:13  error  No early returns  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/client/tasks/signArchivesMacOs.ts
 INFO ide_ci::program::command: npxℹ️   206:13  error  No early returns  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/content/bundle.ts
 INFO ide_ci::program::command: npxℹ️   10:5  error  No early returns  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/dashboard.tsx
 INFO ide_ci::program::command: npxℹ️   177:19  warning  '_extension' is defined but never used                  @typescript-eslint/no-unused-vars
 INFO ide_ci::program::command: npxℹ️   216:28  warning  'setSelectedAssets' is assigned a value but never used  @typescript-eslint/no-unused-vars
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/components/ide.tsx
 INFO ide_ci::program::command: npxℹ️   78:32  warning  Forbidden non-null assertion  @typescript-eslint/no-non-null-assertion
 INFO ide_ci::program::command: npxℹ️   79:33  warning  Forbidden non-null assertion  @typescript-eslint/no-non-null-assertion
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ /home/me/git/enso/app/ide-desktop/lib/icons/src/index.js
 INFO ide_ci::program::command: npxℹ️   217:9  error  No early returns  no-restricted-syntax
 INFO ide_ci::program::command: npxℹ️
 INFO ide_ci::program::command: npxℹ️ ✖ 20 problems (14 errors, 6 warnings)
 INFO ide_ci::program::command: npxℹ️
TRACE ide_ci::program::command: npxℹ️ 
TRACE ide_ci::program::command: npx⚠️ 
 INFO main_internal:Running process.{command=Command:
	cd "/home/me/git/enso/app/ide-desktop" && "/usr/bin/npx" "eslint" "."
	with working directory: /home/me/git/enso/app/ide-desktop pid=27707 status=1}: ide_ci::program::command: close
ERROR main_internal: enso_build_cli: error=Command failed: Command:
	cd "/home/me/git/enso/app/ide-desktop" && "/usr/bin/npx" "eslint" "."
	with working directory: /home/me/git/enso/app/ide-desktop

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

@mwu-tow mwu-tow left a comment

Choose a reason for hiding this comment

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

not sure whether i'm missing something (since a 3 line change is a really small change) but it seems to work

Well, it does not need to be a big change. If it works (please check, if it runs correctly on a clean working copy), then it is fine. :)

@somebody1234
Copy link
Contributor Author

seems to run correctly on ci (fails as expected). i think i'll merge the eslint fixes and verify that it's working, then add a type error to verify that typecheck lint works

@somebody1234
Copy link
Contributor Author

errors on eslint error: ✔️
errors on typescript error: ✔️ (fixed)
succeeds when the eslint fixes are merged in: ✔️

@PabloBuchu
Copy link
Contributor

PabloBuchu commented Apr 19, 2023

@somebody1234 so QA passed 🟢 how about these lint errors for linux https://github.com/enso-org/enso/actions/runs/4739322557/jobs/8414041628?pr=6314 we can fix them now?

GitHub
Hybrid visual and textual functional programming. Contribute to enso-org/enso development by creating an account on GitHub.

@somebody1234
Copy link
Contributor Author

somebody1234 commented Apr 19, 2023

@PabloBuchu as mentioned in the original comment, #6267 will fix the lint errors. not sure if lint failing blocks merge

@mwu-tow
Copy link
Contributor

mwu-tow commented Apr 19, 2023

@somebody1234

@PabloBuchu as mentioned in the original comment, #6267 will fix the lint errors. not sure if lint failing blocks merge

It blocks the merge; this is the main point of integrating this with ./run lint. :)

@somebody1234
Copy link
Contributor Author

ah, of course... was on mobile at the time so i couldn't tell whether it was required - but the other PR should be just about ready, so i think it should be fine to merge the other one, then this one - when the other is confirmed to be ready, of course

@mwu-tow
Copy link
Contributor

mwu-tow commented Apr 19, 2023

ah, of course... was on mobile at the time so i couldn't tell whether it was required - but the other PR should be just about ready, so i think it should be fine to merge the other one, then this one - when the other is confirmed to be ready, of course

Makes total sense!

Comment on lines 840 to 845

let js_modules_root = ctx.repo_root.join("app/ide-desktop");

Npm.cmd()?.current_dir(&js_modules_root).args(["run", "typecheck"]).run_ok().await?;

Npx.cmd()?.current_dir(&js_modules_root).args(["eslint", "."]).run_ok().await?;
Copy link
Member

Choose a reason for hiding this comment

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

Why are we creating these newlines here? I don't think they are needed - they just make the code longer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be fixed now

@somebody1234
Copy link
Contributor Author

confirmed to exit with success because the other PR has been merged in. there are 4 eslint warnings (not errors) for lib/dashboard, but this is intentional as dashboard implementation is still in progress.

(two of the warnings should be fixed by another PR, the other two are for features that are not implemented yet)

@wdanilo
Copy link
Member

wdanilo commented May 3, 2023

If this PR is waiting for other PRs, let's change it to draft. If it is ready to merge - lets merge it :)

@somebody1234
Copy link
Contributor Author

@wdanilo some CIs failing, not sure why + waiting for approval from a code owner

@somebody1234
Copy link
Contributor Author

lint check is successful though so it should be safe enough to merge

@somebody1234
Copy link
Contributor Author

@PabloBuchu @indiv0 would one of you mind reviewing? a small QA would be nice but i don't think it's strictly necessary as lint CI is only run on linux.

i've merged develop into this branch locally to test (will not actually merge in, just checking there will no issues after merging into develop) and will mark as ready for merge if it runs correctly

@somebody1234
Copy link
Contributor Author

oh, actually not sure why some js fixes snuck into this PR, but they're already here anyway.

anyway, lint run has succeeded locally

@somebody1234 somebody1234 added the CI: Ready to merge This PR is eligible for automatic merge label May 3, 2023
@somebody1234
Copy link
Contributor Author

somebody1234 commented May 3, 2023

note: the "Engine CI / Engine (linux)" is required but failing with output:
i'm going out on a limb and assuming this PR isn't the cause 😛

❌ should not duplicate warnings
	An unexpected panic was thrown: (No_Such_Method.Error (SQLite_Connection.Value (Connection.Value (JDBC_Connection.Value org.enso.interpreter.runtime.data.ManagedResource@6b437b24) SQLite_Dialect)) UnresolvedSymbol<upload_table>)

@mwu-tow
Copy link
Contributor

mwu-tow commented May 3, 2023

@somebody1234

note: the "Engine CI / Engine (linux)" is required but failing with output:
i'm going out on a limb and assuming this PR isn't the cause 😛

Looks like some random issue, perhaps yet another mixup between different Engine versions across the branches. Pinging @hubertp @radeusgd

@wdanilo
Copy link
Member

wdanilo commented May 4, 2023

As we need this PR and the fails are engine-related only, merging it now.

@wdanilo wdanilo merged commit 7885145 into develop May 4, 2023
@wdanilo wdanilo deleted the wip/sb/run-lint-tsc-eslint branch May 4, 2023 04:00
Procrat added a commit that referenced this pull request May 4, 2023
* develop:
  Fix cut-off in text visualisations (#6421)
  Infer correct synthetic name for nested modules (#6525)
  Delete unused websocket dependency (#6535)
  Run typecheck and eslint on `./run lint` (#6314)
  Force pending saves if client closes abruptly (#6514)
  Continued Execution Context work and some little fixes (#6506)
  IDE's logging to a file (#6478)
  Fix application config (#6513)
  Cloud/desktop mode switcher (#6448)
  Fix doubled named arguments bug (#6422)
  Reimplement `enso_project` as a proper builtin (#6352)
  Fix layer ordering between dropdown and breadcrumbs backgrounds.  (#6483)
  Multiflavor layers (#6477)
  DataflowAnalysis preserves dependencies order (#6493)
  Implement `create_database_table` for Database Table (#6467)
  Limit Dead Letter logging (#6482)
  More reliable shutdown of the EnsoContext to save resources (#6468)
  Make execution mode `live` default for CLI (#6496)
Procrat added a commit that referenced this pull request May 4, 2023
…-5075

* develop:
  Build nightly 3 hours earlier. (#6551)
  Cache result of slow function resolution on Any that is present on a hot path (#6536)
  Fix cut-off in text visualisations (#6421)
  Infer correct synthetic name for nested modules (#6525)
  Delete unused websocket dependency (#6535)
  Run typecheck and eslint on `./run lint` (#6314)
  Force pending saves if client closes abruptly (#6514)
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. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate ESLint with ./run lint
4 participants