Repository: i18next/i18next-parser
Pull request #421 (2021-09-17 04:02:41)

Bump prettier from 2.4.0 to 2.4.1
Bumps [prettier](https://github.com/prettier/prettier) from 2.4.0 to 2.4.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/releases">prettier's releases</a>.</em></p>
<blockquote>
<h2>2.4.1</h2>
<p>🔗 <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#241">Changelog</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's changelog</a>.</em></p>
<blockquote>
<h1>2.4.1</h1>
<p><a href="https://github.com/prettier/prettier/compare/2.4.0...2.4.1">diff</a></p>
<h4>Fix wildcard syntax in <code>@forward</code> (<a href="https://github-redirect.dependabot.com/prettier/prettier/pull/11482">#11482</a>) (<a href="https://github-redirect.dependabot.com/prettier/prettier/pull/11487">#11487</a> by <a href="https://github.com/niksy"><code>@​niksy</code></a>)</h4>
<!-- raw HTML omitted -->
<pre lang="scss"><code>// Input
@forward &quot;library&quot; as btn-*;
<p>// Prettier 2.4.0
<a href="https://github.com/forward"><code>@​forward</code></a> &quot;library&quot; as btn- *;</p>
<p>// Prettier 2.4.1
<a href="https://github.com/forward"><code>@​forward</code></a> &quot;library&quot; as btn-*;
</code></pre></p>
<h4>Add new CLI option <code>debug-print-ast</code> (<a href="https://github-redirect.dependabot.com/prettier/prettier/pull/11514">#11514</a> by <a href="https://github.com/sosukesuzuki"><code>@​sosukesuzuki</code></a>)</h4>
<p>A new <code>--debug-print-ast</code> CLI flag for debugging.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/prettier/prettier/commit/7ced9e66549b8d5a8e3a74473af462f86fb0245c"><code>7ced9e6</code></a> Release 2.4.1</li>
<li><a href="https://github.com/prettier/prettier/commit/59b5eb4e1faf912dd46759c98b45cfe5807e7a9f"><code>59b5eb4</code></a> Fix wildcard syntax in <code>@forward</code> (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11482">#11482</a>) (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11487">#11487</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/aa63269743e510ed1eaedaa4e9465430c9ff807d"><code>aa63269</code></a> Add new CLI option <code>debug-print-ast</code> (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11514">#11514</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/ae33e494a91ced3e80f139ca075cb27bc645acb2"><code>ae33e49</code></a> fix(docs): lint-staged install instructions (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11363">#11363</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/a1a7502f4f77498d24085862e9fd40f46c056f1e"><code>a1a7502</code></a> Update integrating-with-linters.md (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11399">#11399</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/f63e15d1cd37167984dc329a34fc050343e3a91b"><code>f63e15d</code></a> Build(deps): Bump typescript from 4.4.2 to 4.4.3 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11507">#11507</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/dec24722d65ea45afcf63af30857bea35ade4ed5"><code>dec2472</code></a> Build(deps-dev): Bump <code>@​babel/preset-env</code> from 7.15.4 to 7.15.6 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11499">#11499</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/ac3912cd4725b104290c8b1b95b801bbdfcce404"><code>ac3912c</code></a> Build(deps-dev): Bump eslint-plugin-unicorn from 35.0.0 to 36.0.0 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11504">#11504</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/bf5a027794316f3df2ea47dd06cee2f22940a735"><code>bf5a027</code></a> Revert workaround for node 16.9 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11493">#11493</a>)</li>
<li><a href="https://github.com/prettier/prettier/commit/ddee8dbaaecac095c9e2951bd6a1bddfb60fdfeb"><code>ddee8db</code></a> Build(deps): Bump espree from 8.0.0 to 9.0.0 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/11509">#11509</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/prettier/prettier/compare/2.4.0...2.4.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prettier&package-manager=npm_and_yarn&previous-version=2.4.0&new-version=2.4.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

codecov-commenter: # [Codecov](https://codecov.io/gh/i18next/i18next-parser/pull/421?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next) Report
> Merging [#421](https://codecov.io/gh/i18next/i18next-parser/pull/421?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next) (29e7672) into [master](https://codecov.io/gh/i18next/i18next-parser/commit/26a62d75edde5cfff3b737ad50f528d753b8b9e9?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next) (26a62d7) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/i18next/i18next-parser/pull/421/graphs/tree.svg?width=650&height=150&src=pr&token=CJ74Vps41L&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next)](https://codecov.io/gh/i18next/i18next-parser/pull/421?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next)

```diff
@@           Coverage Diff           @@
##           master     #421   +/-   ##
=======================================
  Coverage   93.12%   93.12%           
=======================================
  Files           9        9           
  Lines         611      611           
=======================================
  Hits          569      569           
  Misses         42       42           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/i18next/i18next-parser/pull/421?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/i18next/i18next-parser/pull/421?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next). Last update [26a62d7...29e7672](https://codecov.io/gh/i18next/i18next-parser/pull/421?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=i18next).


Patch:
diff --git a/dist/lexers/javascript-lexer.js b/dist/lexers/javascript-lexer.js
index 565249c..0c5d87e 100644
--- a/dist/lexers/javascript-lexer.js
+++ b/dist/lexers/javascript-lexer.js
@@ -163,8 +163,9 @@ JavascriptLexer = /*#__PURE__*/function (_BaseLexer) {(0, _inherits2["default"])
 
         // Second argument could be a string default value
         if (
-        optionsArgument &&
-        optionsArgument.kind === ts.SyntaxKind.StringLiteral)
+        optionsArgument && (
+        optionsArgument.kind === ts.SyntaxKind.StringLiteral ||
+        optionsArgument.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral))
         {
           entry.defaultValue = optionsArgument.text;
           optionsArgument = node.arguments.shift();
diff --git a/package.json b/package.json
index b0669a6..5432d03 100644
--- a/package.json
+++ b/package.json
@@ -63,7 +63,7 @@
     "gulp": "^4.0.0",
     "mocha": "^9.0.0",
     "nyc": "^15.1.0",
-    "prettier": "2.4.0",
+    "prettier": "2.4.1",
     "sinon": "^11.1.1"
   },
   "keywords": [
diff --git a/src/lexers/javascript-lexer.js b/src/lexers/javascript-lexer.js
index 690c2c7..357bab8 100644
--- a/src/lexers/javascript-lexer.js
+++ b/src/lexers/javascript-lexer.js
@@ -164,7 +164,8 @@ export default class JavascriptLexer extends BaseLexer {
       // Second argument could be a string default value
       if (
         optionsArgument &&
-        optionsArgument.kind === ts.SyntaxKind.StringLiteral
+        (optionsArgument.kind === ts.SyntaxKind.StringLiteral ||
+          optionsArgument.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral)
       ) {
         entry.defaultValue = optionsArgument.text
         optionsArgument = node.arguments.shift()
diff --git a/yarn.lock b/yarn.lock
index ab72e46..c8f5eda 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4417,10 +4417,10 @@ posix-character-classes@^0.1.0:
   resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
   integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=
 
-prettier@2.4.0:
-  version "2.4.0"
-  resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.0.tgz#85bdfe0f70c3e777cf13a4ffff39713ca6f64cba"
-  integrity sha512-DsEPLY1dE5HF3BxCRBmD4uYZ+5DCbvatnolqTqcxEgKVZnL2kUfyu7b8pPQ5+hTBkdhU9SLUmK0/pHb07RE4WQ==
+prettier@2.4.1:
+  version "2.4.1"
+  resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
+  integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==
 
 pretty-hrtime@^1.0.0:
   version "1.0.3"


Test patch:
diff --git a/test/lexers/javascript-lexer.test.js b/test/lexers/javascript-lexer.test.js
index 6a869e3..adddef1 100644
--- a/test/lexers/javascript-lexer.test.js
+++ b/test/lexers/javascript-lexer.test.js
@@ -10,7 +10,7 @@ describe('JavascriptLexer', () => {
     done()
   })
 
-  it('extracts the second argument as defaultValue', (done) => {
+  it('extracts the second argument string literal as defaultValue', (done) => {
     const Lexer = new JavascriptLexer()
     const content = 'i18n.t("first", "bla")'
     assert.deepEqual(Lexer.extract(content), [
@@ -19,6 +19,15 @@ describe('JavascriptLexer', () => {
     done()
   })
 
+  it('extracts the second argument template literal as defaultValue', (done) => {
+    const Lexer = new JavascriptLexer()
+    const content = 'i18n.t("first", `bla`)'
+    assert.deepEqual(Lexer.extract(content), [
+      { key: 'first', defaultValue: 'bla' },
+    ])
+    done()
+  })
+
   it('extracts the defaultValue/context options', (done) => {
     const Lexer = new JavascriptLexer()
     const content = 'i18n.t("first", {defaultValue: "foo", context: \'bar\'})'