@generaltranslation/gt-next-lint 10.0.6 → 10.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -45
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://generaltranslation.com/docs/next">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://generaltranslation.com/gt-logo-dark.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://generaltranslation.com/gt-logo-light.svg">
|
|
6
|
+
<img alt="General Translation" src="https://generaltranslation.com/gt-logo-light.svg" width="100" height="100">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://generaltranslation.com/docs/next"><strong>Documentation</strong></a> · <a href="https://github.com/generaltranslation/gt/issues">Report Bug</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
1
15
|
# @generaltranslation/gt-next-lint
|
|
2
16
|
|
|
3
|
-
ESLint plugin
|
|
17
|
+
ESLint plugin for gt-next translation errors.
|
|
4
18
|
|
|
5
19
|
## Installation
|
|
6
20
|
|
|
@@ -8,11 +22,10 @@ ESLint plugin that catches common translation errors in gt-next components.
|
|
|
8
22
|
npm install --save-dev @generaltranslation/gt-next-lint
|
|
9
23
|
```
|
|
10
24
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
Add to your `eslint.config.mjs`:
|
|
25
|
+
## Usage
|
|
14
26
|
|
|
15
|
-
```
|
|
27
|
+
```js
|
|
28
|
+
// eslint.config.mjs
|
|
16
29
|
import gtNext from '@generaltranslation/gt-next-lint';
|
|
17
30
|
|
|
18
31
|
export default [
|
|
@@ -26,43 +39,4 @@ export default [
|
|
|
26
39
|
];
|
|
27
40
|
```
|
|
28
41
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### `no-dynamic-jsx`
|
|
32
|
-
|
|
33
|
-
Wraps dynamic content in `<T>` components with variable components.
|
|
34
|
-
|
|
35
|
-
```jsx
|
|
36
|
-
// ❌ Wrong
|
|
37
|
-
<T>Hello {userName}!</T>
|
|
38
|
-
|
|
39
|
-
// ✅ Correct
|
|
40
|
-
<T>Hello <Var>{userName}</Var>!</T>
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### `no-dynamic-string`
|
|
44
|
-
|
|
45
|
-
Only allows string literals in translation functions.
|
|
46
|
-
|
|
47
|
-
```jsx
|
|
48
|
-
const t = useGT();
|
|
49
|
-
|
|
50
|
-
// ❌ Wrong
|
|
51
|
-
t(`Hello ${name}`)
|
|
52
|
-
t('Hello ' + name)
|
|
53
|
-
|
|
54
|
-
// ✅ Correct
|
|
55
|
-
t('Hello, {name}!', { name })
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Supported Components
|
|
59
|
-
|
|
60
|
-
- `<Var>` - Variables
|
|
61
|
-
- `<DateTime>` - Dates
|
|
62
|
-
- `<Num>` - Numbers
|
|
63
|
-
- `<Currency>` - Currency
|
|
64
|
-
|
|
65
|
-
## Supported Functions
|
|
66
|
-
|
|
67
|
-
- `useGT()` - Client translations
|
|
68
|
-
- `getGT()` - Server translations
|
|
42
|
+
See the [full documentation](https://generaltranslation.com/docs/next) for guides and API reference.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@generaltranslation/gt-next-lint",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.7",
|
|
4
4
|
"description": "ESLint plugin for General Translation Next.js integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"eslint": "^8.0.0 || ^9.0.0",
|
|
38
38
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
39
39
|
"@typescript-eslint/parser": "^8.0.0",
|
|
40
|
-
"gt-next": "6.12.
|
|
40
|
+
"gt-next": "6.12.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/eslint": "^8.56.0",
|