eslint-config-agent 1.4.1 → 1.4.2
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/configs/config-files.js +22 -0
- package/configs/test-files.js +18 -0
- package/index.js +21 -30
- package/package.json +2 -2
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.4.2](https://github.com/tupe12334/eslint-config/compare/v1.4.1...v1.4.2) (2025-09-27)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add configuration for handling hardcoded values and default exports in config files ([0673c64](https://github.com/tupe12334/eslint-config/commit/0673c64d4e021eb5cd206a37b35b1509f007f57b))
|
|
12
|
+
|
|
7
13
|
## [1.4.1](https://github.com/tupe12334/eslint-config/compare/v1.3.9...v1.4.1) (2025-09-27)
|
|
8
14
|
|
|
9
15
|
### Features
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for configuration files
|
|
3
|
+
* Allows hardcoded values and default exports in config files
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const configFilesConfig = [
|
|
7
|
+
// Configuration files - allow hardcoded values for configuration purposes
|
|
8
|
+
{
|
|
9
|
+
files: [
|
|
10
|
+
"*.config.{js,ts}",
|
|
11
|
+
"eslint.config.{js,ts}",
|
|
12
|
+
"index.js",
|
|
13
|
+
"**/configs/**/*.{js,ts}",
|
|
14
|
+
],
|
|
15
|
+
rules: {
|
|
16
|
+
"default/no-localhost": "off",
|
|
17
|
+
"default/no-hardcoded-urls": "off",
|
|
18
|
+
"default/no-default-params": "off", // Allow default parameters in config files
|
|
19
|
+
"import/no-default-export": "off", // Allow default exports in config files
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
package/configs/test-files.js
CHANGED
|
@@ -119,6 +119,9 @@ export const testFilesConfig = [
|
|
|
119
119
|
rules: {
|
|
120
120
|
"max-lines-per-function": "off",
|
|
121
121
|
"max-lines": "off", // Ignore file length limits in test and spec files
|
|
122
|
+
"default/no-localhost": ["error", { allowInTests: true }],
|
|
123
|
+
"default/no-hardcoded-urls": ["error", { allowInTests: true }],
|
|
124
|
+
"default/no-default-params": "off", // Allow default parameters in test files for demonstration purposes
|
|
122
125
|
// Allow multiple exports in test files for testing import/export patterns
|
|
123
126
|
"no-restricted-syntax": [
|
|
124
127
|
"warn",
|
|
@@ -170,6 +173,9 @@ export const testFilesConfig = [
|
|
|
170
173
|
],
|
|
171
174
|
rules: {
|
|
172
175
|
"max-lines-per-function": "off",
|
|
176
|
+
"default/no-localhost": ["error", { allowInTests: true }],
|
|
177
|
+
"default/no-hardcoded-urls": ["error", { allowInTests: true }],
|
|
178
|
+
"default/no-default-params": "off", // Allow default parameters in test files for demonstration purposes
|
|
173
179
|
"no-restricted-syntax": [
|
|
174
180
|
"warn", // Base level for most rules
|
|
175
181
|
...sharedRestrictedSyntax.filter(
|
|
@@ -198,4 +204,16 @@ export const testFilesConfig = [
|
|
|
198
204
|
"max-lines-per-function": "off",
|
|
199
205
|
},
|
|
200
206
|
},
|
|
207
|
+
|
|
208
|
+
// Export test files - allow hardcoded URLs for testing but keep strict export rules
|
|
209
|
+
{
|
|
210
|
+
files: [
|
|
211
|
+
"**/test/export/**/*.{js,ts,tsx,jsx}",
|
|
212
|
+
],
|
|
213
|
+
rules: {
|
|
214
|
+
"default/no-localhost": ["error", { allowInTests: true }],
|
|
215
|
+
"default/no-hardcoded-urls": ["error", { allowInTests: true }],
|
|
216
|
+
"default/no-default-params": "off", // Allow default parameters in test files for demonstration purposes
|
|
217
|
+
},
|
|
218
|
+
},
|
|
201
219
|
];
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { noRecordLiteralTypesConfigs } from "./rules/no-record-literal-types/ind
|
|
|
7
7
|
import { plugins } from "./plugins/index.js";
|
|
8
8
|
import { testFilesConfig } from "./configs/test-files.js";
|
|
9
9
|
import { storybookConfig } from "./configs/storybook.js";
|
|
10
|
+
import { configFilesConfig } from "./configs/config-files.js";
|
|
10
11
|
|
|
11
12
|
// Shared rules for both JS and TS files
|
|
12
13
|
const sharedRules = {
|
|
@@ -133,15 +134,7 @@ const config = [
|
|
|
133
134
|
},
|
|
134
135
|
},
|
|
135
136
|
// Default plugin strict config
|
|
136
|
-
|
|
137
|
-
plugins: {
|
|
138
|
-
default: plugins.default,
|
|
139
|
-
},
|
|
140
|
-
rules: {
|
|
141
|
-
"default/no-localhost": ["error", { allowInTests: true }],
|
|
142
|
-
"default/no-hardcoded-urls": ["error", { allowInTests: true }],
|
|
143
|
-
},
|
|
144
|
-
},
|
|
137
|
+
plugins.default.configs.strict,
|
|
145
138
|
|
|
146
139
|
// TypeScript and TSX files
|
|
147
140
|
{
|
|
@@ -289,14 +282,21 @@ const config = [
|
|
|
289
282
|
message:
|
|
290
283
|
"Cannot have both type alias export and type-only export in the same TSX file.",
|
|
291
284
|
},
|
|
292
|
-
...tsOnlyRestrictedSyntax.filter(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
285
|
+
...tsOnlyRestrictedSyntax.filter((rule) => {
|
|
286
|
+
const switchCaseFunctionSelectors =
|
|
287
|
+
allRules.switchCaseFunctionsReturnTypeConfigs.map(
|
|
288
|
+
(r) => r.selector
|
|
289
|
+
);
|
|
290
|
+
const switchStatementFunctionSelectors =
|
|
291
|
+
allRules.switchStatementsReturnTypeConfigs.map((r) => r.selector);
|
|
292
|
+
const switchCaseExplicitReturnSelectors =
|
|
293
|
+
allRules.switchCaseExplicitReturnConfigs.map((r) => r.selector);
|
|
294
|
+
return ![
|
|
295
|
+
...switchCaseFunctionSelectors,
|
|
296
|
+
...switchStatementFunctionSelectors,
|
|
297
|
+
...switchCaseExplicitReturnSelectors,
|
|
298
|
+
].includes(rule.selector);
|
|
299
|
+
}),
|
|
300
300
|
],
|
|
301
301
|
},
|
|
302
302
|
},
|
|
@@ -533,6 +533,9 @@ const config = [
|
|
|
533
533
|
// Test and spec files configuration (imported from separate config)
|
|
534
534
|
...testFilesConfig,
|
|
535
535
|
|
|
536
|
+
// Configuration files (imported from separate config)
|
|
537
|
+
...configFilesConfig,
|
|
538
|
+
|
|
536
539
|
// Index files configuration - allow specific export patterns
|
|
537
540
|
{
|
|
538
541
|
files: [
|
|
@@ -639,19 +642,6 @@ const config = [
|
|
|
639
642
|
},
|
|
640
643
|
|
|
641
644
|
|
|
642
|
-
// Allow default exports in configuration files (must be last to override)
|
|
643
|
-
{
|
|
644
|
-
files: [
|
|
645
|
-
"*.config.js",
|
|
646
|
-
"*.config.ts",
|
|
647
|
-
"eslint.config.js",
|
|
648
|
-
"eslint.config.ts",
|
|
649
|
-
],
|
|
650
|
-
rules: {
|
|
651
|
-
"import/no-default-export": "off",
|
|
652
|
-
},
|
|
653
|
-
},
|
|
654
|
-
|
|
655
645
|
// Storybook files configuration
|
|
656
646
|
storybookConfig,
|
|
657
647
|
|
|
@@ -676,6 +666,7 @@ const config = [
|
|
|
676
666
|
],
|
|
677
667
|
},
|
|
678
668
|
},
|
|
669
|
+
|
|
679
670
|
];
|
|
680
671
|
|
|
681
672
|
export default config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-agent",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "ESLint configuration package with TypeScript support",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"typescript-eslint": "^8.40.0"
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"eslint-plugin-default": "^1.0
|
|
116
|
+
"eslint-plugin-default": "^1.1.0",
|
|
117
117
|
"eslint-plugin-error": "^1.1.3",
|
|
118
118
|
"eslint-plugin-no-optional-chaining": "^1.0.0"
|
|
119
119
|
}
|