1+ // eslint.config.js
2+ // @ts -expect-error: @eslint/eslintrc has no types
13import { FlatCompat } from '@eslint/eslintrc' ;
24import js from '@eslint/js' ;
35import json from "@eslint/json" ;
46import tseslint from "typescript-eslint" ;
57import process from 'process' ;
68
9+ import i18nUsage from './scripts/eslint/i18n-usage' ;
10+
711const dirname = process . cwd ( ) ;
812
913const compat = new FlatCompat ( {
@@ -33,7 +37,7 @@ const appConfigs = compat.config({
3337 '@typescript-eslint' ,
3438 'react-refresh' ,
3539 'simple-import-sort' ,
36- 'import-newlines'
40+ 'import-newlines' ,
3741 ] ,
3842 settings : {
3943 'import/parsers' : {
@@ -101,7 +105,9 @@ const appConfigs = compat.config({
101105 'react/require-default-props' : [ 'warn' , { ignoreFunctionalComponents : true } ] ,
102106 'simple-import-sort/imports' : 'warn' ,
103107 'simple-import-sort/exports' : 'warn' ,
104- 'import-newlines/enforce' : [ 'warn' , 1 ]
108+ 'import-newlines/enforce' : [ 'warn' , 1 ] ,
109+
110+ // 'i18n-usage/ensure-i18n-keys-used': ['warn']
105111 } ,
106112 overrides : [
107113 {
@@ -128,7 +134,7 @@ const appConfigs = compat.config({
128134 }
129135 }
130136 ]
131- } ) . map ( ( conf ) => ( {
137+ } ) . map ( ( conf : object ) => ( {
132138 ...conf ,
133139 files : [ 'src/**/*.tsx' , 'src/**/*.jsx' , 'src/**/*.ts' , 'src/**/*.js' ] ,
134140 ignores : [
@@ -139,27 +145,43 @@ const appConfigs = compat.config({
139145 ] ,
140146} ) ) ;
141147
148+ const tseslintRecommendedRules = tseslint . configs . recommended . map ( ( conf ) => ( {
149+ ...( conf . rules )
150+ } ) ) ;
151+
142152const otherConfig = {
143153 files : [ '*.js' , '*.ts' , '*.cjs' ] ,
144154 ...js . configs . recommended ,
145- ...tseslint . configs . recommended ,
155+ ...tseslintRecommendedRules ,
146156} ;
147157
148158const jsonConfig = {
149159 files : [ '**/*.json' ] ,
150160 language : 'json/json' ,
151161 rules : {
152162 'json/no-duplicate-keys' : 'error' ,
163+ 'json/no-empty-keys' : 'error' ,
164+ 'i18n-usage/ensure-i18n-keys-used' : 'warn' ,
153165 } ,
154166} ;
155167
168+ // const i18nJsonConfig = {
169+ // files: ['**/i18n.json'],
170+ // language: 'json/json',
171+ // rules: {
172+ // 'i18n-usage/ensure-i18n-keys-used': 'warn',
173+ // },
174+ // };
175+
156176export default [
157177 {
158178 plugins : {
159179 json,
180+ 'i18n-usage' : i18nUsage ,
160181 } ,
161182 } ,
162183 ...appConfigs ,
163184 otherConfig ,
164185 jsonConfig ,
186+ // i18nJsonConfig,
165187] ;
0 commit comments