eslint-config-agent 1.9.3 → 2.0.0
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/index.js +3 -15
- package/package.json +20 -25
- package/plugins/index.js +2 -9
- package/rules/error-only-exports/index.js +22 -20
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import js from '@eslint/js'
|
|
2
|
+
import earlyReturn from 'eslint-plugin-early-return'
|
|
2
3
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
3
4
|
import { defineConfig } from 'eslint/config'
|
|
4
5
|
import tseslint from 'typescript-eslint'
|
|
@@ -104,23 +105,10 @@ const config = defineConfig([
|
|
|
104
105
|
{
|
|
105
106
|
plugins,
|
|
106
107
|
},
|
|
107
|
-
|
|
108
|
-
...(reactHooks.configs['recommended-latest']
|
|
109
|
-
? [reactHooks.configs['recommended-latest']]
|
|
110
|
-
: [
|
|
111
|
-
{
|
|
112
|
-
name: 'react-hooks/recommended-flat',
|
|
113
|
-
plugins: {
|
|
114
|
-
'react-hooks': reactHooks,
|
|
115
|
-
},
|
|
116
|
-
rules: {
|
|
117
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
118
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
]),
|
|
108
|
+
reactHooks.configs['recommended-latest'],
|
|
122
109
|
js.configs.recommended,
|
|
123
110
|
...tseslint.configs.recommended,
|
|
111
|
+
earlyReturn.configs.recommended,
|
|
124
112
|
|
|
125
113
|
// Base plugin strict configs (error, default, guard-clauses)
|
|
126
114
|
...basePluginsConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "ESLint configuration package with TypeScript support",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -61,37 +61,17 @@
|
|
|
61
61
|
"author": "tupe12334",
|
|
62
62
|
"repository": {
|
|
63
63
|
"type": "git",
|
|
64
|
-
"url": "git+https://github.com/tupe12334/eslint-config.git"
|
|
64
|
+
"url": "git+https://github.com/tupe12334/eslint-config-agent.git"
|
|
65
65
|
},
|
|
66
66
|
"bugs": {
|
|
67
|
-
"url": "https://github.com/tupe12334/eslint-config/issues"
|
|
67
|
+
"url": "https://github.com/tupe12334/eslint-config-agent/issues"
|
|
68
68
|
},
|
|
69
|
-
"homepage": "https://github.com/tupe12334/eslint-config#readme",
|
|
69
|
+
"homepage": "https://github.com/tupe12334/eslint-config-agent#readme",
|
|
70
70
|
"license": "MIT",
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
74
|
"packageManager": "pnpm@10.18.2",
|
|
75
|
-
"peerDependencies": {
|
|
76
|
-
"@eslint/eslintrc": "^3.3.1",
|
|
77
|
-
"@eslint/js": "^9.34.0",
|
|
78
|
-
"@typescript-eslint/eslint-plugin": "^8.40.0",
|
|
79
|
-
"@typescript-eslint/parser": "^8.40.0",
|
|
80
|
-
"eslint": "^9.34.0",
|
|
81
|
-
"eslint-plugin-class-export": "^1.0.1",
|
|
82
|
-
"eslint-plugin-import": "^2.32.0",
|
|
83
|
-
"eslint-plugin-n": "^17.21.3",
|
|
84
|
-
"eslint-plugin-react": "^7.37.5",
|
|
85
|
-
"eslint-plugin-react-hooks": "^5.2.0",
|
|
86
|
-
"eslint-plugin-security": "^3.0.1",
|
|
87
|
-
"eslint-plugin-storybook": "^9.1.5",
|
|
88
|
-
"typescript-eslint": "^8.40.0"
|
|
89
|
-
},
|
|
90
|
-
"peerDependenciesMeta": {
|
|
91
|
-
"eslint-plugin-preact": {
|
|
92
|
-
"optional": true
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
75
|
"devDependencies": {
|
|
96
76
|
"@commitlint/cli": "^20.1.0",
|
|
97
77
|
"@commitlint/config-conventional": "^20.0.0",
|
|
@@ -119,12 +99,27 @@
|
|
|
119
99
|
"typescript-eslint": "^8.46.1"
|
|
120
100
|
},
|
|
121
101
|
"dependencies": {
|
|
102
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
103
|
+
"@eslint/js": "^9.34.0",
|
|
104
|
+
"@typescript-eslint/eslint-plugin": "^8.40.0",
|
|
105
|
+
"@typescript-eslint/parser": "^8.40.0",
|
|
106
|
+
"eslint": "^9.34.0",
|
|
107
|
+
"eslint-plugin-class-export": "^1.0.1",
|
|
122
108
|
"eslint-plugin-ddd": "^0.5.2",
|
|
123
109
|
"eslint-plugin-default": "^1.1.0",
|
|
110
|
+
"eslint-plugin-early-return": "^1.0.0",
|
|
124
111
|
"eslint-plugin-error": "^1.3.0",
|
|
112
|
+
"eslint-plugin-import": "^2.32.0",
|
|
113
|
+
"eslint-plugin-n": "^17.21.3",
|
|
125
114
|
"eslint-plugin-no-optional-chaining": "^1.0.0",
|
|
115
|
+
"eslint-plugin-preact": "^0.1.0",
|
|
116
|
+
"eslint-plugin-react": "^7.37.5",
|
|
117
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
126
118
|
"eslint-plugin-required-exports": "^0.2.0",
|
|
119
|
+
"eslint-plugin-security": "^3.0.1",
|
|
127
120
|
"eslint-plugin-single-export": "^1.1.2",
|
|
128
|
-
"
|
|
121
|
+
"eslint-plugin-storybook": "^9.1.5",
|
|
122
|
+
"globals": "^16.4.0",
|
|
123
|
+
"typescript-eslint": "^8.40.0"
|
|
129
124
|
}
|
|
130
125
|
}
|
package/plugins/index.js
CHANGED
|
@@ -17,17 +17,10 @@ import errorPlugin from 'eslint-plugin-error'
|
|
|
17
17
|
import defaultPlugin from 'eslint-plugin-default'
|
|
18
18
|
import noOptionalChainingPlugin from 'eslint-plugin-no-optional-chaining'
|
|
19
19
|
import dddPlugin from 'eslint-plugin-ddd'
|
|
20
|
+
import preactPlugin from 'eslint-plugin-preact'
|
|
20
21
|
import allRules from '../rules/index.js'
|
|
21
22
|
import { noDefaultClassExportRule } from '../rules/no-default-class-export/index.js'
|
|
22
23
|
|
|
23
|
-
// Conditionally import preact plugin if available
|
|
24
|
-
let preactPlugin = null
|
|
25
|
-
try {
|
|
26
|
-
preactPlugin = (await import('eslint-plugin-preact')).default
|
|
27
|
-
} catch {
|
|
28
|
-
// eslint-plugin-preact is not available
|
|
29
|
-
}
|
|
30
|
-
|
|
31
24
|
// Centralized plugin configuration
|
|
32
25
|
export const plugins = {
|
|
33
26
|
react: reactPlugin,
|
|
@@ -42,7 +35,7 @@ export const plugins = {
|
|
|
42
35
|
default: defaultPlugin,
|
|
43
36
|
'no-optional-chaining': noOptionalChainingPlugin,
|
|
44
37
|
ddd: dddPlugin,
|
|
45
|
-
|
|
38
|
+
preact: preactPlugin,
|
|
46
39
|
custom: {
|
|
47
40
|
rules: {
|
|
48
41
|
'no-default-class-export': noDefaultClassExportRule,
|
|
@@ -119,26 +119,28 @@ export const errorOnlyExportsRule = {
|
|
|
119
119
|
// Only check on program exit to ensure we've seen all exports
|
|
120
120
|
},
|
|
121
121
|
'Program:exit'(node) {
|
|
122
|
-
if (isErrorOnlyFile(context)) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
122
|
+
if (!isErrorOnlyFile(context)) {
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Check if the file already has the eslint-disable comment
|
|
127
|
+
const sourceCode = context.sourceCode || context.getSourceCode()
|
|
128
|
+
const comments = sourceCode.getAllComments()
|
|
129
|
+
|
|
130
|
+
const hasDisableComment = comments.some(
|
|
131
|
+
comment =>
|
|
132
|
+
comment.value.includes('eslint-disable ddd/require-spec-file') ||
|
|
133
|
+
comment.value.includes(
|
|
134
|
+
'eslint-disable-next-line ddd/require-spec-file'
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
// Only report if the disable comment is not present
|
|
139
|
+
if (!hasDisableComment) {
|
|
140
|
+
context.report({
|
|
141
|
+
node,
|
|
142
|
+
messageId: 'errorOnlyFile',
|
|
143
|
+
})
|
|
142
144
|
}
|
|
143
145
|
},
|
|
144
146
|
}
|