-
Notifications
You must be signed in to change notification settings - Fork 70
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
(chore) Dependency upgrades and improvements to linting and types #190
Conversation
96a7dcb
to
f790633
Compare
Size Change: +42.9 kB (+1%) Total Size: 2.98 MB
ℹ️ View Unchanged
|
f790633
to
c1b185a
Compare
c1b185a
to
dbbb86d
Compare
"extends": [ | ||
"eslint:recommended", | ||
"plugin:prettier/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"ts-react-important-stuff" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
.prettierrc
Outdated
@@ -0,0 +1,8 @@ | |||
{ | |||
"bracketSpacing": true, | |||
"printWidth": 80, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we usually use 120?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I'll switch back to that.
webpack.config.js
Outdated
"@openmrs/openmrs-form-engine-lib": | ||
"@openmrs/openmrs-form-engine-lib/src/index", | ||
'@openmrs/esm-framework': '@openmrs/esm-framework/src/internal', | ||
'@openmrs/openmrs-form-engine-lib': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this wasn't added in this PR, but it's absolutely absurd that we need an alias for this. We should be able to setup the package.json
for the form engine lib to remove this necessity (things are a little different with esm-framework; we have a series of "internal" methods, which are basically exposed so they can be called from the app-shell, but nowhere else, but at runtime, we only want one framework bundle, so this rule has us bundle the full esm-framework, including internals, but only allow user-code to see the public interface).
.eslintignore
Outdated
@@ -1,2 +1,3 @@ | |||
e2e/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the tests themselves be linted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they should. I forgot to restore this.
Dunno why the e2e tests are failing @ibacher. I've posted a thread on the qa-support channel on Slack. |
e2e/specs/forms-dashboard.spec.ts
Outdated
.getByRole("combobox", { | ||
name: "Filter by publish status: All Open menu", | ||
.getByRole('combobox', { | ||
name: 'Filter by publish status: All Open menu', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this test could've ever succeeded. The DOM element with the role combobox
is the button which only has the text "All".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Playwright codegen tool suggests using page.getByText('Filter by publish status:')
playwright-codegen.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it works!
await page.getByRole('row', { name: form.name }).getByLabel('Edit Schema').click(); | ||
}); | ||
|
||
await test.step("Then I click on the unpublish form button and confirms the unpublication", async () => { | ||
await test.step('Then I click on the unpublish form button and confirms the unpublication', async () => { | ||
await formBuilderPage.unpublishFormButton().click(); | ||
await formBuilderPage.unpublishFormConfirmationButton().click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watching the video, this doesn't seem to work. There's a failure "Cannot read properties of undefined (reading 'length')". This seems to trigger at the first unpublishFormButton().click()
.
All fixed, @ibacher. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
.husky/pre-commit
Outdated
npx lint-staged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the pretty-quick as well in the pre-commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in the latest commit
9498255
Requirements
Summary
I’ve made various upgrades to dependencies, lint tooling and types in this PR. Specifically, these changes include:
pretty-quick
withlint-staged
for managing pre-commit hooks.pretty-quick
isn’t compatible with the latest version of Prettier.Other
Changes to linting and formatting were inspired by https://www.joshuakgoldberg.com/blog/configuring-eslint-prettier-and-typescript-together/.