eslint-plugin-i18next
Advanced tools
Comparing version 6.0.0-6 to 6.0.0-7
@@ -5,2 +5,14 @@ # Changelog | ||
## [6.0.0-7](https://github.com/edvardchen/eslint-plugin-i18next/compare/v6.0.0-6...v6.0.0-7) (2023-03-20) | ||
### Features | ||
* treat template literals without expressions as normal strings ([f740c1f](https://github.com/edvardchen/eslint-plugin-i18next/commit/f740c1f10bd0cde9644e0948172a37b5189b6245)) | ||
### Bug Fixes | ||
* fixes [#94](https://github.com/edvardchen/eslint-plugin-i18next/issues/94) ([995aa78](https://github.com/edvardchen/eslint-plugin-i18next/commit/995aa78806a1059822bf3af828656bfa622c6a50)) | ||
## [6.0.0-6](https://github.com/edvardchen/eslint-plugin-i18next/compare/v6.0.0-5...v6.0.0-6) (2022-11-21) | ||
@@ -7,0 +19,0 @@ |
@@ -48,3 +48,3 @@ # disallow literal string (no-literal-string) | ||
You cam use `exclude` and `include` of each options to control which should be validated and which should be ignored. | ||
You can use `exclude` and `include` of each options to control which should be validated and which should be ignored. | ||
@@ -51,0 +51,0 @@ The values of these two fields are treated as regular expressions. |
const matchPatterns = require('./matchPatterns'); | ||
module.exports = function shouldSkip({ exclude = [], include = [] }, text) { | ||
if (include.length || exclude.length) { | ||
if ( | ||
(!exclude.length || matchPatterns(exclude, text)) && | ||
!matchPatterns(include, text) | ||
) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
if (!include.length && !exclude.length) return false; | ||
if (include.length && matchPatterns(include, text)) return false; | ||
if (exclude.length && !matchPatterns(exclude, text)) return false; | ||
return true; | ||
}; |
@@ -12,7 +12,4 @@ { | ||
"properties": { | ||
"include": { "type": "array", "items": { "type": "string" } }, | ||
"exclude": { | ||
"type": "array", | ||
"items": { "type": "string" } | ||
} | ||
"include": { "type": "array" }, | ||
"exclude": { "type": "array" } | ||
} | ||
@@ -23,7 +20,4 @@ }, | ||
"properties": { | ||
"include": { "type": "array", "items": { "type": "string" } }, | ||
"exclude": { | ||
"type": "array", | ||
"items": { "type": "string" } | ||
} | ||
"include": { "type": "array" }, | ||
"exclude": { "type": "array" } | ||
} | ||
@@ -34,6 +28,3 @@ }, | ||
"properties": { | ||
"exclude": { | ||
"type": "array", | ||
"items": { "type": "string" } | ||
} | ||
"exclude": { "type": "array" } | ||
} | ||
@@ -44,7 +35,4 @@ }, | ||
"properties": { | ||
"include": { "type": "array", "items": { "type": "string" } }, | ||
"exclude": { | ||
"type": "array", | ||
"items": { "type": "string" } | ||
} | ||
"include": { "type": "array" }, | ||
"exclude": { "type": "array" } | ||
} | ||
@@ -55,4 +43,4 @@ }, | ||
"properties": { | ||
"include": { "type": "array", "items": { "type": "string" } }, | ||
"exclude": { "type": "array", "items": { "type": "string" } } | ||
"include": { "type": "array" }, | ||
"exclude": { "type": "array" } | ||
} | ||
@@ -63,7 +51,4 @@ }, | ||
"properties": { | ||
"include": { "type": "array", "items": { "type": "string" } }, | ||
"exclude": { | ||
"type": "array", | ||
"items": { "type": "string" } | ||
} | ||
"include": { "type": "array" }, | ||
"exclude": { "type": "array" } | ||
} | ||
@@ -70,0 +55,0 @@ }, |
@@ -30,3 +30,3 @@ /** | ||
if (shouldSkip(options.words, value)) return true; | ||
if (shouldSkip(options.words, trimed)) return true; | ||
} | ||
@@ -256,3 +256,4 @@ | ||
TemplateLiteral(node) { | ||
if (!validateTemplate) { | ||
// treat template literals without expressions as normal strings | ||
if (node.expressions.length && !validateTemplate) { | ||
return; | ||
@@ -259,0 +260,0 @@ } |
{ | ||
"name": "eslint-plugin-i18next", | ||
"version": "6.0.0-6", | ||
"version": "6.0.0-7", | ||
"description": "ESLint plugin for i18n", | ||
@@ -38,3 +38,3 @@ "keywords": [ | ||
"lint-staged": "^9.4.2", | ||
"mocha": "^6.1.4", | ||
"mocha": "^10.1.0", | ||
"prettier": "^1.18.2", | ||
@@ -41,0 +41,0 @@ "typescript": "^3.5.2", |
a + 'b'; | ||
<div className="alert alert-danger" role="alert"> | ||
{t("No user details were found")}! | ||
</div>; | ||
<> | ||
@@ -4,0 +8,0 @@ <div>{import('abc')}</div> |
import('hello'); | ||
// don't validate template by default | ||
var aa = `hello world`; | ||
// don't validate template literals with expressions by default | ||
var aa = `hello world, ${name}`; | ||
@@ -6,0 +6,0 @@ function bar(a = 'jianhua') { } |
@@ -14,2 +14,6 @@ const testFile = require('../../helpers/testFile'); | ||
}, | ||
{ | ||
code: 'const a = `afoo ${abc}`;', | ||
options: [{ mode: 'all', words: { exclude: ['^foo'] } }], | ||
}, | ||
], | ||
@@ -22,2 +26,7 @@ invalid: [ | ||
}, | ||
{ | ||
code: 'const a = `afoo`;', | ||
options: [{ mode: 'all', words: { exclude: ['^foo'] } }], | ||
errors: 1, | ||
}, | ||
], | ||
@@ -24,0 +33,0 @@ }; |
Sorry, the diff of this file is not supported yet
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
62072
39
1
1158