eslint-config-agent 1.3.2 → 1.3.4
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.
- package/CHANGELOG.md +12 -0
- package/index.js +58 -31
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. See [Conven
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [1.3.4](https://github.com/tupe12334/eslint-config/compare/v1.3.3...v1.3.4) (2025-09-20)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update reactHooks configuration to use recommended-latest if available ([bb5bf9d](https://github.com/tupe12334/eslint-config/commit/bb5bf9d8b9ef8110123fd4f8f23d35ee7af22e02))
|
|
12
|
+
|
|
13
|
+
## [1.3.3](https://github.com/tupe12334/eslint-config/compare/v1.3.2...v1.3.3) (2025-09-20)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add required-exports plugin and update configuration rules ([b6a6b22](https://github.com/tupe12334/eslint-config/commit/b6a6b223b70f8140458f065e0801d8336465911b))
|
|
18
|
+
|
|
7
19
|
## [1.3.2](https://github.com/tupe12334/eslint-config/compare/v1.3.1...v1.3.2) (2025-09-20)
|
|
8
20
|
|
|
9
21
|
## [1.3.1](https://github.com/tupe12334/eslint-config/compare/v1.3.0...v1.3.1) (2025-09-20)
|
package/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import securityPlugin from "eslint-plugin-security";
|
|
|
8
8
|
import nPlugin from "eslint-plugin-n";
|
|
9
9
|
import classExportPlugin from "eslint-plugin-class-export";
|
|
10
10
|
import singleExportPlugin from "eslint-plugin-single-export";
|
|
11
|
+
import requiredExportsPlugin from "eslint-plugin-required-exports";
|
|
11
12
|
import storybookPlugin from "eslint-plugin-storybook";
|
|
12
13
|
import globals from "globals";
|
|
13
14
|
import allRules from "./rules/index.js";
|
|
@@ -100,21 +101,6 @@ const sharedRestrictedSyntax = [
|
|
|
100
101
|
...allRules.noDefaultClassExportRules,
|
|
101
102
|
];
|
|
102
103
|
|
|
103
|
-
// Required export rules (always errors)
|
|
104
|
-
const requiredExportRules = [
|
|
105
|
-
{
|
|
106
|
-
selector:
|
|
107
|
-
"ClassDeclaration:not(ExportNamedDeclaration > ClassDeclaration):not(ExportDefaultDeclaration > ClassDeclaration)",
|
|
108
|
-
message:
|
|
109
|
-
"Classes must be exported. Use 'export class' or 'export default class'.",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
selector:
|
|
113
|
-
"TSEnumDeclaration:not(ExportNamedDeclaration > TSEnumDeclaration):not(ExportDefaultDeclaration > TSEnumDeclaration)",
|
|
114
|
-
message:
|
|
115
|
-
"Enums must be exported. Use 'export enum' or 'export default enum'.",
|
|
116
|
-
},
|
|
117
|
-
];
|
|
118
104
|
|
|
119
105
|
// TypeScript-specific no-restricted-syntax rules
|
|
120
106
|
const tsOnlyRestrictedSyntax = [
|
|
@@ -202,6 +188,7 @@ const config = [
|
|
|
202
188
|
n: nPlugin,
|
|
203
189
|
"class-export": classExportPlugin,
|
|
204
190
|
"single-export": singleExportPlugin,
|
|
191
|
+
"required-exports": requiredExportsPlugin,
|
|
205
192
|
custom: {
|
|
206
193
|
rules: {
|
|
207
194
|
"no-default-class-export": noDefaultClassExportRule,
|
|
@@ -209,7 +196,8 @@ const config = [
|
|
|
209
196
|
},
|
|
210
197
|
},
|
|
211
198
|
},
|
|
212
|
-
|
|
199
|
+
// Use recommended-latest if available (v5+), otherwise fall back to recommended
|
|
200
|
+
...(reactHooks.configs["recommended-latest"] ? [reactHooks.configs["recommended-latest"]] : [reactHooks.configs.recommended]),
|
|
213
201
|
js.configs.recommended,
|
|
214
202
|
|
|
215
203
|
// TypeScript and TSX files
|
|
@@ -256,11 +244,19 @@ const config = [
|
|
|
256
244
|
"no-undef": "off", // TypeScript handles this
|
|
257
245
|
"custom/no-default-class-export": "error",
|
|
258
246
|
"single-export/single-export": "error",
|
|
247
|
+
"required-exports/required-exports": ["error", {
|
|
248
|
+
"variable": false, // Don't require exporting variables/constants
|
|
249
|
+
"function": false, // Don't require exporting functions
|
|
250
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
251
|
+
"interface": false, // Don't require exporting interfaces
|
|
252
|
+
"type": false, // Don't require exporting types
|
|
253
|
+
"enum": true, // Require exporting enums (matches old behavior)
|
|
254
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
255
|
+
}],
|
|
259
256
|
"no-restricted-syntax": [
|
|
260
257
|
"error",
|
|
261
258
|
...sharedRestrictedSyntax,
|
|
262
259
|
...tsOnlyRestrictedSyntax,
|
|
263
|
-
...requiredExportRules,
|
|
264
260
|
],
|
|
265
261
|
},
|
|
266
262
|
},
|
|
@@ -273,6 +269,15 @@ const config = [
|
|
|
273
269
|
// Include all shared rules (like max-lines-per-function)
|
|
274
270
|
...sharedRules,
|
|
275
271
|
"single-export/single-export": "off", // TSX files have their own specific export rules
|
|
272
|
+
"required-exports/required-exports": ["error", {
|
|
273
|
+
"variable": false, // Don't require exporting variables/constants
|
|
274
|
+
"function": false, // Don't require exporting functions
|
|
275
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
276
|
+
"interface": false, // Don't require exporting interfaces
|
|
277
|
+
"type": false, // Don't require exporting types
|
|
278
|
+
"enum": true, // Require exporting enums (matches old behavior)
|
|
279
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
280
|
+
}],
|
|
276
281
|
"no-restricted-syntax": [
|
|
277
282
|
"error",
|
|
278
283
|
// Switch case rules as errors
|
|
@@ -417,8 +422,6 @@ const config = [
|
|
|
417
422
|
rule.selector !==
|
|
418
423
|
"FunctionExpression:has(SwitchStatement):not([returnType])"
|
|
419
424
|
),
|
|
420
|
-
// Required export rules - these will be warnings in TSX since we can't mix severities
|
|
421
|
-
...requiredExportRules,
|
|
422
425
|
],
|
|
423
426
|
},
|
|
424
427
|
},
|
|
@@ -467,16 +470,18 @@ const config = [
|
|
|
467
470
|
rules: {
|
|
468
471
|
...sharedRules,
|
|
469
472
|
"single-export/single-export": "error",
|
|
473
|
+
"required-exports/required-exports": ["error", {
|
|
474
|
+
"variable": false, // Don't require exporting variables/constants
|
|
475
|
+
"function": false, // Don't require exporting functions
|
|
476
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
477
|
+
"interface": false, // Don't require exporting interfaces (N/A for JS)
|
|
478
|
+
"type": false, // Don't require exporting types (N/A for JS)
|
|
479
|
+
"enum": false, // Don't require exporting enums (N/A for JS)
|
|
480
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
481
|
+
}],
|
|
470
482
|
"no-restricted-syntax": [
|
|
471
483
|
"error",
|
|
472
484
|
...sharedRestrictedSyntax,
|
|
473
|
-
// Only class rules apply to JS files (no enums in JS)
|
|
474
|
-
{
|
|
475
|
-
selector:
|
|
476
|
-
"ClassDeclaration:not(ExportNamedDeclaration > ClassDeclaration):not(ExportDefaultDeclaration > ClassDeclaration)",
|
|
477
|
-
message:
|
|
478
|
-
"Classes must be exported. Add 'export' before the class declaration.",
|
|
479
|
-
},
|
|
480
485
|
],
|
|
481
486
|
},
|
|
482
487
|
},
|
|
@@ -538,6 +543,15 @@ const config = [
|
|
|
538
543
|
...sharedRules,
|
|
539
544
|
"no-undef": "off", // TypeScript handles this
|
|
540
545
|
"single-export/single-export": "off", // JSX files have their own specific export rules
|
|
546
|
+
"required-exports/required-exports": ["error", {
|
|
547
|
+
"variable": false, // Don't require exporting variables/constants
|
|
548
|
+
"function": false, // Don't require exporting functions
|
|
549
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
550
|
+
"interface": false, // Don't require exporting interfaces (N/A for JSX)
|
|
551
|
+
"type": false, // Don't require exporting types (N/A for JSX)
|
|
552
|
+
"enum": false, // Don't require exporting enums (N/A for JSX)
|
|
553
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
554
|
+
}],
|
|
541
555
|
"no-restricted-syntax": [
|
|
542
556
|
"error",
|
|
543
557
|
// Switch case rules as errors
|
|
@@ -658,6 +672,15 @@ const config = [
|
|
|
658
672
|
rules: {
|
|
659
673
|
"no-undef": "off", // TypeScript handles this
|
|
660
674
|
"single-export/single-export": "off", // JSX files have their own specific export rules
|
|
675
|
+
"required-exports/required-exports": ["warn", {
|
|
676
|
+
"variable": false, // Don't require exporting variables/constants
|
|
677
|
+
"function": false, // Don't require exporting functions
|
|
678
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
679
|
+
"interface": false, // Don't require exporting interfaces (N/A for JSX)
|
|
680
|
+
"type": false, // Don't require exporting types (N/A for JSX)
|
|
681
|
+
"enum": false, // Don't require exporting enums (N/A for JSX)
|
|
682
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
683
|
+
}],
|
|
661
684
|
"no-restricted-syntax": [
|
|
662
685
|
"warn",
|
|
663
686
|
// Include shared rules but remove the multiple exports restriction and switch case rules for JSX
|
|
@@ -780,8 +803,6 @@ const config = [
|
|
|
780
803
|
"ExportNamedDeclaration:not([source]):not(:has(VariableDeclaration)):not(:has(FunctionDeclaration)):not(:has(ClassDeclaration)):not(:has(TSInterfaceDeclaration)):not(:has(TSTypeAliasDeclaration)):not(:has(TSEnumDeclaration))"
|
|
781
804
|
),
|
|
782
805
|
...tsOnlyRestrictedSyntax,
|
|
783
|
-
// For TSX files, also include required export rules as warnings since we can't mix severities
|
|
784
|
-
...requiredExportRules,
|
|
785
806
|
],
|
|
786
807
|
},
|
|
787
808
|
},
|
|
@@ -825,6 +846,15 @@ const config = [
|
|
|
825
846
|
"**/rules/**/index.js",
|
|
826
847
|
],
|
|
827
848
|
rules: {
|
|
849
|
+
"required-exports/required-exports": ["error", {
|
|
850
|
+
"variable": false, // Don't require exporting variables/constants
|
|
851
|
+
"function": false, // Don't require exporting functions
|
|
852
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
853
|
+
"interface": false, // Don't require exporting interfaces
|
|
854
|
+
"type": false, // Don't require exporting types
|
|
855
|
+
"enum": true, // Require exporting enums (matches old behavior)
|
|
856
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
857
|
+
}],
|
|
828
858
|
"no-restricted-syntax": [
|
|
829
859
|
"error",
|
|
830
860
|
// Switch case rules as errors
|
|
@@ -908,9 +938,6 @@ const config = [
|
|
|
908
938
|
allRules.noClassPropertyDefaultsConfig,
|
|
909
939
|
allRules.noProcessEnvPropertiesConfig,
|
|
910
940
|
allRules.noExportSpecifiersConfig,
|
|
911
|
-
// Export restriction rules
|
|
912
|
-
// Required export rules
|
|
913
|
-
...requiredExportRules,
|
|
914
941
|
],
|
|
915
942
|
},
|
|
916
943
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-agent",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "ESLint configuration package with TypeScript support",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"eslint-plugin-preact": "^0.1.0",
|
|
100
100
|
"eslint-plugin-react": "^7.37.5",
|
|
101
101
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
102
|
+
"eslint-plugin-required-exports": "^0.2.0",
|
|
102
103
|
"eslint-plugin-security": "^3.0.1",
|
|
103
104
|
"eslint-plugin-single-export": "^1.1.2",
|
|
104
105
|
"eslint-plugin-storybook": "^9.1.5",
|