Skip to content

Commit e38cc39

Browse files
committed
refactor: add JSON configuration
1 parent 511f2d1 commit e38cc39

File tree

4 files changed

+199
-1
lines changed

4 files changed

+199
-1
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"cSpell.words": ["Flashlist", "Lato"],
2828
"i18n-ally.localesPaths": ["src/translations/"],
2929
"i18n-ally.keystyle": "nested",
30-
"i18n-ally.disabled": false, // make sure to disable i18n-ally in your global setting and only enable it for such projects
30+
"i18n-ally.disabled": false,
3131
"tailwindCSS.experimental.classRegex": [
3232
["tv\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
3333
]

eslint.config.mjs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
22
import typescriptEslintParser from '@typescript-eslint/parser';
3+
import eslintPluginI18nJson from 'eslint-plugin-i18n-json';
4+
import jsonPlugin from 'eslint-plugin-json';
35
import reactPlugin from 'eslint-plugin-react';
46
import reactHooksPlugin from 'eslint-plugin-react-hooks';
57
import reactNativePlugin from 'eslint-plugin-react-native';
68
import simpleImportSort from 'eslint-plugin-simple-import-sort';
79
import unicorn from 'eslint-plugin-unicorn';
810
import unusedImports from 'eslint-plugin-unused-imports';
11+
import path from 'path';
912

1013
export default [
1114
{
@@ -71,4 +74,43 @@ export default [
7174
},
7275
},
7376
},
77+
{
78+
// JSON configuration
79+
files: ['**/*.json'],
80+
processor: jsonPlugin.processors['.json'],
81+
plugins: {
82+
json: jsonPlugin,
83+
'i18n-json': eslintPluginI18nJson,
84+
},
85+
rules: {
86+
...jsonPlugin.configs.recommended.rules,
87+
'i18n-json/valid-message-syntax': [
88+
2,
89+
{
90+
syntax: path.resolve('./scripts/i18next-syntax-validation.js'),
91+
},
92+
],
93+
'i18n-json/valid-json': 2,
94+
'i18n-json/sorted-keys': [
95+
2,
96+
{
97+
order: 'asc',
98+
indentSpaces: 2,
99+
},
100+
],
101+
'i18n-json/identical-keys': [
102+
2,
103+
{
104+
filePath: path.resolve('./src/translations/en.json'),
105+
},
106+
],
107+
'prettier/prettier': [
108+
0,
109+
{
110+
singleQuote: true,
111+
endOfLine: 'auto',
112+
},
113+
],
114+
},
115+
},
74116
];

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103
"babel-plugin-module-resolver": "^5.0.2",
104104
"cross-env": "^7.0.3",
105105
"dotenv": "^16.4.5",
106+
"eslint-plugin-i18n-json": "^4.0.1",
107+
"eslint-plugin-json": "^4.0.1",
106108
"eslint-plugin-react": "^7.37.4",
107109
"eslint-plugin-react-hooks": "^5.1.0",
108110
"eslint-plugin-react-native": "^5.0.0",

pnpm-lock.yaml

Lines changed: 154 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)