Skip to content

Commit 1dd27ea

Browse files
committed
fix: maintain previous order of plugins in final configuration
1 parent 45e6945 commit 1dd27ea

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

node.factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ function createNodeConfig(bFlatConfig) {
142142
},
143143
},
144144
plugins: {
145-
prettier: pluginPrettier,
146145
import: pluginImport,
146+
prettier: pluginPrettier,
147147
},
148148
...baseConfigOptions,
149149
},

react-native.factory.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ const OFF = 0;
44
const WARNING = 1;
55
const ERROR = 2;
66

7-
const commonReactNativePluginsConfig = {
8-
rules: {
9-
'@react-native/platform-colors': WARNING,
10-
'react-native/no-unused-styles': ERROR,
11-
'react-native/split-platform-components': OFF,
12-
'react-native/no-inline-styles': WARNING,
13-
'react-native/no-color-literals': WARNING,
14-
'react-native/no-raw-text': ERROR,
15-
'react-native-a11y/has-accessibility-hint': OFF,
16-
},
7+
const commonAtReactNativePluginRules = {
8+
'@react-native/platform-colors': WARNING,
9+
},
10+
commonReactNativePluginRules = {
11+
'react-native/no-unused-styles': ERROR,
12+
'react-native/split-platform-components': OFF,
13+
'react-native/no-inline-styles': WARNING,
14+
'react-native/no-color-literals': WARNING,
15+
'react-native/no-raw-text': ERROR,
16+
'react-native-a11y/has-accessibility-hint': OFF,
1717
},
1818
jsFilesCommonSettings = {
1919
'import/extensions': extensions.ALL,
@@ -63,6 +63,10 @@ function createRNConfig(bFlatConfig) {
6363
parserOptions: pluginA11y.configs.all.parserOptions,
6464
},
6565
},
66+
{
67+
plugins: { '@react-native': rnPluginEslint },
68+
rules: commonAtReactNativePluginRules,
69+
},
6670
{
6771
languageOptions: {
6872
// below globals listed manually - as in https://github.com/Intellicode/eslint-plugin-react-native/blob/master/index.js
@@ -73,9 +77,8 @@ function createRNConfig(bFlatConfig) {
7377
},
7478
plugins: {
7579
'react-native': fixupPluginRules(eslintPluginReactNative),
76-
'@react-native': rnPluginEslint,
7780
},
78-
...commonReactNativePluginsConfig,
81+
rules: commonReactNativePluginRules,
7982
},
8083
// below two objects: ported 'overrides' from the above object
8184
{
@@ -94,7 +97,10 @@ function createRNConfig(bFlatConfig) {
9497
'react-native/react-native': true,
9598
},
9699
plugins: ['react-native', '@react-native'],
97-
...commonReactNativePluginsConfig,
100+
rules: {
101+
...commonAtReactNativePluginRules,
102+
...commonReactNativePluginRules,
103+
},
98104
overrides: [
99105
{
100106
files: ['*.js', '*.jsx'],

react.factory.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ function createReactConfig(bFlatConfig) {
3434

3535
return [
3636
...nodeConfig,
37+
{
38+
plugins: {
39+
'react-hooks': fixupPluginRules(reactHooksPlugin),
40+
},
41+
},
3742
reactPlugin.configs.flat.recommended,
3843
{
3944
languageOptions: {
@@ -42,7 +47,6 @@ function createReactConfig(bFlatConfig) {
4247
},
4348
plugins: {
4449
react: reactPlugin,
45-
'react-hooks': fixupPluginRules(reactHooksPlugin),
4650
},
4751
...commonConfig,
4852
},

0 commit comments

Comments
 (0)