diff --git a/README.md b/README.md index 5b72613c..fc4f3426 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Details changes for each release are documented in the [CHANGELOG.md](https://gi - [x] no-dynamic-keys - [x] no-unused-keys - [x] no-v-html +- [ ] no-html-message - [ ] no-raw-text - [ ] valid-message-syntax - [ ] keys-order diff --git a/docs/rules/README.md b/docs/rules/README.md index 0b5d0947..721911f8 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -7,6 +7,7 @@ | Rule ID | Description | | |:--------|:------------|:---| +| [vue-i18n/no-html-messages](./no-html-messages.html) | disallow use HTML localization messages | :star: | | [vue-i18n/no-missing-keys](./no-missing-keys.html) | disallow missing locale message key at localization methods | :star: | | [vue-i18n/no-v-html](./no-v-html.html) | disallow use of localization methods on v-html to prevent XSS attack | :star: | diff --git a/docs/rules/no-html-messages.md b/docs/rules/no-html-messages.md new file mode 100644 index 00000000..d6d37ab6 --- /dev/null +++ b/docs/rules/no-html-messages.md @@ -0,0 +1,113 @@ +# vue-i18n/no-html-messages + +> disallow use HTML localization messages + +- :star: The `"extends": "plugin:vue-i18n/recommended"` property in a configuration file enables this rule. + +This rule reports in order to reduce the risk of injecting potentially unsafe localization message into the browser leading to supply-chain attack or XSS attack. + +## :book: Rule Details + +This rule is aimed at eliminating HTML localization messages. + +:-1: Examples of **incorrect** code for this rule: + +locale messages: +```js +// ✗ BAD +{ + "hello": "Hello! DIO!", + "hi": "Hi! DIO!", + "contenst": { + "banner": "banner: