-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Eslint 9 + flat config support (#49)
- Loading branch information
1 parent
0c80feb
commit b57329b
Showing
31 changed files
with
5,221 additions
and
3,637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ lib | |
.DS_Store | ||
coverage | ||
.idea | ||
.yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# no-expression-in-message | ||
|
||
Check that `` t` ` `` doesn't contain member or function expressions like `` t`Hello ${user.name}` `` or `` t`Hello ${getName()}` `` | ||
|
||
Such expressions would be transformed to its index position such as `Hello {0}` which gives zero to little context for translator. | ||
|
||
Use a variable identifier instead. | ||
|
||
```jsx | ||
// nope ⛔️ | ||
t`Hello ${user.name}` // => 'Hello {0}' | ||
|
||
// ok ✅ | ||
const userName = user.name | ||
t`Hello ${userName}` // => 'Hello {userName}' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# no-single-tag-to-translate | ||
|
||
> [!TIP] | ||
> This rule is included into the `lingui/recommended` config | ||
Ensures `<Trans></Trans>` isn't wrapping a single element unnecessarily | ||
|
||
```jsx | ||
// nope ⛔️ | ||
<Trans><strong>Foo bar</strong></Trans> | ||
|
||
// ok ✅ | ||
<strong><Trans>Foo bar</Trans></strong> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# no-single-variables-to-translate | ||
|
||
> [!TIP] | ||
> This rule is included into the `lingui/recommended` config | ||
Doesn't allow single variables without text to translate like `<Trans>{variable}</Trans>` or `` t`${variable}` `` | ||
|
||
Such expression would pollute message catalog with useless string which has nothing to translate. | ||
|
||
```jsx | ||
// nope ⛔️ | ||
<Trans>{user}</Trans> | ||
|
||
// ok ✅ | ||
<Trans>Hello {user}</Trans> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# no-trans-inside-trans | ||
|
||
> [!TIP] | ||
> This rule is included into the `lingui/recommended` config | ||
Check that no `Trans` inside `Trans` components. | ||
|
||
```jsx | ||
// nope ⛔️ | ||
<Trans>Hello <Trans>World!</Trans></Trans> | ||
|
||
// ok ✅ | ||
<Trans>Hello World!</Trans> | ||
``` |
Oops, something went wrong.