Open a-schyja opened 6 months ago
I was able to get it working with the below, but it would be awesome if the plugin added a flat config.
import i18nJsonPlugin from 'eslint-plugin-i18n-json';
export default {
files: ['**/*.json'],
plugins: { 'i18n-json': i18nJsonPlugin },
processor: {
meta: { name: '.json' },
...i18nJsonPlugin.processors['.json'],
},
rules: {
...i18nJsonPlugin.configs.recommended.rules,
'i18n-json/valid-message-syntax': 'off',
},
};
@glitch452, thanks for sharing! It's working for me as well in an NX monorepo library containing the translation files:
// libs/i18n/messages/eslint.config.js
const { resolve } = require('node:path');
const i18nJsonPlugin = require('eslint-plugin-i18n-json');
const baseConfig = require('../../../eslint.config.js');
module.exports = [
...baseConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {},
},
{
files: ['**/dictionaries/**/*.json'],
plugins: { 'i18n-json': i18nJsonPlugin },
processor: {
meta: { name: '.json' },
...i18nJsonPlugin.processors['.json'],
},
rules: {
...i18nJsonPlugin.configs.recommended.rules,
'i18n-json/identical-keys': [
'error',
{
filePath: resolve('./src/dictionaries/en.json'),
},
],
},
},
];
How to use this great plugin with the new flat config file format?