Skip to content

Commit d53f664

Browse files
committed
Updating commented eslint flags, updating readme with more detailed instructions for flat config files
1 parent 72f40f0 commit d53f664

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

packages/eslint-config-react-native/README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
[![Version][version-badge]][package]
44

5+
## About
6+
This plugin exports a recommended eslint config for React Native projects
7+
58
## Installation
69

710
```
@@ -12,13 +15,40 @@ yarn add --dev eslint prettier @react-native/eslint-config
1215

1316
## Usage
1417

15-
Add to your eslint config (`.eslintrc`, or `eslintConfig` field in `package.json`):
18+
From [`v8.23.0`](https://github.com/eslint/eslint/releases/tag/v8.23.0) onwards, you can use `eslint.config.js` which uses the new [flat config file format](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new).
19+
20+
```javascript
21+
const reactNativeConfig = require('@react-native/eslint-config');
22+
const myplugin = require('my-plugin');
23+
24+
module.exports = [
25+
...reactNativeConfig,
26+
{
27+
plugins: {
28+
myplugin
29+
},
30+
...
31+
},
32+
];
33+
```
34+
35+
If you're still using a version of eslint < `v8.23.0` or still using the old configuration files, place the following on your eslint config file (`.eslintrc`, or `eslintConfig` field in `package.json`):
1636

1737
```json
1838
{
1939
"extends": "@react-native"
2040
}
2141
```
2242

43+
## Plugin supported Eslint versions
44+
45+
| Eslint version | `.eslintrc` support | `eslint.config.js` support |
46+
| :------------------- | :-----------------: | :------------------------: |
47+
| `>= 9.0.0` |||
48+
| `>= 8.23.0 < 9.0.0` |||
49+
| `< 8.23.0` |||
50+
51+
52+
2353
[version-badge]: https://img.shields.io/npm/v/@react-native/eslint-config.svg?style=flat-square
2454
[package]: https://www.npmjs.com/package/@react-native/eslint-config

packages/eslint-config-react-native/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ const reactHooks = require('eslint-plugin-react-hooks');
1313
const reactNative = require('eslint-plugin-react-native');
1414
const reactNativeCommunity = require('@react-native/eslint-plugin');
1515
const jest = require('eslint-plugin-jest');
16-
const ftFlow = require('eslint-plugin-ft-flow');
1716
const babelParser = require('@babel/eslint-parser');
1817
const prettier = require('eslint-config-prettier');
1918
const typescriptParser = require('@typescript-eslint/parser');
2019
const typescriptPlugin = require('@typescript-eslint/eslint-plugin');
20+
const ftFlow = require('eslint-plugin-ft-flow');
2121

2222
module.exports = [
2323
prettier,
@@ -91,7 +91,7 @@ module.exports = [
9191
ecmaFeatures: {
9292
jsx: true,
9393
},
94-
},
94+
},
9595
globals: {
9696
__DEV__: true,
9797
__dirname: false,
@@ -336,7 +336,7 @@ module.exports = [
336336
// React-Native Plugin
337337
// The following rules are made available via `eslint-plugin-react-native`
338338

339-
// 'react-native/no-inline-styles': 1,
339+
'react-native/no-inline-styles': 1,
340340

341341
// Jest Plugin
342342
// The following rules are made available via `eslint-plugin-jest`.

packages/eslint-plugin-react-native/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,22 @@ yarn add --dev eslint @react-native/eslint-plugin
1212

1313
## Usage
1414

15-
Add to your eslint config (`.eslintrc`, or `eslintConfig` field in `package.json`):
15+
From [`v8.23.0`](https://github.com/eslint/eslint/releases/tag/v8.23.0) onwards, you can use `eslint.config.js` which uses the new [flat config file format](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new).
16+
17+
```javascript
18+
const reactNative = require('@react-native/eslint-plugin');
19+
20+
module.exports = [
21+
{
22+
plugins: {
23+
reactNative
24+
},
25+
...
26+
},
27+
];
28+
```
29+
30+
If you're still using a version of eslint < `v8.23.0` or still using the old configuration files, place the following on your eslint config file (`.eslintrc`, or `eslintConfig` field in `package.json`):
1631

1732
```json
1833
{

0 commit comments

Comments
 (0)