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

Chrimc/form #394

Merged
merged 144 commits into from
Dec 2, 2019
Merged

Chrimc/form #394

merged 144 commits into from
Dec 2, 2019

Conversation

chrimc62
Copy link
Contributor

Integrate $kind change.
Add $public.
Add lg expansion to schema.

Copy link
Contributor

@christopheranderson christopheranderson left a comment

Choose a reason for hiding this comment

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

👍 VS Code stuff looks good

left some minor comments and nits. one thing we should consider long term is moving some of the inline string literals into a collection of constants. If we need to refactor in the future, it can be nice to have use some common constants instead of literals we're grepping through the code to find/fix.

packages/dialog/src/commands/dialog/merge.ts Outdated Show resolved Hide resolved
@@ -313,14 +313,14 @@ export default class DialogMerge extends Command {
}

processRoles(definitions: any, metaSchema: any): void {
for (let type in definitions) {
this.walkJSON(definitions[type], (val: any, _obj, key) => {
for (let kind in definitions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] For for in statements, it is best practice to use a hasOwnProperty filter.

for (const prop in obj) {
  if (obj.hasOwnProperty(prop)) {
    console.log(`obj.${prop} = ${obj[prop]}`);
  } 
}

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in

I personally prefer for of. In this case I'd recommend:

for (const kind of Object.keys(definitions)) {

I'll be adding some tslint rules to enforce this, so you can ignore for now if you'd like.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I buy this. We know the is a plain old JSON object, not a class.

@@ -329,50 +329,50 @@ export default class DialogMerge extends Command {
}
}

processRole(role: string, elt: any, type: string, definitions: any, metaSchema: any, key?: string): void {
const prefix = 'unionType('
processRole(role: string, elt: any, kind: string, definitions: any, metaSchema: any, key?: string): void {
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] you should avoid any types if you do have an expected type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The linting rules I have generally complain if you do not--maybe when you add consistent ones I won't see that. I also think that if you are buying into typescript it is not unreasonable to be explicit.

packages/dialog/src/commands/dialog/merge.ts Outdated Show resolved Hide resolved
packages/dialog/src/commands/dialog/merge.ts Outdated Show resolved Hide resolved
@chrimc62 chrimc62 merged commit 70a1d50 into master Dec 2, 2019
@chrimc62 chrimc62 deleted the chrimc/form branch December 2, 2019 20:32
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.

5 participants