eslint-config-agent 3.0.0 → 3.0.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 +17 -0
- package/configs/config-files.js +3 -0
- package/configs/examples.js +4 -0
- package/configs/test-files.js +20 -2
- package/index.js +17 -5
- package/package.json +24 -23
- package/plugins/index.js +2 -2
- package/rules/error-only-exports/index.js +6 -2
- package/rules/max-file-lines/index.js +0 -1
- package/rules/max-function-lines/index.js +0 -1
- package/rules/no-default-class-export/index.js +1 -1
- package/rules/no-inline-union-types/index.js +0 -1
- package/rules/no-process-env-properties/index.js +0 -1
- package/rules/no-record-literal-types/index.js +0 -1
- package/rules/no-trailing-spaces/index.js +0 -1
- package/rules/no-trivial-type-aliases/index.js +0 -1
- package/rules/no-type-assertions/index.js +0 -1
- package/rules/nullish-coalescing/index.js +0 -1
- package/rules/plugin/class-export/index.js +0 -1
- package/rules/plugin/n/no-process-env/index.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. See [Conven
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [3.0.2](https://github.com/tupe12334/eslint-config-agent/compare/v3.0.0...v3.0.2) (2026-04-26)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **jsdoc:** upgrade to recommended-typescript-error config ([2ecc02e](https://github.com/tupe12334/eslint-config-agent/commit/2ecc02e9031d42263c01f926a1adfed2424355b6))
|
|
12
|
+
* **plugins:** add eslint-plugin-jsdoc recommended config ([ff9fb97](https://github.com/tupe12334/eslint-config-agent/commit/ff9fb97dbaa88db3486b08904a31d9002bdec59d))
|
|
13
|
+
* **settings:** add additional WebFetch domains to permissions ([3a94e18](https://github.com/tupe12334/eslint-config-agent/commit/3a94e18b5128c6901b72e88218e12928d965dbc3))
|
|
14
|
+
* **settings:** add GitHub API permission to settings ([529c09d](https://github.com/tupe12334/eslint-config-agent/commit/529c09da004e2e369e3f639edbe6401d11f944b0))
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **ci:** publish to npm after workflow_dispatch releases ([4267e8a](https://github.com/tupe12334/eslint-config-agent/commit/4267e8a3be526c8700ca843c9c6f421e5a6608ea))
|
|
19
|
+
* **deps:** downgrade cspell to v9.8.0 for Node 20 compatibility ([ececdb2](https://github.com/tupe12334/eslint-config-agent/commit/ececdb297843f3317a431aa3075a148659e7659e))
|
|
20
|
+
* **jsdoc:** add missing parameters and fix tag formatting ([07bafcc](https://github.com/tupe12334/eslint-config-agent/commit/07bafcc6cb307e3646a29305ad70c848836ba766))
|
|
21
|
+
* **jsdoc:** escape inline [@typescript](https://github.com/typescript) tag in spec file comments ([f4918e5](https://github.com/tupe12334/eslint-config-agent/commit/f4918e5b3f9f3192884ddf99aa05328f98a4a5a6))
|
|
22
|
+
* **knip:** update configuration for knip v6 compatibility ([75967d6](https://github.com/tupe12334/eslint-config-agent/commit/75967d6a224910ca7c3f78b70e86e5d77074f3a8))
|
|
23
|
+
|
|
7
24
|
## 3.0.0 (2026-04-02)
|
|
8
25
|
|
|
9
26
|
* feat: add centy configuration and update claude agent/command definitions ([6f656c5](https://github.com/tupe12334/eslint-config-agent/commit/6f656c5))
|
package/configs/config-files.js
CHANGED
|
@@ -20,6 +20,9 @@ export const configFilesConfig = [
|
|
|
20
20
|
'max-lines-per-function': 'off', // Allow long functions in config files
|
|
21
21
|
'max-lines': 'off', // Allow long files in config files
|
|
22
22
|
'ddd/require-spec-file': 'off', // Config files don't need spec files
|
|
23
|
+
'jsdoc/require-jsdoc': 'off', // Config files don't need JSDoc
|
|
24
|
+
'jsdoc/require-param': 'off',
|
|
25
|
+
'jsdoc/require-returns': 'off',
|
|
23
26
|
},
|
|
24
27
|
},
|
|
25
28
|
]
|
package/configs/examples.js
CHANGED
|
@@ -83,6 +83,10 @@ export const examplesConfig = [
|
|
|
83
83
|
// Relax file/function length limits for concise examples
|
|
84
84
|
'max-lines-per-function': 'off',
|
|
85
85
|
'max-lines': 'off',
|
|
86
|
+
// Examples don't need JSDoc
|
|
87
|
+
'jsdoc/require-jsdoc': 'off',
|
|
88
|
+
'jsdoc/require-param': 'off',
|
|
89
|
+
'jsdoc/require-returns': 'off',
|
|
86
90
|
},
|
|
87
91
|
},
|
|
88
92
|
]
|
package/configs/test-files.js
CHANGED
|
@@ -24,8 +24,6 @@ const sharedRules = {
|
|
|
24
24
|
'no-continue': 'off',
|
|
25
25
|
// Additional built-in error handling rules
|
|
26
26
|
'prefer-promise-reject-errors': 'error',
|
|
27
|
-
// Optional chaining restriction
|
|
28
|
-
'no-optional-chaining/no-optional-chaining': 'error',
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
// Shared no-restricted-syntax rules for both JS and TS
|
|
@@ -202,6 +200,26 @@ export const testFilesConfig = [
|
|
|
202
200
|
'error/no-generic-error': 'off',
|
|
203
201
|
'error/require-custom-error': 'off',
|
|
204
202
|
'error/no-throw-literal': 'off',
|
|
203
|
+
// Disable JSDoc rules for non-test script files
|
|
204
|
+
'jsdoc/require-jsdoc': 'off',
|
|
205
|
+
'jsdoc/require-param': 'off',
|
|
206
|
+
'jsdoc/require-returns': 'off',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
// Disable JSDoc rules for test files
|
|
211
|
+
{
|
|
212
|
+
files: [
|
|
213
|
+
'**/*.test.{js,jsx,ts,tsx}',
|
|
214
|
+
'**/*.spec.{js,jsx,ts,tsx}',
|
|
215
|
+
'**/test/**/*.{js,jsx,ts,tsx}',
|
|
216
|
+
'**/tests/**/*.{js,jsx,ts,tsx}',
|
|
217
|
+
'**/__tests__/**/*.{js,jsx,ts,tsx}',
|
|
218
|
+
],
|
|
219
|
+
rules: {
|
|
220
|
+
'jsdoc/require-jsdoc': 'off',
|
|
221
|
+
'jsdoc/require-param': 'off',
|
|
222
|
+
'jsdoc/require-returns': 'off',
|
|
205
223
|
},
|
|
206
224
|
},
|
|
207
225
|
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import js from '@eslint/js'
|
|
|
2
2
|
import earlyReturn from 'eslint-plugin-early-return'
|
|
3
3
|
import switchCase from 'eslint-plugin-switch-case'
|
|
4
4
|
import jsxClassname from 'eslint-plugin-jsx-classname'
|
|
5
|
+
import jsdoc from 'eslint-plugin-jsdoc'
|
|
5
6
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
6
7
|
import { defineConfig } from 'eslint/config'
|
|
7
8
|
import tseslint from 'typescript-eslint'
|
|
@@ -41,8 +42,6 @@ const sharedRules = {
|
|
|
41
42
|
'no-continue': 'off',
|
|
42
43
|
// Additional built-in error handling rules
|
|
43
44
|
'prefer-promise-reject-errors': 'error',
|
|
44
|
-
// Optional chaining restriction
|
|
45
|
-
'no-optional-chaining/no-optional-chaining': 'error',
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
// Shared no-restricted-syntax rules for both JS and TS
|
|
@@ -98,15 +97,27 @@ const tsOnlyRestrictedSyntax = [
|
|
|
98
97
|
]
|
|
99
98
|
|
|
100
99
|
const config = defineConfig([
|
|
101
|
-
// Global ignores for non-JS/TS files
|
|
100
|
+
// Global ignores for non-JS/TS files and build outputs
|
|
102
101
|
{
|
|
103
|
-
ignores: [
|
|
102
|
+
ignores: [
|
|
103
|
+
'**/*.json',
|
|
104
|
+
'**/*.md',
|
|
105
|
+
'**/*.yaml',
|
|
106
|
+
'**/*.yml',
|
|
107
|
+
'dist/**',
|
|
108
|
+
'coverage/**',
|
|
109
|
+
],
|
|
104
110
|
},
|
|
105
111
|
// Global plugin definitions
|
|
106
112
|
{
|
|
107
113
|
plugins,
|
|
108
114
|
},
|
|
109
|
-
|
|
115
|
+
{
|
|
116
|
+
rules: {
|
|
117
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
118
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
110
121
|
js.configs.recommended,
|
|
111
122
|
...tseslint.configs.strictTypeChecked,
|
|
112
123
|
...tseslint.configs.stylisticTypeChecked,
|
|
@@ -123,6 +134,7 @@ const config = defineConfig([
|
|
|
123
134
|
...tseslint.configs.disableTypeChecked,
|
|
124
135
|
},
|
|
125
136
|
earlyReturn.configs.recommended,
|
|
137
|
+
jsdoc.configs['flat/recommended-typescript-error'],
|
|
126
138
|
{ plugins: { 'switch-case': switchCase }, ...switchCase.configs.recommended },
|
|
127
139
|
|
|
128
140
|
// Base plugin strict configs (error, default, guard-clauses)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-agent",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "ESLint configuration package with TypeScript support",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -73,16 +73,17 @@
|
|
|
73
73
|
},
|
|
74
74
|
"packageManager": "pnpm@10.18.2",
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@commitlint/cli": "^20.
|
|
77
|
-
"@commitlint/config-conventional": "^20.
|
|
76
|
+
"@commitlint/cli": "^20.5.2",
|
|
77
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
78
78
|
"@eslint/eslintrc": "^3.3.1",
|
|
79
79
|
"@eslint/js": "^9.37.0",
|
|
80
|
-
"@release-it/conventional-changelog": "^
|
|
80
|
+
"@release-it/conventional-changelog": "^11.0.0",
|
|
81
81
|
"@typescript-eslint/eslint-plugin": "^8.46.1",
|
|
82
82
|
"@typescript-eslint/parser": "^8.46.1",
|
|
83
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
84
|
-
"cspell": "^9.
|
|
83
|
+
"@typescript-eslint/rule-tester": "^8.59.0",
|
|
84
|
+
"cspell": "^9.8.0",
|
|
85
85
|
"eslint": "^9.37.0",
|
|
86
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
86
87
|
"eslint-plugin-class-export": "^1.0.1",
|
|
87
88
|
"eslint-plugin-import": "^2.32.0",
|
|
88
89
|
"eslint-plugin-n": "^17.23.1",
|
|
@@ -92,36 +93,36 @@
|
|
|
92
93
|
"eslint-plugin-security": "^3.0.1",
|
|
93
94
|
"eslint-plugin-storybook": "^9.1.10",
|
|
94
95
|
"husky": "^9.1.7",
|
|
95
|
-
"knip": "^
|
|
96
|
-
"lint-staged": "^16.
|
|
97
|
-
"prettier": "^3.
|
|
98
|
-
"release-it": "^
|
|
96
|
+
"knip": "^6.7.0",
|
|
97
|
+
"lint-staged": "^16.4.0",
|
|
98
|
+
"prettier": "^3.8.3",
|
|
99
|
+
"release-it": "^20.0.1",
|
|
99
100
|
"typescript-eslint": "^8.46.1"
|
|
100
101
|
},
|
|
101
102
|
"dependencies": {
|
|
102
|
-
"@eslint/eslintrc": "^3.3.
|
|
103
|
-
"@eslint/js": "^9.
|
|
104
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
105
|
-
"@typescript-eslint/parser": "^8.
|
|
106
|
-
"eslint": "^9.
|
|
103
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
104
|
+
"@eslint/js": "^9.39.4",
|
|
105
|
+
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
106
|
+
"@typescript-eslint/parser": "^8.59.0",
|
|
107
|
+
"eslint": "^9.39.4",
|
|
107
108
|
"eslint-plugin-class-export": "^1.0.1",
|
|
108
109
|
"eslint-plugin-ddd": "^0.5.2",
|
|
109
110
|
"eslint-plugin-default": "^1.1.0",
|
|
110
|
-
"eslint-plugin-early-return": "^1.
|
|
111
|
+
"eslint-plugin-early-return": "^1.1.0",
|
|
111
112
|
"eslint-plugin-error": "^1.3.0",
|
|
112
113
|
"eslint-plugin-import": "^2.32.0",
|
|
114
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
113
115
|
"eslint-plugin-jsx-classname": "^1.0.1",
|
|
114
|
-
"eslint-plugin-n": "^17.
|
|
115
|
-
"eslint-plugin-no-optional-chaining": "^1.0.0",
|
|
116
|
+
"eslint-plugin-n": "^17.24.0",
|
|
116
117
|
"eslint-plugin-preact": "^0.1.0",
|
|
117
118
|
"eslint-plugin-react": "^7.37.5",
|
|
118
119
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
119
120
|
"eslint-plugin-required-exports": "^0.2.0",
|
|
120
|
-
"eslint-plugin-security": "^
|
|
121
|
+
"eslint-plugin-security": "^4.0.0",
|
|
121
122
|
"eslint-plugin-single-export": "^1.1.2",
|
|
122
|
-
"eslint-plugin-storybook": "^
|
|
123
|
-
"eslint-plugin-switch-case": "^
|
|
124
|
-
"globals": "^
|
|
125
|
-
"typescript-eslint": "^8.
|
|
123
|
+
"eslint-plugin-storybook": "^10.3.5",
|
|
124
|
+
"eslint-plugin-switch-case": "^4.0.0",
|
|
125
|
+
"globals": "^17.5.0",
|
|
126
|
+
"typescript-eslint": "^8.59.0"
|
|
126
127
|
}
|
|
127
128
|
}
|
package/plugins/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import reactPlugin from 'eslint-plugin-react'
|
|
9
|
+
import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
9
10
|
import importPlugin from 'eslint-plugin-import'
|
|
10
11
|
import securityPlugin from 'eslint-plugin-security'
|
|
11
12
|
import nPlugin from 'eslint-plugin-n'
|
|
@@ -15,7 +16,6 @@ import requiredExportsPlugin from 'eslint-plugin-required-exports'
|
|
|
15
16
|
import storybookPlugin from 'eslint-plugin-storybook'
|
|
16
17
|
import errorPlugin from 'eslint-plugin-error'
|
|
17
18
|
import defaultPlugin from 'eslint-plugin-default'
|
|
18
|
-
import noOptionalChainingPlugin from 'eslint-plugin-no-optional-chaining'
|
|
19
19
|
import dddPlugin from 'eslint-plugin-ddd'
|
|
20
20
|
import preactPlugin from 'eslint-plugin-preact'
|
|
21
21
|
import { noDefaultClassExportRule } from '../rules/no-default-class-export/index.js'
|
|
@@ -23,6 +23,7 @@ import { noDefaultClassExportRule } from '../rules/no-default-class-export/index
|
|
|
23
23
|
// Centralized plugin configuration
|
|
24
24
|
export const plugins = {
|
|
25
25
|
react: reactPlugin,
|
|
26
|
+
'react-hooks': reactHooksPlugin,
|
|
26
27
|
import: importPlugin,
|
|
27
28
|
security: securityPlugin,
|
|
28
29
|
n: nPlugin,
|
|
@@ -32,7 +33,6 @@ export const plugins = {
|
|
|
32
33
|
storybook: storybookPlugin,
|
|
33
34
|
error: errorPlugin,
|
|
34
35
|
default: defaultPlugin,
|
|
35
|
-
'no-optional-chaining': noOptionalChainingPlugin,
|
|
36
36
|
ddd: dddPlugin,
|
|
37
37
|
preact: preactPlugin,
|
|
38
38
|
custom: {
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Check if a class declaration extends Error or another Error class
|
|
10
|
+
* @param node - The AST node to check
|
|
11
|
+
* @returns True if the node extends Error
|
|
10
12
|
*/
|
|
11
13
|
function extendsError(node) {
|
|
12
14
|
if (!node.superClass) {
|
|
@@ -29,9 +31,11 @@ function extendsError(node) {
|
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Check if the file only contains error class exports
|
|
34
|
+
* @param context - The ESLint rule context
|
|
35
|
+
* @returns True if file only exports error classes
|
|
32
36
|
*/
|
|
33
37
|
function isErrorOnlyFile(context) {
|
|
34
|
-
const sourceCode = context.sourceCode
|
|
38
|
+
const sourceCode = context.sourceCode
|
|
35
39
|
const ast = sourceCode.ast
|
|
36
40
|
|
|
37
41
|
let hasExports = false
|
|
@@ -124,7 +128,7 @@ export const errorOnlyExportsRule = {
|
|
|
124
128
|
}
|
|
125
129
|
|
|
126
130
|
// Check if the file already has the eslint-disable comment
|
|
127
|
-
const sourceCode = context.sourceCode
|
|
131
|
+
const sourceCode = context.sourceCode
|
|
128
132
|
const comments = sourceCode.getAllComments()
|
|
129
133
|
|
|
130
134
|
const hasDisableComment = comments.some(
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
* - ✅ type Status = 'active' | 'inactive'; function foo(status: Status) {}
|
|
12
12
|
* - ✅ type Role = 'admin' | 'user'; interface User { role: Role; }
|
|
13
13
|
* - ✅ type Mode = 'dev' | 'prod'; class Config { mode: Mode; }
|
|
14
|
-
*
|
|
15
14
|
* @see https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
16
15
|
*/
|
|
17
16
|
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* - ✅ interface UserInfo { name: string; age: string; }
|
|
17
17
|
* - ✅ type Status = { active: boolean; }
|
|
18
18
|
* - ✅ Record<string, unknown> (generic keys are allowed)
|
|
19
|
-
*
|
|
20
19
|
* @see https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
21
20
|
* @see https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type
|
|
22
21
|
*/
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
* // Type references with generics
|
|
55
55
|
* type ListOfUsers = Array<User>;
|
|
56
56
|
* ```
|
|
57
|
-
*
|
|
58
57
|
* @see https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
59
58
|
* @see ./examples/invalid.js for more invalid examples
|
|
60
59
|
* @see ./examples/valid.js for more valid examples
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* - ❌ const name = user?.name ?? 'Anonymous'
|
|
14
14
|
* - ✅ const result = value !== null && value !== undefined ? value : 'default'
|
|
15
15
|
* - ✅ const name = user?.name !== undefined ? user.name : 'Anonymous'
|
|
16
|
-
*
|
|
17
16
|
* @see https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
18
17
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing
|
|
19
18
|
*/
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This rule disallows the use of process.env to encourage centralized configuration
|
|
5
5
|
* management instead of scattered environment variable access throughout the codebase.
|
|
6
|
-
*
|
|
7
6
|
* @see https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-process-env.md
|
|
8
7
|
*/
|
|
9
8
|
|