Skip to content

Commit

Permalink
(chore) Separate linting and formatting concerns (#133)
Browse files Browse the repository at this point in the history
* (chore) Separate linting and formatting concerns

* Prettier
  • Loading branch information
denniskigen authored Apr 4, 2024
1 parent e147e02 commit 42a7404
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 29 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"prettier"
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/component-selector": [
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ testem.log
.DS_Store
Thumbs.db
./package-lock.json

.angular
.yarn
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
spec: '@yarnpkg/plugin-version'

yarnPath: .yarn/releases/yarn-1.22.1.cjs
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,16 @@ To use the library in an Angular application, import the `FormEntryModule` in yo
import { FormEntryModule } from '@openmrs/ngx-formentry';

@NgModule({
imports: [
FormEntryModule
]
imports: [FormEntryModule]
})

export class AppModule {}
```

Then add the following code to your template:

```html
<form>
<ofe-form-renderer
<ofe-form-renderer
[node]="form.rootNode"
[labelMap]="labelMap"
></ofe-form-renderer>
Expand All @@ -86,7 +83,7 @@ Here, `node` refers to the form's rootNode, and `labelMap` is an object that map
- The form schema is loaded and parsed.
- Sample data is loaded and injected into the form (via data sources).
- Translations and concepts get resolved.
-
-

## Development

Expand Down Expand Up @@ -119,15 +116,15 @@ touch yarn.lock
# Copy the absolute path to the built library
pwd | pbcopy
# Or if you're on Linux, run:
pwd | xclip -selection clipboard
pwd | xclip -selection clipboard

# Using the O3 Patient Chart's Form Entry app as an example
cd ~/openmrs-esm-patient-chart/packages/esm-form-entry-app

# Link the library
yarn link `pbpaste`
# Or if you're on Linux, run:
yarn link `xclip -out`
yarn link `xclip -out`

# Fire up a dev server
cd ../..
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"test": "ng test ngx-formentry --watch=false",
"test:watch": "ng test ngx-formentry",
"lint": "TIMING=1 ng lint",
"prettier": "prettier --config .prettierrc --write \"projects/**/*.{html,js,ts,css,scss}\" \"src/**/*.{html,js,ts,css,scss}\" --list-different --ignore-unknown",
"e2e": "ng e2e"
},
"peerDependencies": {
Expand Down Expand Up @@ -68,7 +67,6 @@
"@typescript-eslint/parser": "^5.0.0",
"browserslist-config-openmrs": "^1.0.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^9.0.0",
"husky": "^4.3.8",
"jasmine-core": "~5.1.1",
"jasmine-spec-reporter": "~7.0.0",
Expand All @@ -78,6 +76,7 @@
"karma-firefox-launcher": "^2.1.2",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.1.0",
"lint-staged": "^15.2.2",
"ng-packagr": "~16.2.3",
"prettier": "2.1.2",
"protractor": "~7.0.0",
Expand All @@ -91,9 +90,15 @@
],
"husky": {
"hooks": {
"pre-commit": "yarn turbo prettier && yarn turbo lint",
"pre-commit": "npx lint-staged",
"pre-push": "yarn turbo test --color"
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --cache --fix",
"prettier --cache --write --ignore-unknown --list-different"
]
},
"packageManager": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,10 @@ export class ObsAdapterHelper {
const nodeAsGroup: GroupNode = node as GroupNode;

// Get existing obs
let childrenPayload = nodeAsGroup.initialValue?.groupMembers?.map((node) => this.getOldObsPayload(node)) || [];
let childrenPayload =
nodeAsGroup.initialValue?.groupMembers?.map((node) =>
this.getOldObsPayload(node)
) || [];

let isGroupChanged: boolean = false;
_.each(nodeAsGroup.children, (child) => {
Expand All @@ -500,9 +503,12 @@ export class ObsAdapterHelper {
payload.forEach((obsPayload) => {
if (obsPayload.uuid) {
if (obsPayload.voided) {
childrenPayload.find((obs) => obs.uuid == obsPayload.uuid).voided = true;
childrenPayload.find(
(obs) => obs.uuid == obsPayload.uuid
).voided = true;
} else {
childrenPayload.find((obs) => obs.uuid == obsPayload.uuid).value = obsPayload.value;
childrenPayload.find((obs) => obs.uuid == obsPayload.uuid).value =
obsPayload.value;
}
} else {
childrenPayload = childrenPayload.concat(obsPayload);
Expand Down
Loading

0 comments on commit 42a7404

Please sign in to comment.