eslint-plugin-i18next
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -5,2 +5,11 @@ # Change Log | ||
## [1.1.3](https://github.com/edvardchen/eslint-plugin-i18next/compare/v1.1.2...v1.1.3) (2019-04-08) | ||
### Bug Fixes | ||
* disallow uppercase strings in JSX ([715cba4](https://github.com/edvardchen/eslint-plugin-i18next/commit/715cba4)) | ||
## [1.1.2](https://github.com/edvardchen/eslint-plugin-i18next/compare/v1.1.1...v1.1.2) (2019-04-08) |
@@ -6,8 +6,4 @@ const conventional = require('@commitlint/config-conventional'); | ||
rules: { | ||
'type-enum': [ | ||
2, | ||
'always', | ||
[...conventional.rules['type-enum'][2], 'dev', 'deps'] | ||
] | ||
'type-enum': [2, 'always', [...conventional.rules['type-enum'][2], 'dev']] | ||
} | ||
}; |
@@ -85,5 +85,7 @@ /** | ||
if (!trimed) return; | ||
if (isUpperCase(trimed)) return; | ||
const { parent } = node; | ||
if (isUpperCase(trimed) && parent.type !== 'JSXElement') return; | ||
if (parent) { | ||
@@ -98,3 +100,2 @@ switch (parent.type) { | ||
if (parent.key === node) return; | ||
// name if key is Identifier; value if key is Literal | ||
@@ -109,3 +110,2 @@ // dont care whether if this is computed or not | ||
let LOOK_UP_LIMIT = 3; | ||
let temp = parent; | ||
@@ -112,0 +112,0 @@ while (temp && LOOK_UP_LIMIT > 0) { |
{ | ||
"name": "eslint-plugin-i18next", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "ESLint plugin for i18n", | ||
@@ -32,5 +32,6 @@ "keywords": [ | ||
"babel-eslint": "^10.0.1", | ||
"eslint": "~3.9.1", | ||
"eslint": "^5.16.0", | ||
"husky": "^1.3.1", | ||
"mocha": "^6.0.2" | ||
"mocha": "^6.1.1", | ||
"vue-eslint-parser": "^6.0.3" | ||
}, | ||
@@ -37,0 +38,0 @@ "engines": { |
@@ -23,3 +23,6 @@ /** | ||
parserOptions: { | ||
sourceType: 'module' | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
} | ||
@@ -45,3 +48,5 @@ }); | ||
{ code: 'var a = {A_B: "hello world"};' }, | ||
{ code: 'var a = {foo: "FOO"};' } | ||
{ code: 'var a = {foo: "FOO"};' }, | ||
// JSX | ||
{ code: '<div>{i18next.t("foo")}</div>' } | ||
], | ||
@@ -53,4 +58,28 @@ | ||
{ code: 'var a = {foo: "bar"};', errors }, | ||
{ code: 'const a = "afoo";', options: [{ ignore: ['^foo'] }], errors } | ||
{ code: 'const a = "afoo";', options: [{ ignore: ['^foo'] }], errors }, | ||
// JSX | ||
{ code: '<div>foo</div>', errors }, | ||
{ code: '<div>FOO</div>', errors } | ||
] | ||
}); | ||
// | ||
// ─── VUE ──────────────────────────────────────────────────────────────────────── | ||
// | ||
const vueTester = new RuleTester({ | ||
parser: 'vue-eslint-parser', | ||
parserOptions: { | ||
sourceType: 'module' | ||
} | ||
}); | ||
vueTester.run('no-literal-string', rule, { | ||
valid: [{ code: '<template>{{ i18next.t("abc") }}</template>' }], | ||
invalid: [ | ||
{ | ||
code: '<template>abc</template>', | ||
errors | ||
} | ||
] | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15860
271
7