0.0.1-rc.5 • Published 3 years ago
eslint-plugin-i18n2 v0.0.1-rc.5
eslint-plugin-i18n2
Usage 用法
如果你对 ESLint 插件并不熟悉,请参考 Configuring Plugins 。
If you are not familiar with ESLint plug-ins, please refer to Configuring Plugins.
- 使用推荐的配置:
Use recommended configuration:
{
"extends": ["plugin:i18n2/recommended"]
}
- 自定义启用的规则以及错误等级:
Customize the enabled rules and error levels:
{
"plugins": ["i18n2"],
"rules": {
"i18n2/no-top-level-translation": "error",
"i18n2/no-untranslated-literal": "error"
}
}
Settings 配置
在 .eslintrc.json 等配置文件中可设置 i18n2 插件的公共配置,所有规则都会共享此配置。
The sharing settings of the i18n2 plug-in can be set in configuration files such as .eslintrc.json, and all rules will share these settings.
{
"extends": ["plugin:i18n2/recommended"],
"settings": {
"i18n2": {
"translator": ["*.t.*", "*.i18n.t"],
"translatorSourceModule": "esm",
"untranslatedChars": "[^\\x00-\\x7F]"
}
}
}
配置项 | 描述 | 类型 | 默认值 |
---|---|---|---|
translator | 指定翻译函数调用的访问路径,支持单级通配符 * 和多级通配符 ** ,可以使用 \ 转义。 | readonly string[] | ['i18next.t'] | ||
translatorSourceModule | 指定翻译函数的导入来源,目前支持 CommonJS (cjs) / ECMAScript Module (esm) / Global (global) 。 | 'cjs' \| 'esm' \| 'global' | 'global' |
untranslatedChars | 符合此正则表达式的字符都将被视为未翻译,传入字符串会被直接转为正则表达式。 | RegExp \| string | /[^\x00-\x7F\s]/ |
wellknownText | 符合此正则表达式的文本将被认为无需翻译,传入字符串会被直接转为正则表达式。 | RegExp \| string \| null | /(DEBUG\|DEV\|ERROR\|LOG\|WARN)/ |
Setting Item | Description | Type | Defaults |
---|---|---|---|
translator | Specify the access path of the translation function call. Supports the single-level wildcard * and the multi-level wildcard ** , which can be escaped with \ . | readonly string[] | ['i18next.t'] | ||
translatorSourceModule | Specify the import source of the translation function, currently supports CommonJS (cjs) / ECMAScript Module (esm) / Global (global). | 'cjs' \| 'esm' \| 'global' | 'global' |
untranslatedChars | The characters that meet this regular expression will be regarded as untranslated, and the incoming string will be directly converted into a regular expression. | RegExp \| string | /[^\x00-\x7F\s]/ |
wellknownText | The text that meets this regular expression will be considered as no need for translation, and the incoming string will be directly converted into a regular expression. | RegExp \| string \| null | /(DEBUG\|DEV\|ERROR\|LOG\|WARN)/ |
0.0.1-rc.0
3 years ago
0.0.1-rc.3
3 years ago
0.0.1-rc.4
3 years ago
0.0.1-rc.1
3 years ago
0.0.1-rc.2
3 years ago
0.0.1-rc.5
3 years ago
0.0.1-alpha.4
3 years ago
0.0.1-alpha.5
3 years ago
0.0.1-alpha.3
3 years ago
0.0.1-alpha.2
3 years ago
0.0.1-alpha.1
3 years ago