eslint-config-agent 1.3.1 → 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.
Files changed (3) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/index.js +57 -35
  3. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ 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
+
13
+ ## [1.3.2](https://github.com/tupe12334/eslint-config/compare/v1.3.1...v1.3.2) (2025-09-20)
14
+
7
15
  ## [1.3.1](https://github.com/tupe12334/eslint-config/compare/v1.3.0...v1.3.1) (2025-09-20)
8
16
 
9
17
  ### Bug Fixes
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,7 +188,8 @@ const config = [
202
188
  n: nPlugin,
203
189
  "class-export": classExportPlugin,
204
190
  "single-export": singleExportPlugin,
205
- "custom": {
191
+ "required-exports": requiredExportsPlugin,
192
+ custom: {
206
193
  rules: {
207
194
  "no-default-class-export": noDefaultClassExportRule,
208
195
  },
@@ -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
@@ -355,8 +359,6 @@ const config = [
355
359
  // Include shared rules but remove the multiple exports restriction and switch case rules for TSX
356
360
  ...sharedRestrictedSyntax.filter(
357
361
  (rule) =>
358
- rule.selector !==
359
- "ExportNamedDeclaration[specifiers.length>1]:not([source])" &&
360
362
  rule.selector !==
361
363
  "Program:has(ExportNamedDeclaration:not([source]) ~ ExportNamedDeclaration:not([source]))" &&
362
364
  rule.selector !==
@@ -419,8 +421,6 @@ const config = [
419
421
  rule.selector !==
420
422
  "FunctionExpression:has(SwitchStatement):not([returnType])"
421
423
  ),
422
- // Required export rules - these will be warnings in TSX since we can't mix severities
423
- ...requiredExportRules,
424
424
  ],
425
425
  },
426
426
  },
@@ -469,16 +469,18 @@ const config = [
469
469
  rules: {
470
470
  ...sharedRules,
471
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
+ }],
472
481
  "no-restricted-syntax": [
473
482
  "error",
474
483
  ...sharedRestrictedSyntax,
475
- // Only class rules apply to JS files (no enums in JS)
476
- {
477
- selector:
478
- "ClassDeclaration:not(ExportNamedDeclaration > ClassDeclaration):not(ExportDefaultDeclaration > ClassDeclaration)",
479
- message:
480
- "Classes must be exported. Add 'export' before the class declaration.",
481
- },
482
484
  ],
483
485
  },
484
486
  },
@@ -540,6 +542,15 @@ const config = [
540
542
  ...sharedRules,
541
543
  "no-undef": "off", // TypeScript handles this
542
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
+ }],
543
554
  "no-restricted-syntax": [
544
555
  "error",
545
556
  // Switch case rules as errors
@@ -660,13 +671,20 @@ const config = [
660
671
  rules: {
661
672
  "no-undef": "off", // TypeScript handles this
662
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
+ }],
663
683
  "no-restricted-syntax": [
664
684
  "warn",
665
685
  // Include shared rules but remove the multiple exports restriction and switch case rules for JSX
666
686
  ...sharedRestrictedSyntax.filter(
667
687
  (rule) =>
668
- rule.selector !==
669
- "ExportNamedDeclaration[specifiers.length>1]:not([source])" &&
670
688
  rule.selector !==
671
689
  "Program:has(ExportNamedDeclaration:not([source]) ~ ExportNamedDeclaration:not([source]))" &&
672
690
  rule.selector !==
@@ -784,8 +802,6 @@ const config = [
784
802
  "ExportNamedDeclaration:not([source]):not(:has(VariableDeclaration)):not(:has(FunctionDeclaration)):not(:has(ClassDeclaration)):not(:has(TSInterfaceDeclaration)):not(:has(TSTypeAliasDeclaration)):not(:has(TSEnumDeclaration))"
785
803
  ),
786
804
  ...tsOnlyRestrictedSyntax,
787
- // For TSX files, also include required export rules as warnings since we can't mix severities
788
- ...requiredExportRules,
789
805
  ],
790
806
  },
791
807
  },
@@ -829,6 +845,15 @@ const config = [
829
845
  "**/rules/**/index.js",
830
846
  ],
831
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
+ }],
832
857
  "no-restricted-syntax": [
833
858
  "error",
834
859
  // Switch case rules as errors
@@ -912,9 +937,6 @@ const config = [
912
937
  allRules.noClassPropertyDefaultsConfig,
913
938
  allRules.noProcessEnvPropertiesConfig,
914
939
  allRules.noExportSpecifiersConfig,
915
- // Export restriction rules
916
- // Required export rules
917
- ...requiredExportRules,
918
940
  ],
919
941
  },
920
942
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-agent",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "ESLint configuration package with TypeScript support",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -99,8 +99,9 @@
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
- "eslint-plugin-single-export": "^1.1.1",
104
+ "eslint-plugin-single-export": "^1.1.2",
104
105
  "eslint-plugin-storybook": "^9.1.5",
105
106
  "globals": "^16.3.0",
106
107
  "release-it": "^19.0.4",