Repository: edvardchen/eslint-plugin-i18next (js)

Issue:
Whitespace around excluded words
I have indented jsx like this:
`return (`
`    <div className="alert alert-danger" role="alert">`
`        {t("No user details were found")}!`
`    </div>`
`)`

The plugin complains about the exclamation point. When I try to exclude it with "words": { exclude: ["!"] } the warning doesn't go away. If I remove the indentations in the jsx then the warning goes away. I had to add this to eslintrc: "words": { exclude: ["!\\s*"] } to ignore all whitespace after the exclamation point created by the indentation in order to get rid of the warning.

I think the plugin should ignore all whitespace at least created by indentation if not all whitespace.

Pull request:
fix: fixes #94

Patch:
diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml
index 1d8c2af..feacc64 100644
--- a/.github/workflows/nodejs.yml
+++ b/.github/workflows/nodejs.yml
@@ -16,7 +16,7 @@ jobs:
 
     strategy:
       matrix:
-        node-version: [10.x, 12.x, 14.x, 15.x]
+        node-version: [12.x, 14.x, 16.x, 18.x]
 
     steps:
       - uses: actions/checkout@v1
diff --git a/lib/rules/no-literal-string.js b/lib/rules/no-literal-string.js
index 874b236..6d5c3be 100644
--- a/lib/rules/no-literal-string.js
+++ b/lib/rules/no-literal-string.js
@@ -27,7 +27,7 @@ function isValidLiteral(options, { value }) {
   const trimed = value.trim();
   if (!trimed) return true;
 
-  if (shouldSkip(options.words, value)) return true;
+  if (shouldSkip(options.words, trimed)) return true;
 }
 
 //------------------------------------------------------------------------------


Test patch:
diff --git a/tests/lib/fixtures/valid-jsx-text-only.jsx b/tests/lib/fixtures/valid-jsx-text-only.jsx
index 3b59a22..ed5514c 100644
--- a/tests/lib/fixtures/valid-jsx-text-only.jsx
+++ b/tests/lib/fixtures/valid-jsx-text-only.jsx
@@ -1,5 +1,9 @@
 a + 'b';
 
+<div className="alert alert-danger" role="alert">
+  {t("No user details were found")}!
+</div>;
+
 <>
   <div>{import('abc')}</div>
   <div>{[].map(item => 'cat')}</div>