-
Notifications
You must be signed in to change notification settings - Fork 14
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
Use semicolons to terminate fields in type StringType
.
#1208
Comments
Here is the proposed solution for this issue. Can you please test/review it before I apply it to all repos? Index: js/grunt/modulify.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/grunt/modulify.js b/js/grunt/modulify.js
--- a/js/grunt/modulify.js (revision 2677c6192110ae9a2722fc7c73598408f3e075e3)
+++ b/js/grunt/modulify.js (date 1647531219048)
@@ -321,8 +321,20 @@
}
}
- const text = JSON.stringify( structure, null, 2 );
- return replace( replace( text, '"', '\'' ), '\'{{STRING}}\'', 'string' );
+ let text = JSON.stringify( structure, null, 2 );
+
+ // Use single quotes instead of the double quotes from JSON
+ text = replace( text, '"', '\'' );
+
+ text = replace( text, '\'{{STRING}}\'', 'string' );
+
+ // Add ; to the last in the list
+ text = replace( text, ': string\n', ': string;\n' );
+
+ // Use ; instead of ,
+ text = replace( text, ',', ';' );
+
+ return text;
};
/**
|
I tested with geometricOpticsStrings.ts and it looks correct. There's a minor concern that if anyone uses a comma in a string key (which they shouldn't be doing, afaik) then this implementation will break the key. I'm not sure where it would be handled in modulify.js, but could you add a check to verify that no key contains ';' ? |
OK I pushed the changes, ran |
👍🏻 closing. |
{{REPO}}String.js (e.g in geometricOpticsStrings.ts) is generated by
grunt modulify
and contains the definiton ofStringType
.StringType
currently uses commas to separate fields intype StringsType
definition. PhET convention is to terminate fields with semicolons.The text was updated successfully, but these errors were encountered: