eslint-config-agent 1.3.2 → 1.3.3
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 +6 -0
- package/index.js +56 -30
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. See [Conven
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [1.3.3](https://github.com/tupe12334/eslint-config/compare/v1.3.2...v1.3.3) (2025-09-20)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add required-exports plugin and update configuration rules ([b6a6b22](https://github.com/tupe12334/eslint-config/commit/b6a6b223b70f8140458f065e0801d8336465911b))
|
|
12
|
+
|
|
7
13
|
## [1.3.2](https://github.com/tupe12334/eslint-config/compare/v1.3.1...v1.3.2) (2025-09-20)
|
|
8
14
|
|
|
9
15
|
## [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,
|
|
@@ -256,11 +243,19 @@ const config = [
|
|
|
256
243
|
"no-undef": "off", // TypeScript handles this
|
|
257
244
|
"custom/no-default-class-export": "error",
|
|
258
245
|
"single-export/single-export": "error",
|
|
246
|
+
"required-exports/required-exports": ["error", {
|
|
247
|
+
"variable": false, // Don't require exporting variables/constants
|
|
248
|
+
"function": false, // Don't require exporting functions
|
|
249
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
250
|
+
"interface": false, // Don't require exporting interfaces
|
|
251
|
+
"type": false, // Don't require exporting types
|
|
252
|
+
"enum": true, // Require exporting enums (matches old behavior)
|
|
253
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
254
|
+
}],
|
|
259
255
|
"no-restricted-syntax": [
|
|
260
256
|
"error",
|
|
261
257
|
...sharedRestrictedSyntax,
|
|
262
258
|
...tsOnlyRestrictedSyntax,
|
|
263
|
-
...requiredExportRules,
|
|
264
259
|
],
|
|
265
260
|
},
|
|
266
261
|
},
|
|
@@ -273,6 +268,15 @@ const config = [
|
|
|
273
268
|
// Include all shared rules (like max-lines-per-function)
|
|
274
269
|
...sharedRules,
|
|
275
270
|
"single-export/single-export": "off", // TSX files have their own specific export rules
|
|
271
|
+
"required-exports/required-exports": ["error", {
|
|
272
|
+
"variable": false, // Don't require exporting variables/constants
|
|
273
|
+
"function": false, // Don't require exporting functions
|
|
274
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
275
|
+
"interface": false, // Don't require exporting interfaces
|
|
276
|
+
"type": false, // Don't require exporting types
|
|
277
|
+
"enum": true, // Require exporting enums (matches old behavior)
|
|
278
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
279
|
+
}],
|
|
276
280
|
"no-restricted-syntax": [
|
|
277
281
|
"error",
|
|
278
282
|
// Switch case rules as errors
|
|
@@ -417,8 +421,6 @@ const config = [
|
|
|
417
421
|
rule.selector !==
|
|
418
422
|
"FunctionExpression:has(SwitchStatement):not([returnType])"
|
|
419
423
|
),
|
|
420
|
-
// Required export rules - these will be warnings in TSX since we can't mix severities
|
|
421
|
-
...requiredExportRules,
|
|
422
424
|
],
|
|
423
425
|
},
|
|
424
426
|
},
|
|
@@ -467,16 +469,18 @@ const config = [
|
|
|
467
469
|
rules: {
|
|
468
470
|
...sharedRules,
|
|
469
471
|
"single-export/single-export": "error",
|
|
472
|
+
"required-exports/required-exports": ["error", {
|
|
473
|
+
"variable": false, // Don't require exporting variables/constants
|
|
474
|
+
"function": false, // Don't require exporting functions
|
|
475
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
476
|
+
"interface": false, // Don't require exporting interfaces (N/A for JS)
|
|
477
|
+
"type": false, // Don't require exporting types (N/A for JS)
|
|
478
|
+
"enum": false, // Don't require exporting enums (N/A for JS)
|
|
479
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
480
|
+
}],
|
|
470
481
|
"no-restricted-syntax": [
|
|
471
482
|
"error",
|
|
472
483
|
...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
484
|
],
|
|
481
485
|
},
|
|
482
486
|
},
|
|
@@ -538,6 +542,15 @@ const config = [
|
|
|
538
542
|
...sharedRules,
|
|
539
543
|
"no-undef": "off", // TypeScript handles this
|
|
540
544
|
"single-export/single-export": "off", // JSX files have their own specific export rules
|
|
545
|
+
"required-exports/required-exports": ["error", {
|
|
546
|
+
"variable": false, // Don't require exporting variables/constants
|
|
547
|
+
"function": false, // Don't require exporting functions
|
|
548
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
549
|
+
"interface": false, // Don't require exporting interfaces (N/A for JSX)
|
|
550
|
+
"type": false, // Don't require exporting types (N/A for JSX)
|
|
551
|
+
"enum": false, // Don't require exporting enums (N/A for JSX)
|
|
552
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
553
|
+
}],
|
|
541
554
|
"no-restricted-syntax": [
|
|
542
555
|
"error",
|
|
543
556
|
// Switch case rules as errors
|
|
@@ -658,6 +671,15 @@ const config = [
|
|
|
658
671
|
rules: {
|
|
659
672
|
"no-undef": "off", // TypeScript handles this
|
|
660
673
|
"single-export/single-export": "off", // JSX files have their own specific export rules
|
|
674
|
+
"required-exports/required-exports": ["warn", {
|
|
675
|
+
"variable": false, // Don't require exporting variables/constants
|
|
676
|
+
"function": false, // Don't require exporting functions
|
|
677
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
678
|
+
"interface": false, // Don't require exporting interfaces (N/A for JSX)
|
|
679
|
+
"type": false, // Don't require exporting types (N/A for JSX)
|
|
680
|
+
"enum": false, // Don't require exporting enums (N/A for JSX)
|
|
681
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
682
|
+
}],
|
|
661
683
|
"no-restricted-syntax": [
|
|
662
684
|
"warn",
|
|
663
685
|
// Include shared rules but remove the multiple exports restriction and switch case rules for JSX
|
|
@@ -780,8 +802,6 @@ const config = [
|
|
|
780
802
|
"ExportNamedDeclaration:not([source]):not(:has(VariableDeclaration)):not(:has(FunctionDeclaration)):not(:has(ClassDeclaration)):not(:has(TSInterfaceDeclaration)):not(:has(TSTypeAliasDeclaration)):not(:has(TSEnumDeclaration))"
|
|
781
803
|
),
|
|
782
804
|
...tsOnlyRestrictedSyntax,
|
|
783
|
-
// For TSX files, also include required export rules as warnings since we can't mix severities
|
|
784
|
-
...requiredExportRules,
|
|
785
805
|
],
|
|
786
806
|
},
|
|
787
807
|
},
|
|
@@ -825,6 +845,15 @@ const config = [
|
|
|
825
845
|
"**/rules/**/index.js",
|
|
826
846
|
],
|
|
827
847
|
rules: {
|
|
848
|
+
"required-exports/required-exports": ["error", {
|
|
849
|
+
"variable": false, // Don't require exporting variables/constants
|
|
850
|
+
"function": false, // Don't require exporting functions
|
|
851
|
+
"class": true, // Require exporting classes (matches old behavior)
|
|
852
|
+
"interface": false, // Don't require exporting interfaces
|
|
853
|
+
"type": false, // Don't require exporting types
|
|
854
|
+
"enum": true, // Require exporting enums (matches old behavior)
|
|
855
|
+
"ignorePrivate": true // Ignore declarations starting with _
|
|
856
|
+
}],
|
|
828
857
|
"no-restricted-syntax": [
|
|
829
858
|
"error",
|
|
830
859
|
// Switch case rules as errors
|
|
@@ -908,9 +937,6 @@ const config = [
|
|
|
908
937
|
allRules.noClassPropertyDefaultsConfig,
|
|
909
938
|
allRules.noProcessEnvPropertiesConfig,
|
|
910
939
|
allRules.noExportSpecifiersConfig,
|
|
911
|
-
// Export restriction rules
|
|
912
|
-
// Required export rules
|
|
913
|
-
...requiredExportRules,
|
|
914
940
|
],
|
|
915
941
|
},
|
|
916
942
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-agent",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
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",
|