@bratislava/eslint-config-react 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +14 -36
  2. package/package.json +3 -9
package/index.js CHANGED
@@ -5,26 +5,14 @@
5
5
  * Extends base config with React-specific rules and plugins.
6
6
  */
7
7
 
8
- import {
9
- disabledRules,
10
- eslintRules,
11
- simpleImportSortConfig,
12
- sonarjsRules,
13
- typescriptRules,
14
- } from "@bratislava/eslint-config";
15
- import eslint from "@eslint/js";
8
+ import { baseConfig } from "@bratislava/eslint-config";
16
9
  import tanstackQuery from "@tanstack/eslint-plugin-query";
17
- import prettier from "eslint-config-prettier";
18
10
  import importPlugin from "eslint-plugin-import";
19
11
  import jsxA11y from "eslint-plugin-jsx-a11y";
20
- import noUnsanitized from "eslint-plugin-no-unsanitized";
21
12
  import react from "eslint-plugin-react";
22
13
  import reactHooks from "eslint-plugin-react-hooks";
23
- import security from "eslint-plugin-security";
24
- import sonarjs from "eslint-plugin-sonarjs";
25
14
  import tailwindcss from "eslint-plugin-tailwindcss";
26
15
  import globals from "globals";
27
- import tseslint from "typescript-eslint";
28
16
 
29
17
  /**
30
18
  * React-specific rules
@@ -84,6 +72,7 @@ const frontendRules = {
84
72
  { checksVoidReturn: { attributes: false } },
85
73
  ],
86
74
  "@typescript-eslint/no-floating-promises": "warn",
75
+ "@typescript-eslint/no-confusing-void-expression": "off",
87
76
  };
88
77
 
89
78
  /**
@@ -104,24 +93,21 @@ const frontendRules = {
104
93
  export function createReactConfig(options = {}) {
105
94
  const { ignores = [] } = options;
106
95
 
107
- return tseslint.config(
108
- // Base configs
109
- eslint.configs.recommended,
110
- tseslint.configs.strictTypeChecked,
111
- tseslint.configs.stylistic,
112
- prettier,
113
- simpleImportSortConfig,
114
- security.configs.recommended,
115
- noUnsanitized.configs.recommended,
116
- sonarjs.configs.recommended,
117
- tanstackQuery.configs["flat/recommended"],
96
+ return [
97
+ // Base configuration (eslint, typescript, prettier, security, sonarjs, etc.)
98
+ ...baseConfig,
99
+
100
+ // React-specific configs
101
+ ...tanstackQuery.configs["flat/recommended"],
118
102
  ...tailwindcss.configs["flat/recommended"],
119
103
 
104
+ // React hooks recommended config (includes plugin and rules)
105
+ reactHooks.configs.flat.recommended,
106
+
120
107
  // React and related plugins
121
108
  {
122
109
  plugins: {
123
110
  react,
124
- "react-hooks": reactHooks,
125
111
  import: importPlugin,
126
112
  "jsx-a11y": jsxA11y,
127
113
  },
@@ -132,18 +118,16 @@ export function createReactConfig(options = {}) {
132
118
  },
133
119
  },
134
120
 
135
- // Language options
121
+ // Language options (extend base with browser globals and JSX)
136
122
  {
137
123
  languageOptions: {
138
124
  parserOptions: {
139
- projectService: true,
140
125
  ecmaFeatures: {
141
126
  jsx: true,
142
127
  },
143
128
  },
144
129
  globals: {
145
130
  ...globals.browser,
146
- ...globals.es2021,
147
131
  },
148
132
  },
149
133
  },
@@ -157,16 +141,10 @@ export function createReactConfig(options = {}) {
157
141
  },
158
142
  },
159
143
 
160
- // Main rules
144
+ // Frontend-specific rules
161
145
  {
162
146
  rules: {
163
- ...typescriptRules,
164
- ...eslintRules,
165
- ...sonarjsRules,
166
- ...disabledRules,
167
147
  ...frontendRules,
168
-
169
- // SonarJS additional config for frontend
170
148
  "sonarjs/different-types-comparison": "off",
171
149
  },
172
150
  },
@@ -187,7 +165,7 @@ export function createReactConfig(options = {}) {
187
165
  ...ignores,
188
166
  ],
189
167
  },
190
- );
168
+ ];
191
169
  }
192
170
 
193
171
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bratislava/eslint-config-react",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "ESLint configuration for React projects (without Next.js)",
5
5
  "keywords": [
6
6
  "eslint",
@@ -29,20 +29,14 @@
29
29
  "typescript": ">= 5"
30
30
  },
31
31
  "dependencies": {
32
- "@bratislava/eslint-config": "0.4.0",
33
- "@eslint/js": "9.34.0",
32
+ "@bratislava/eslint-config": "0.5.1",
34
33
  "@tanstack/eslint-plugin-query": "5.91.2",
35
- "eslint-config-prettier": "10.1.8",
36
34
  "eslint-plugin-import": "2.32.0",
37
35
  "eslint-plugin-jsx-a11y": "6.10.2",
38
- "eslint-plugin-no-unsanitized": "4.1.4",
39
36
  "eslint-plugin-react": "7.37.5",
40
37
  "eslint-plugin-react-hooks": "5.2.0",
41
- "eslint-plugin-security": "3.0.1",
42
- "eslint-plugin-sonarjs": "3.0.5",
43
38
  "eslint-plugin-tailwindcss": "3.18.2",
44
- "globals": "16.5.0",
45
- "typescript-eslint": "8.52.0"
39
+ "globals": "16.5.0"
46
40
  },
47
41
  "engines": {
48
42
  "node": ">=18"