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

fix(core): change SecretLintRuleMessageTranslate to check statically #127

Merged
merged 8 commits into from
Apr 11, 2020

Conversation

azu
Copy link
Member

@azu azu commented Apr 10, 2020

BREAKING CHANGE: It changes SecretLintRuleMessageTranslate interface

Each rule need to change messages object format.

    AWSAccessKeyID: {
-        en: "found AWS Access Key ID: {{ID}}",
-        ja: "AWS Access Key Id: {{ID}} がみつかりました"
+        en: (props: { ID: string }) => `found AWS Access Key ID: ${props.ID}`,
+        ja: (props: { ID: string }) => `AWS Access Key Id: ${props.ID} がみつかりました`,
    },

It will resolve #119 because, it also remove runtime check for placeholder string.
It introduce static check for template string instead of non-typed placeholder string.

cons:

The message is not be string. message in JSON can not be used any more.

fix #119
fix #124

azu added 3 commits April 10, 2020 22:34
BREAKING CHANGE: It changes SecretLintRuleMessageTranslate interface

Rule need to change `messages` object format.
- remove runtime check
- add static check
"required": [
"en"
],
"type": "object"
Copy link
Member Author

Choose a reason for hiding this comment

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

fm. it should be function

[P in SecretLintRuleLocaleTag]: SecretLintRuleLocalizeMessageHandler<Props>;
} & {
// Workaround for https://github.com/YousefED/typescript-json-schema/issues/110
en(props?: Props): string;
Copy link
Member Author

Choose a reason for hiding this comment

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

YousefED/typescript-json-schema#110 does not support function.
It should be ignored.

@azu azu added the Type: Breaking Change Includes breaking changes label Apr 10, 2020
@azu
Copy link
Member Author

azu commented Apr 10, 2020

  • Need to update docs

@azu azu merged commit c09ba64 into master Apr 11, 2020
@azu azu deleted the feature/124 branch April 11, 2020 10:08
@azu azu mentioned this pull request Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Breaking Change Includes breaking changes
Projects
None yet
1 participant