react-intl-lint 1.0.4 → 1.1.0
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/LICENSE.md +21 -21
- package/README.md +299 -229
- package/dist/bin.d.ts +2 -2
- package/dist/bin.js +4 -4
- package/dist/package.json +104 -121
- package/dist/src/cli/bin.d.ts +2 -2
- package/dist/src/cli/bin.js +17 -6
- package/dist/src/cli/bin.js.map +1 -1
- package/dist/src/cli/cli.d.ts +17 -16
- package/dist/src/cli/cli.js +217 -173
- package/dist/src/cli/cli.js.map +1 -1
- package/dist/src/cli/dictionaries/CliOptions.d.ts +3 -3
- package/dist/src/cli/dictionaries/CliOptions.js +171 -157
- package/dist/src/cli/dictionaries/CliOptions.js.map +1 -1
- package/dist/src/cli/dictionaries/index.d.ts +1 -1
- package/dist/src/cli/dictionaries/index.js +17 -17
- package/dist/src/cli/enums/OptionsNames.d.ts +31 -29
- package/dist/src/cli/enums/OptionsNames.js +35 -35
- package/dist/src/cli/enums/OptionsNames.js.map +1 -1
- package/dist/src/cli/enums/OptionsPath.d.ts +6 -5
- package/dist/src/cli/enums/OptionsPath.js +9 -9
- package/dist/src/cli/enums/OptionsPath.js.map +1 -1
- package/dist/src/cli/enums/index.d.ts +2 -2
- package/dist/src/cli/enums/index.js +18 -18
- package/dist/src/cli/models/Option.d.ts +7 -7
- package/dist/src/cli/models/Option.js +35 -35
- package/dist/src/cli/models/Option.js.map +1 -1
- package/dist/src/cli/models/index.d.ts +1 -1
- package/dist/src/cli/models/index.js +17 -17
- package/dist/src/cli/utils/file.d.ts +3 -3
- package/dist/src/cli/utils/file.js +59 -50
- package/dist/src/cli/utils/file.js.map +1 -1
- package/dist/src/cli/utils/index.d.ts +1 -1
- package/dist/src/cli/utils/index.js +17 -17
- package/dist/src/core/index.d.ts +1 -7
- package/dist/src/core/index.js +17 -23
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/react-intl/regex.d.ts +1 -0
- package/dist/src/react-intl/regex.js +8 -0
- package/dist/src/react-intl/regex.js.map +1 -0
- package/package.json +104 -121
- package/dist/src/core/client.d.ts +0 -16
- package/dist/src/core/client.js +0 -171
- package/dist/src/core/client.js.map +0 -1
- package/dist/src/core/config.d.ts +0 -3
- package/dist/src/core/config.js +0 -24
- package/dist/src/core/config.js.map +0 -1
- package/dist/src/core/enums/ErrorFlow.d.ts +0 -15
- package/dist/src/core/enums/ErrorFlow.js +0 -20
- package/dist/src/core/enums/ErrorFlow.js.map +0 -1
- package/dist/src/core/enums/ErrorTypes.d.ts +0 -6
- package/dist/src/core/enums/ErrorTypes.js +0 -11
- package/dist/src/core/enums/ErrorTypes.js.map +0 -1
- package/dist/src/core/enums/StatusCodes.d.ts +0 -6
- package/dist/src/core/enums/StatusCodes.js +0 -11
- package/dist/src/core/enums/StatusCodes.js.map +0 -1
- package/dist/src/core/enums/ToggleRule.d.ts +0 -5
- package/dist/src/core/enums/ToggleRule.js +0 -10
- package/dist/src/core/enums/ToggleRule.js.map +0 -1
- package/dist/src/core/enums/index.d.ts +0 -4
- package/dist/src/core/enums/index.js +0 -21
- package/dist/src/core/enums/index.js.map +0 -1
- package/dist/src/core/interface/IAppConfig.d.ts +0 -10
- package/dist/src/core/interface/IAppConfig.js +0 -3
- package/dist/src/core/interface/IAppConfig.js.map +0 -1
- package/dist/src/core/interface/ILogger.d.ts +0 -5
- package/dist/src/core/interface/ILogger.js +0 -3
- package/dist/src/core/interface/ILogger.js.map +0 -1
- package/dist/src/core/interface/IMisprint.d.ts +0 -6
- package/dist/src/core/interface/IMisprint.js +0 -3
- package/dist/src/core/interface/IMisprint.js.map +0 -1
- package/dist/src/core/interface/IRule.d.ts +0 -8
- package/dist/src/core/interface/IRule.js +0 -3
- package/dist/src/core/interface/IRule.js.map +0 -1
- package/dist/src/core/interface/IRulesConfig.d.ts +0 -14
- package/dist/src/core/interface/IRulesConfig.js +0 -3
- package/dist/src/core/interface/IRulesConfig.js.map +0 -1
- package/dist/src/core/interface/IValidationMessage.d.ts +0 -5
- package/dist/src/core/interface/IValidationMessage.js +0 -3
- package/dist/src/core/interface/IValidationMessage.js.map +0 -1
- package/dist/src/core/interface/index.d.ts +0 -6
- package/dist/src/core/interface/index.js +0 -23
- package/dist/src/core/interface/index.js.map +0 -1
- package/dist/src/core/models/KeyModel.d.ts +0 -8
- package/dist/src/core/models/KeyModel.js +0 -15
- package/dist/src/core/models/KeyModel.js.map +0 -1
- package/dist/src/core/models/KeyModelWithLanguages.d.ts +0 -18
- package/dist/src/core/models/KeyModelWithLanguages.js +0 -29
- package/dist/src/core/models/KeyModelWithLanguages.js.map +0 -1
- package/dist/src/core/models/LanguagesModel.d.ts +0 -7
- package/dist/src/core/models/LanguagesModel.js +0 -12
- package/dist/src/core/models/LanguagesModel.js.map +0 -1
- package/dist/src/core/models/MisprintModel.d.ts +0 -8
- package/dist/src/core/models/MisprintModel.js +0 -12
- package/dist/src/core/models/MisprintModel.js.map +0 -1
- package/dist/src/core/models/StylishLogger.d.ts +0 -11
- package/dist/src/core/models/StylishLogger.js +0 -37
- package/dist/src/core/models/StylishLogger.js.map +0 -1
- package/dist/src/core/models/error/ErrorModel.d.ts +0 -7
- package/dist/src/core/models/error/ErrorModel.js +0 -4
- package/dist/src/core/models/error/ErrorModel.js.map +0 -1
- package/dist/src/core/models/error/FatalErrorModel.d.ts +0 -7
- package/dist/src/core/models/error/FatalErrorModel.js +0 -16
- package/dist/src/core/models/error/FatalErrorModel.js.map +0 -1
- package/dist/src/core/models/error/index.d.ts +0 -2
- package/dist/src/core/models/error/index.js +0 -19
- package/dist/src/core/models/error/index.js.map +0 -1
- package/dist/src/core/models/files/FileLanguageModel.d.ts +0 -10
- package/dist/src/core/models/files/FileLanguageModel.js +0 -90
- package/dist/src/core/models/files/FileLanguageModel.js.map +0 -1
- package/dist/src/core/models/files/FileModel.d.ts +0 -12
- package/dist/src/core/models/files/FileModel.js +0 -44
- package/dist/src/core/models/files/FileModel.js.map +0 -1
- package/dist/src/core/models/files/FileViewModel.d.ts +0 -7
- package/dist/src/core/models/files/FileViewModel.js +0 -22
- package/dist/src/core/models/files/FileViewModel.js.map +0 -1
- package/dist/src/core/models/files/index.d.ts +0 -3
- package/dist/src/core/models/files/index.js +0 -20
- package/dist/src/core/models/files/index.js.map +0 -1
- package/dist/src/core/models/index.d.ts +0 -8
- package/dist/src/core/models/index.js +0 -25
- package/dist/src/core/models/index.js.map +0 -1
- package/dist/src/core/models/results/ResultCliModel.d.ts +0 -22
- package/dist/src/core/models/results/ResultCliModel.js +0 -84
- package/dist/src/core/models/results/ResultCliModel.js.map +0 -1
- package/dist/src/core/models/results/ResultErrorModel.d.ts +0 -13
- package/dist/src/core/models/results/ResultErrorModel.js +0 -43
- package/dist/src/core/models/results/ResultErrorModel.js.map +0 -1
- package/dist/src/core/models/results/ResultFileModel.d.ts +0 -11
- package/dist/src/core/models/results/ResultFileModel.js +0 -16
- package/dist/src/core/models/results/ResultFileModel.js.map +0 -1
- package/dist/src/core/models/results/ResultModel.d.ts +0 -15
- package/dist/src/core/models/results/ResultModel.js +0 -62
- package/dist/src/core/models/results/ResultModel.js.map +0 -1
- package/dist/src/core/models/results/index.d.ts +0 -4
- package/dist/src/core/models/results/index.js +0 -21
- package/dist/src/core/models/results/index.js.map +0 -1
- package/dist/src/core/rules/AbsentViewKeysRule.d.ts +0 -12
- package/dist/src/core/rules/AbsentViewKeysRule.js +0 -38
- package/dist/src/core/rules/AbsentViewKeysRule.js.map +0 -1
- package/dist/src/core/rules/EmptyKeysRule.d.ts +0 -10
- package/dist/src/core/rules/EmptyKeysRule.js +0 -25
- package/dist/src/core/rules/EmptyKeysRule.js.map +0 -1
- package/dist/src/core/rules/MisprintRule.d.ts +0 -12
- package/dist/src/core/rules/MisprintRule.js +0 -38
- package/dist/src/core/rules/MisprintRule.js.map +0 -1
- package/dist/src/core/rules/ZombiesRule.d.ts +0 -10
- package/dist/src/core/rules/ZombiesRule.js +0 -26
- package/dist/src/core/rules/ZombiesRule.js.map +0 -1
- package/dist/src/core/rules/index.d.ts +0 -4
- package/dist/src/core/rules/index.js +0 -21
- package/dist/src/core/rules/index.js.map +0 -1
- package/dist/src/core/utils/index.d.ts +0 -4
- package/dist/src/core/utils/index.js +0 -21
- package/dist/src/core/utils/index.js.map +0 -1
- package/dist/src/core/utils/keys.d.ts +0 -7
- package/dist/src/core/utils/keys.js +0 -40
- package/dist/src/core/utils/keys.js.map +0 -1
- package/dist/src/core/utils/logger.d.ts +0 -3
- package/dist/src/core/utils/logger.js +0 -13
- package/dist/src/core/utils/logger.js.map +0 -1
- package/dist/src/core/utils/path.d.ts +0 -5
- package/dist/src/core/utils/path.js +0 -56
- package/dist/src/core/utils/path.js.map +0 -1
- package/dist/src/core/utils/shared.d.ts +0 -2
- package/dist/src/core/utils/shared.js +0 -24
- package/dist/src/core/utils/shared.js.map +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,229 +1,299 @@
|
|
|
1
|
-
# react-intl-lint
|
|
2
|
-
|
|
3
|
-
> Simple tools for check react-intl keys in whole app which use regexp.
|
|
4
|
-
|
|
5
|
-
[](https://github.com/semantic-release/semantic-release)
|
|
6
|
-
[](https://www.npmjs.com/package/react-intl-lint)
|
|
7
|
-
[](https://www.npmjs.com/package/react-intl-lint)
|
|
8
|
-
|
|
9
|
-
> for `react-i18next` use [`react-i18next-lint`](https://www.npmjs.com/package/react-i18next-lint)
|
|
10
|
-
>
|
|
11
|
-
> for `ngx-translate` use [`ngx-translate-lint`](https://www.npmjs.com/package/ngx-translate-lint)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
|
|
19
|
-
- [
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
[GitHub
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
"
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
1
|
+
# react-intl-lint
|
|
2
|
+
|
|
3
|
+
> Simple tools for check react-intl keys in whole app which use regexp.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
6
|
+
[](https://www.npmjs.com/package/react-intl-lint)
|
|
7
|
+
[](https://www.npmjs.com/package/react-intl-lint)
|
|
8
|
+
|
|
9
|
+
> for `react-i18next` use [`react-i18next-lint`](https://www.npmjs.com/package/react-i18next-lint)
|
|
10
|
+
>
|
|
11
|
+
> for `ngx-translate` use [`ngx-translate-lint`](https://www.npmjs.com/package/ngx-translate-lint)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Background](#background)
|
|
17
|
+
- [Installation](#installation)
|
|
18
|
+
- [Usage](#usage)
|
|
19
|
+
- [CLI](#cli)
|
|
20
|
+
- [TypeScript](#TypeScript)
|
|
21
|
+
- [Contribute](#contribute)
|
|
22
|
+
- [Used By](#UsedBy)
|
|
23
|
+
- [License](#license)
|
|
24
|
+
|
|
25
|
+
## Background
|
|
26
|
+
|
|
27
|
+
There are a lot of translation `react-intl` keys in the whole app.
|
|
28
|
+
This repository contains a proposal to check all translation keys in the whole app
|
|
29
|
+
which should exist in all languages files.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
### NPM
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install react-intl-lint -g
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### GitHub
|
|
40
|
+
|
|
41
|
+
The source code are available for download
|
|
42
|
+
at [GitHub Releases][github-release-url] and
|
|
43
|
+
[GitHub pages][github-pages-url] as well.
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
### CLI
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
|
|
51
|
+
Usage: react-intl-lint [options]
|
|
52
|
+
|
|
53
|
+
Simple CLI tools for check `react-intl` keys in app
|
|
54
|
+
|
|
55
|
+
Options:
|
|
56
|
+
-p, --project [glob]
|
|
57
|
+
The path to project folder
|
|
58
|
+
Possible Values: <relative path|absolute path>
|
|
59
|
+
|
|
60
|
+
-l, --languages [glob]
|
|
61
|
+
The path to languages folder
|
|
62
|
+
Possible Values: <relative path|absolute path|URL>
|
|
63
|
+
|
|
64
|
+
--kv, --keysOnViews [enum]
|
|
65
|
+
Described how to handle the error of missing keys on view
|
|
66
|
+
Possible Values: <disable|warning|error>
|
|
67
|
+
|
|
68
|
+
--zk, --zombieKeys [enum]
|
|
69
|
+
Described how to handle the error of zombies keys. Zombie keys are keys that doesn't exist on any languages file but exist on project, or exist languages but doesn't exist on project
|
|
70
|
+
Possible Values: <disable|warning|error>
|
|
71
|
+
|
|
72
|
+
--ek, --emptyKeys [enum]
|
|
73
|
+
Described how to handle empty value on translate keys. Empty keys are keys that doesn't have any value on languages files
|
|
74
|
+
Possible Values: <disable|warning|error>
|
|
75
|
+
|
|
76
|
+
-i, --ignore [glob]
|
|
77
|
+
Ignore projects and languages files
|
|
78
|
+
Possible Values: <relative path|absolute path>
|
|
79
|
+
|
|
80
|
+
--maxWarning [glob]
|
|
81
|
+
Max count of warnings in all files. If this value more that count of warnings, then an error is return
|
|
82
|
+
Possible Values: <number>
|
|
83
|
+
|
|
84
|
+
--mk, --misprintKeys [enum]
|
|
85
|
+
Try to find matches with misprint keys on views and languages keys. Coefficient: 0.9. Can be longer process!!
|
|
86
|
+
Possible Values: <disable|warning|error>
|
|
87
|
+
|
|
88
|
+
--ds, --deepSearch [enum]
|
|
89
|
+
Add each translate key to global regexp end try to find them on project. Can be longer process!!
|
|
90
|
+
Possible Values: <disable|enable>
|
|
91
|
+
|
|
92
|
+
--mc, --misprintCoefficient [number]
|
|
93
|
+
Coefficient for misprint option can be from 0 to 1.0.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
-c, --config [path]
|
|
97
|
+
Path to config via JSON or JS file
|
|
98
|
+
Possible Values: <relative path|absolute path>
|
|
99
|
+
|
|
100
|
+
--fz, --fixZombiesKeys [boolean]
|
|
101
|
+
Auto fix zombies keys on languages files
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
-v, --version Print current version of react-intl-lint
|
|
105
|
+
-h, --help display help for command
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
Examples:
|
|
109
|
+
|
|
110
|
+
$ npx react-intl-lint -p ./src/app/**/*.{html,ts,js} -l ./src/assets/i18n/*.json
|
|
111
|
+
$ react-intl-lint -p ./src/app/**/*.{html,ts,js} -l ./src/assets/i18n/*.json
|
|
112
|
+
$ react-intl-lint -p ./src/app/**/*.{html,ts,js} -z disable -v error
|
|
113
|
+
$ react-intl-lint -p ./src/app/**/*.{html,ts,js} -l https://8.8.8.8/locales/EN-eu.json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
> NOTE: For `project` and `languages` options need to include file types like on the example.
|
|
117
|
+
|
|
118
|
+
Default JSON Config is:
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"rules": {
|
|
122
|
+
"keysOnViews": "error",
|
|
123
|
+
"zombieKeys": "warning",
|
|
124
|
+
"misprintKeys": "disable",
|
|
125
|
+
"deepSearch": "disable",
|
|
126
|
+
"emptyKeys": "warning",
|
|
127
|
+
"maxWarning": "0",
|
|
128
|
+
"misprintCoefficient": "0.9",
|
|
129
|
+
"ignoredKeys": [ "IGNORED.KEY.(.*)" ], // can be string or RegExp
|
|
130
|
+
"ignoredMisprintKeys": [],
|
|
131
|
+
"customRegExpToFindKeys": [ "(?<=marker\\(['\"])([A-Za-z0-9_\\-.]+)(?=['\"]\\))"], // to find: marker('TRSNLATE.KEY');
|
|
132
|
+
},
|
|
133
|
+
"fetch": {
|
|
134
|
+
"requestQuery": "",
|
|
135
|
+
"requestHeaders": {},
|
|
136
|
+
"responseQuery": ""
|
|
137
|
+
},
|
|
138
|
+
"fixZombiesKeys": false,
|
|
139
|
+
"project": "./src/app/**/*.{html,ts}",
|
|
140
|
+
"languages": "./src/assets/i18n/*.json"
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
JS Config should have `default` export via object like config. See example:
|
|
145
|
+
|
|
146
|
+
Example JS config is:
|
|
147
|
+
```javascript
|
|
148
|
+
|
|
149
|
+
const config = {
|
|
150
|
+
rules: {
|
|
151
|
+
keysOnViews: "error",
|
|
152
|
+
zombieKeys: "warning",
|
|
153
|
+
emptyKeys: "warning",
|
|
154
|
+
misprint: {
|
|
155
|
+
type: "warning",
|
|
156
|
+
coefficient: 0.9
|
|
157
|
+
},
|
|
158
|
+
ignoredKeys: [],
|
|
159
|
+
ignoredMisprintKeys: []
|
|
160
|
+
},
|
|
161
|
+
fetch: {
|
|
162
|
+
requestQuery: "",
|
|
163
|
+
requestHeaders: {},
|
|
164
|
+
responseQuery: "",
|
|
165
|
+
get: async () => {
|
|
166
|
+
const requestOne = fetch('https://8.8.8.8/locales/EN-eu.json');
|
|
167
|
+
const requestTwo = fetch('https://8.8.8.8/locales/EN-us.json');
|
|
168
|
+
const result = await Promise.all([requestOne, requestTwo]).then(async ([responseOne, responseTwo]) => {
|
|
169
|
+
return {
|
|
170
|
+
...(await responseOne.json()),
|
|
171
|
+
...(await responseTwo.json())
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
// NOTE: result should contains only translation keys. Example
|
|
175
|
+
// {
|
|
176
|
+
// "translation.key": "value"
|
|
177
|
+
// }
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
fixZombiesKeys: false,
|
|
182
|
+
project: "./src/app/**/*.{html,ts}",
|
|
183
|
+
languages: "./src/assets/i18n/*.json"
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export default config;
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### How to write Custom RegExp
|
|
190
|
+
|
|
191
|
+
We have `(?<=marker\\(['\"])([A-Za-z0-9_\\-.]+)(?=['\"]\\))` RegExp witch contains of 3 parts:
|
|
192
|
+
|
|
193
|
+
- Prefix - `(?<=marker\\(['\"])`
|
|
194
|
+
- This construction tells that what we need matching before translate key
|
|
195
|
+
- start with `(?<=` and end `)`.
|
|
196
|
+
- `marker\\(['\"]` - tells that we try to find word `market` witch have on the second character `'`or `"`
|
|
197
|
+
- To summarize, we are trying to find keys before each word to be `market` and commas `'` or `"`
|
|
198
|
+
|
|
199
|
+
- Matching for key: `([A-Za-z0-9_\\-.]+)`
|
|
200
|
+
- This construction tells that we find and save all words which contain alphabet, numbers, and `_` or `-`.
|
|
201
|
+
- We recommend using this part of RegExp to find and save translated keys
|
|
202
|
+
- But you can also use `(.*)` If it's enough for your project
|
|
203
|
+
- Postfix - `(?=['\"]\\))` (the same as prefix, but need to be ended)
|
|
204
|
+
- This construction tells that what we need matching after translate key
|
|
205
|
+
- start with `(?=` and end `)`
|
|
206
|
+
- `['\"]\\)` - tells that we try to find word comas `'` or `"` and ended with `)`
|
|
207
|
+
- To summarize, we are trying to find keys ended each word to be commas `'` or `"` and `)`
|
|
208
|
+
|
|
209
|
+
Example RegExp will find following keys
|
|
210
|
+
- `marker('TRSNLATE.KEY')`
|
|
211
|
+
- `marker("TRSNLATE.KEY-2")`
|
|
212
|
+
|
|
213
|
+
#### Exit Codes
|
|
214
|
+
|
|
215
|
+
The CLI process may exit with the following codes:
|
|
216
|
+
|
|
217
|
+
- `0`: Linting succeeded without errors (warnings may have occurred)
|
|
218
|
+
- `1`: Linting failed with one or more rule violations with severity error
|
|
219
|
+
- `2`: An invalid command line argument or combination thereof was used
|
|
220
|
+
|
|
221
|
+
### TypeScript
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
import {
|
|
225
|
+
ToggleRule,
|
|
226
|
+
NgxTranslateLint,
|
|
227
|
+
IRulesConfig,
|
|
228
|
+
ResultCliModel,
|
|
229
|
+
ErrorTypes,
|
|
230
|
+
LanguagesModel,
|
|
231
|
+
IFetch,
|
|
232
|
+
ngxTranslateRegEx,
|
|
233
|
+
} from 'ngx-translate-lint';
|
|
234
|
+
|
|
235
|
+
const viewsPath: string = './src/app/**/*.{html,ts}';
|
|
236
|
+
const languagesPath: string = './src/assets/i18n/*.json';
|
|
237
|
+
const ignoredLanguagesPath: string = "./src/assets/i18n/ru.json, ./src/assets/i18n/ru-RU.json";
|
|
238
|
+
const ruleConfig: IRulesConfig = {
|
|
239
|
+
keysOnViews: ErrorTypes.error,
|
|
240
|
+
zombieKeys: ErrorTypes.warning,
|
|
241
|
+
misprintKeys: ErrorTypes.disable,
|
|
242
|
+
deepSearch: ToggleRule.disable,
|
|
243
|
+
emptyKeys: ErrorTypes.warning,
|
|
244
|
+
maxWarning: 0,
|
|
245
|
+
misprintCoefficient: 0.9,
|
|
246
|
+
fixZombiesKeys: false,
|
|
247
|
+
ignoredKeys: ['EXAMPLE.KEY', 'IGNORED.KEY.(.*)'], // can be string or RegExp
|
|
248
|
+
ignoredMisprintKeys: [],
|
|
249
|
+
customRegExpToFindKeys: ["(?<=marker\\(['\"])([A-Za-z0-9_\\-.]+)(?=['\"]\\))"] // to find: marker('TRSNLATE.KEY');
|
|
250
|
+
};
|
|
251
|
+
const fixZombiesKeys: boolean = false;
|
|
252
|
+
const fetchSettings: IFetch = {
|
|
253
|
+
requestQuery: "",
|
|
254
|
+
requestHeaders: {},
|
|
255
|
+
responseQuery: "",
|
|
256
|
+
get: () => {
|
|
257
|
+
// You fetch to get locales
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const ngxTranslateRegEx: ngxTranslateRegEx = ngxTranslateRegEx; // Here can be your array of regexp to find keys
|
|
261
|
+
const ngxTranslateLint = new NgxTranslateLint(viewsPath, languagesPath, ignoredLanguagesPath, ruleConfig, fixZombiesKeys, fetchSettings, ngxTranslateRegEx)
|
|
262
|
+
const resultLint: ResultCliModel = ngxTranslateLint.lint(); // Run Lint
|
|
263
|
+
const languages: LanguagesModel[] = ngxTranslateLint.getLanguages() // Get Languages with all keys and views
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Contribute
|
|
268
|
+
|
|
269
|
+
You may contribute in several ways like requesting new features,
|
|
270
|
+
adding tests, fixing bugs, improving documentation or examples.
|
|
271
|
+
Please check our [contributing guidelines][contributing].
|
|
272
|
+
|
|
273
|
+
## Used By
|
|
274
|
+
|
|
275
|
+
Here can be your extensions:
|
|
276
|
+
|
|
277
|
+
- [ngx-translate-editor](https://github.com/svoboda-rabstvo/ngx-translate-editor) - Simple GUI for CRUD translate keys of ngx-translate, which included ngx-translate-lint
|
|
278
|
+
- [121 Platform](https://github.com/global-121/121-platform) - 121 is an open source platform for Cash based Aid built with Digital Identity & Local/Global Financial service partners.
|
|
279
|
+
|
|
280
|
+
## License
|
|
281
|
+
|
|
282
|
+
[MIT][license-url]
|
|
283
|
+
|
|
284
|
+
[react-intl]: https://formatjs.io/docs/getting-started/installation/
|
|
285
|
+
[semantic-shield]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
|
286
|
+
[semantic-url]: https://github.com/semantic-release/semantic-release
|
|
287
|
+
[npm-shield]: https://img.shields.io/npm/v/svoboda-rabstvo/react-intl-lint.svg
|
|
288
|
+
[npm-url]: https://www.npmjs.com/package/react-intl-lint
|
|
289
|
+
[npm]: https://www.npmjs.com
|
|
290
|
+
[node-js]: https://nodejs.org
|
|
291
|
+
[github-shield]: https://img.shields.io/github/release/svoboda-rabstvo/react-intl-lint.svg?label=github
|
|
292
|
+
[github-url]: https://github.com/svoboda-rabstvo/react-intl-lint
|
|
293
|
+
[github-release-url]: https://github.com/svoboda-rabstvo/react-intl-lint/releases
|
|
294
|
+
[github-pages-url]: https://svoboda-rabstvo.github.io/react-intl-lint/
|
|
295
|
+
[schema-url]: http://json-schema.org/
|
|
296
|
+
[doc-url]: https://github.com/svoboda-rabstvo/react-intl-lint/blob/develop/doc
|
|
297
|
+
[license-url]: https://github.com/svoboda-rabstvo/react-intl-lint/blob/develop/LICENSE.md
|
|
298
|
+
[meta-url]: https://en.wikipedia.org/wiki/List_of_software_package_management_systems#Meta_package_managers
|
|
299
|
+
[contributing]: https://github.com/svoboda-rabstvo/react-intl-lint/blob/develop/.github/CONTRIBUTING.md
|
package/dist/bin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import './src/cli/bin';
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import './src/cli/bin';
|
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
require("./src/cli/bin");
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("./src/cli/bin");
|
|
5
5
|
//# sourceMappingURL=bin.js.map
|