|
6 | 6 | > Fully extendable eslint plugin for JSON i18n translation files. |
7 | 7 |
|
8 | 8 | <p align="center"> |
9 | | -<img src="assets/logo-transparent.png" width="400"/> |
| 9 | + <img src="assets/logo-transparent.png" width="400" alt="logo"/> |
10 | 10 | </p> |
11 | 11 |
|
12 | 12 | 🎉 [**Check out the introductory blog post!**](https://godaddy.github.io/2018/04/02/introducing-eslint-plugin-i18n-json/) |
|
16 | 16 | - [Features](#features-) |
17 | 17 | - [Getting started](#getting-started) |
18 | 18 | - [Examples](#examples) |
19 | | -- [Configuring your .eslintrc file](#configuring-your-eslintrc-file) |
| 19 | +- [Configuring your .eslintrc file (ESLint version `< 9.0.0`)](#configuring-your-eslintrc-file-eslint-version--900) |
| 20 | +- [EsLint version `>= 9.0.0`](#eslint-version--900) |
20 | 21 | - [Rules](#rules) |
21 | 22 | - [i18n-json/valid-json](#i18n-jsonvalid-json) |
22 | 23 | - [i18n-json/valid-message-syntax](#i18n-jsonvalid-message-syntax) |
@@ -106,7 +107,7 @@ simple |
106 | 107 |
|
107 | 108 | **In this project directory, do the following:** |
108 | 109 | 1) >npm install --save-dev eslint-plugin-i18n-json |
109 | | -2) Create a `.eslintrc.js` file in the root dir of your project. For this example: `/simple/.eslintrc.js`. |
| 110 | +2) If you are using eslint `< 9.0.0` Create a `.eslintrc.js` file in the root dir of your project. For this example: `/simple/.eslintrc.js`. |
110 | 111 | 3) paste in the following: |
111 | 112 | ```javascript |
112 | 113 | module.exports = { |
@@ -138,7 +139,7 @@ simple |
138 | 139 |
|
139 | 140 |  |
140 | 141 |
|
141 | | -## Configuring your .eslintrc file |
| 142 | +## Configuring your .eslintrc file (ESLint version `< 9.0.0`) |
142 | 143 | - Simply update your `.eslintrc.*` with overrides for the individual rules. |
143 | 144 | - Eslint severities: 2 = error, 1 = warning, 0 = off |
144 | 145 | - Example of the module's default rule configuration: |
@@ -177,6 +178,29 @@ simple |
177 | 178 | }, |
178 | 179 | }; |
179 | 180 | ``` |
| 181 | + |
| 182 | +## ESLint version `>= 9.0.0` |
| 183 | +
|
| 184 | +- ESLint version `>= 9.0.0` uses flat configuration |
| 185 | +
|
| 186 | +```javascript |
| 187 | +// eslint.config.(m)js |
| 188 | +import i18nJsonPlugin from 'eslint-plugin-i18n-json'; |
| 189 | +
|
| 190 | +export default { |
| 191 | + files: ['**/*.json'], |
| 192 | + plugins: { 'i18n-json': i18nJsonPlugin }, |
| 193 | + processor: { |
| 194 | + meta: { name: '.json' }, |
| 195 | + ...i18nJsonPlugin.processors['.json'], |
| 196 | + }, |
| 197 | + rules: { |
| 198 | + ...i18nJsonPlugin.configs.recommended.rules, |
| 199 | + 'i18n-json/valid-message-syntax': 'off', |
| 200 | + }, |
| 201 | +}; |
| 202 | +
|
| 203 | +``` |
180 | 204 |
|
181 | 205 | ## Rules |
182 | 206 |
|
|
0 commit comments