diff --git a/docs/rules/no-raw-text.md b/docs/rules/no-raw-text.md index afce0b33..d0ce1a3b 100644 --- a/docs/rules/no-raw-text.md +++ b/docs/rules/no-raw-text.md @@ -65,3 +65,19 @@ export default { // ... } ``` + +## :gear: Options + +```json +{ + "vue-i18n/no-raw-text": ["error", { + "ignoreNodes": ["md-icon", "v-icon"], + "ignorePattern": "^[-#:()&]+$", + "ignoreText": ["EUR", "HKD", "USD"] + }] +} +``` + +- `ignoreNodes`: specify nodes to ignore such as icon components +- `ignorePattern`: specify a regexp pattern that matches strings to ignore +- `ignoreText`: specify an array of strings to ignore diff --git a/docs/rules/no-unused-keys.md b/docs/rules/no-unused-keys.md index 38d6fd6d..fa0870fc 100644 --- a/docs/rules/no-unused-keys.md +++ b/docs/rules/no-unused-keys.md @@ -76,7 +76,7 @@ const i18n = new VueI18n({ i18n.t('hi') ``` -## Options +## :gear: Options ```json { diff --git a/lib/rules/no-raw-text.js b/lib/rules/no-raw-text.js index 6703b65a..d951743e 100644 --- a/lib/rules/no-raw-text.js +++ b/lib/rules/no-raw-text.js @@ -6,7 +6,8 @@ const { parse, AST } = require('vue-eslint-parser') const { defineTemplateBodyVisitor } = require('../utils/index') -const hasOnlyLineBreak = value => /^[\r\n\t\f\v]+$/.test(value.replace(/ /g, '')) +const config = {} +const hasOnlyWhitespace = value => /^[\r\n\s\t\f\v]+$/.test(value) const INNER_START_OFFSET = '