@hyperupcall/eslint-config 2.0.2 → 2.1.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 +22 -7
- package/package.json +20 -22
- package/pnpm-workspace.yaml +1 -0
- package/testdata/test.json +4 -0
- package/tsconfig.json +15 -0
- package/example/eslint.config.js +0 -240
- package/example/package.json +0 -25
- package/example/pnpm-lock.yaml +0 -4410
- package/example/testdata/test.json +0 -1
- /package/{example/testdata → testdata}/test.css +0 -0
- /package/{example/testdata → testdata}/test.js +0 -0
- /package/{example/testdata → testdata}/test.md +0 -0
package/index.js
CHANGED
|
@@ -174,13 +174,28 @@ export default defineConfig([
|
|
|
174
174
|
'error',
|
|
175
175
|
{
|
|
176
176
|
groups: ['language', 'files', 'plugins', 'extends', 'rules'],
|
|
177
|
-
customGroups:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
customGroups: [
|
|
178
|
+
{
|
|
179
|
+
groupName: 'language',
|
|
180
|
+
elementNamePattern: '^language$',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
groupName: 'files',
|
|
184
|
+
elementNamePattern: '^files$',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
groupName: 'plugins',
|
|
188
|
+
elementNamePattern: '^plugins$',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
groupName: 'extends',
|
|
192
|
+
elementNamePattern: '^extends$',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
groupName: 'rules',
|
|
196
|
+
elementNamePattern: '^rules$',
|
|
197
|
+
},
|
|
198
|
+
],
|
|
184
199
|
useConfigurationIf: {
|
|
185
200
|
callingFunctionNamePattern: '^defineConfig$',
|
|
186
201
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperupcall/eslint-config",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Edwin's ESLint configuration.",
|
|
6
6
|
"repository": {
|
|
@@ -14,38 +14,36 @@
|
|
|
14
14
|
"license": "MPL-2.0",
|
|
15
15
|
"private": false,
|
|
16
16
|
"main": "./index.js",
|
|
17
|
-
"peerDependencies": {
|
|
18
|
-
"@eslint-community/eslint-plugin-eslint-comments": ">=4.0.0",
|
|
19
|
-
"@eslint/css": ">=0.5.0",
|
|
20
|
-
"@eslint/js": ">=9.0.0",
|
|
21
|
-
"@eslint/json": ">=0.11.0",
|
|
22
|
-
"@eslint/markdown": ">=6.0.0",
|
|
23
|
-
"eslint": ">=9.0.0",
|
|
24
|
-
"eslint-config-prettier": ">=9.1.0",
|
|
25
|
-
"eslint-plugin-import-x": ">=4.0.0",
|
|
26
|
-
"eslint-plugin-n": ">=17.0.0",
|
|
27
|
-
"eslint-plugin-no-unsanitized": ">=4.0.0",
|
|
28
|
-
"eslint-plugin-perfectionist": ">=3.0.0",
|
|
29
|
-
"eslint-plugin-promise": ">=7.0.0",
|
|
30
|
-
"eslint-plugin-regexp": ">=2.0.0",
|
|
31
|
-
"eslint-plugin-security": ">=3.0.0",
|
|
32
|
-
"eslint-plugin-unicorn": ">=55.0.0"
|
|
33
|
-
},
|
|
34
17
|
"dependencies": {
|
|
18
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
19
|
+
"@eslint/css": "^1.0.0",
|
|
20
|
+
"@eslint/js": "^10.0.1",
|
|
21
|
+
"@eslint/json": "^2.0.0",
|
|
22
|
+
"@eslint/markdown": "^8.0.2",
|
|
23
|
+
"eslint-config-prettier": "^10.1.8",
|
|
24
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
25
|
+
"eslint-plugin-mdx": "^3.7.0",
|
|
26
|
+
"eslint-plugin-n": "^18.1.0",
|
|
27
|
+
"eslint-plugin-no-unsanitized": "^4.1.5",
|
|
28
|
+
"eslint-plugin-perfectionist": "^5.9.1",
|
|
29
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
30
|
+
"eslint-plugin-regexp": "^3.1.0",
|
|
31
|
+
"eslint-plugin-security": "^4.0.0",
|
|
32
|
+
"eslint-plugin-unicorn": "^67.0.0",
|
|
35
33
|
"globals": "^17.0.0"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
38
36
|
"@hyperupcall/scripts-nodejs": "0.9.0",
|
|
39
|
-
"@types/node": "^25.
|
|
40
|
-
"typescript": "^
|
|
37
|
+
"@types/node": "^25.9.3",
|
|
38
|
+
"typescript": "^6.0.3"
|
|
41
39
|
},
|
|
42
40
|
"markdownlint-cli2": {
|
|
43
41
|
"extends": "./node_modules/@hyperupcall/markdownlint-config/.markdownlint.json"
|
|
44
42
|
},
|
|
45
43
|
"prettier": "@hyperupcall/scripts-nodejs/config-prettier.js",
|
|
46
44
|
"scripts": {
|
|
47
|
-
"typecheck": "tsc --project ./tsconfig.json",
|
|
48
45
|
"format": "hyperupcall-scripts-nodejs format",
|
|
49
|
-
"lint": "hyperupcall-scripts-nodejs lint"
|
|
46
|
+
"lint": "hyperupcall-scripts-nodejs lint",
|
|
47
|
+
"typecheck": "tsc --project ./tsconfig.json"
|
|
50
48
|
}
|
|
51
49
|
}
|
package/pnpm-workspace.yaml
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"include": ["./index.js"],
|
|
3
|
+
<<<<<<< Updated upstream
|
|
3
4
|
"compilerOptions": {
|
|
4
5
|
"allowJs": true,
|
|
5
6
|
"checkJs": true,
|
|
@@ -11,6 +12,20 @@
|
|
|
11
12
|
"declaration": true,
|
|
12
13
|
"emitDeclarationOnly": true,
|
|
13
14
|
"strict": true,
|
|
15
|
+
=======
|
|
16
|
+
"exclude": ["**/node_modules/**"],
|
|
17
|
+
"compilerOptions": {
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"allowJs": true,
|
|
20
|
+
"checkJs": true,
|
|
21
|
+
"target": "es2015",
|
|
22
|
+
"moduleResolution": "node16",
|
|
23
|
+
"module": "node16",
|
|
24
|
+
"lib": ["ES2019"],
|
|
25
|
+
"noEmit": false,
|
|
26
|
+
"declaration": true,
|
|
27
|
+
"emitDeclarationOnly": true,
|
|
28
|
+
>>>>>>> Stashed changes
|
|
14
29
|
"outDir": "./output"
|
|
15
30
|
}
|
|
16
31
|
}
|
package/example/eslint.config.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import 'globals';
|
|
2
|
-
import { defineConfig } from 'eslint/config';
|
|
3
|
-
import css from '@eslint/css';
|
|
4
|
-
import js from '@eslint/js';
|
|
5
|
-
import json from '@eslint/json';
|
|
6
|
-
import markdown from '@eslint/markdown';
|
|
7
|
-
import pluginPromise from 'eslint-plugin-promise';
|
|
8
|
-
import pluginNode from 'eslint-plugin-n';
|
|
9
|
-
import pluginSecurity from 'eslint-plugin-security';
|
|
10
|
-
import pluginComments from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
11
|
-
import pluginUnicorn from 'eslint-plugin-unicorn';
|
|
12
|
-
import pluginRegexp from 'eslint-plugin-regexp';
|
|
13
|
-
import pluginNoUnsanitized from 'eslint-plugin-no-unsanitized';
|
|
14
|
-
import pluginPerfectionist from 'eslint-plugin-perfectionist';
|
|
15
|
-
import configPrettier from 'eslint-config-prettier';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @import { RuleEntry } from '@eslint/config-helpers'
|
|
19
|
-
*/
|
|
20
|
-
// TODO: import-x
|
|
21
|
-
|
|
22
|
-
const CurrentMode = process.env.HYPERUPCALL_LINT_MODE || 'release';
|
|
23
|
-
|
|
24
|
-
const cssFiles = ['**/*.css'];
|
|
25
|
-
const jsFiles = ['**/*.js'];
|
|
26
|
-
|
|
27
|
-
var index = defineConfig([
|
|
28
|
-
// @eslint/css: https://github.com/eslint/css
|
|
29
|
-
{
|
|
30
|
-
language: 'css/css',
|
|
31
|
-
files: cssFiles,
|
|
32
|
-
plugins: { css },
|
|
33
|
-
extends: [css.configs.recommended],
|
|
34
|
-
rules: {},
|
|
35
|
-
},
|
|
36
|
-
// @eslint/js: https://github.com/eslint/eslint/tree/main/packages/js
|
|
37
|
-
{
|
|
38
|
-
files: jsFiles,
|
|
39
|
-
plugins: { js },
|
|
40
|
-
languageOptions: {
|
|
41
|
-
sourceType: 'module',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
files: jsFiles,
|
|
46
|
-
plugins: { js },
|
|
47
|
-
extends: [js.configs.recommended],
|
|
48
|
-
rules: {
|
|
49
|
-
'array-callback-return': mode({
|
|
50
|
-
edit: ['off'],
|
|
51
|
-
commit: ['error'],
|
|
52
|
-
release: ['error'],
|
|
53
|
-
}),
|
|
54
|
-
'constructor-super': mode({
|
|
55
|
-
edit: ['warn'],
|
|
56
|
-
commit: ['error'],
|
|
57
|
-
release: ['error'],
|
|
58
|
-
}),
|
|
59
|
-
'for-direction': ['error'],
|
|
60
|
-
'getter-return': mode({
|
|
61
|
-
edit: ['off'],
|
|
62
|
-
commit: ['error'],
|
|
63
|
-
release: ['error'],
|
|
64
|
-
}),
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
// eslint-plugin-promise: https://github.com/eslint-community/eslint-plugin-promise
|
|
68
|
-
{
|
|
69
|
-
files: jsFiles,
|
|
70
|
-
plugins: { js },
|
|
71
|
-
extends: [pluginPromise.configs['flat/recommended']],
|
|
72
|
-
rules: {},
|
|
73
|
-
},
|
|
74
|
-
// eslint-plugin-n: https://github.com/eslint-community/eslint-plugin-n
|
|
75
|
-
{
|
|
76
|
-
files: jsFiles,
|
|
77
|
-
plugins: { js },
|
|
78
|
-
extends: [pluginNode.configs['flat/recommended-script']],
|
|
79
|
-
rules: {},
|
|
80
|
-
},
|
|
81
|
-
// eslint-plugin-security: https://github.com/eslint-community/eslint-plugin-security
|
|
82
|
-
{
|
|
83
|
-
files: jsFiles,
|
|
84
|
-
plugins: { js },
|
|
85
|
-
extends: [pluginSecurity.configs.recommended],
|
|
86
|
-
rules: {},
|
|
87
|
-
},
|
|
88
|
-
// eslint-plugin-eslint-comments: https://github.com/eslint-community/eslint-plugin-eslint-comments
|
|
89
|
-
{
|
|
90
|
-
files: jsFiles,
|
|
91
|
-
plugins: { js },
|
|
92
|
-
extends: [pluginComments.recommended],
|
|
93
|
-
rules: {},
|
|
94
|
-
},
|
|
95
|
-
// eslint-plugin-unicorn: https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
96
|
-
{
|
|
97
|
-
files: jsFiles,
|
|
98
|
-
plugins: { js },
|
|
99
|
-
extends: [pluginUnicorn.configs['flat/recommended']],
|
|
100
|
-
rules: {},
|
|
101
|
-
},
|
|
102
|
-
// eslint-plugin-regexp: https://github.com/sindresorhus/eslint-plugin-regexp
|
|
103
|
-
{
|
|
104
|
-
files: jsFiles,
|
|
105
|
-
plugins: { js },
|
|
106
|
-
extends: [pluginRegexp.configs['flat/recommended']],
|
|
107
|
-
rules: {},
|
|
108
|
-
},
|
|
109
|
-
// eslint-plugin-regexp: https://github.com/sindresorhus/eslint-plugin-regexp
|
|
110
|
-
{
|
|
111
|
-
files: jsFiles,
|
|
112
|
-
plugins: { js },
|
|
113
|
-
extends: [pluginNoUnsanitized.configs.recommended],
|
|
114
|
-
rules: {},
|
|
115
|
-
},
|
|
116
|
-
// eslint-plugin-no-unsanitized: https://github.com/mozilla/eslint-plugin-no-unsanitized
|
|
117
|
-
{
|
|
118
|
-
files: jsFiles,
|
|
119
|
-
plugins: { js },
|
|
120
|
-
extends: [pluginNoUnsanitized.configs.recommended],
|
|
121
|
-
rules: {},
|
|
122
|
-
},
|
|
123
|
-
// eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
|
|
124
|
-
{
|
|
125
|
-
files: jsFiles,
|
|
126
|
-
plugins: { js },
|
|
127
|
-
extends: [pluginPerfectionist.configs['recommended-natural']],
|
|
128
|
-
rules: {
|
|
129
|
-
'perfectionist/sort-objects': [
|
|
130
|
-
'error',
|
|
131
|
-
{
|
|
132
|
-
groups: ['r', 'g', 'b'],
|
|
133
|
-
customGroups: {
|
|
134
|
-
r: '^r$',
|
|
135
|
-
g: '^g$',
|
|
136
|
-
b: '^b$',
|
|
137
|
-
},
|
|
138
|
-
useConfigurationIf: {
|
|
139
|
-
allNamesMatchPattern: '^r|g|b$',
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
type: 'alphabetical',
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
files: [
|
|
150
|
-
'eslint.config.js',
|
|
151
|
-
'eslint.config.mjs',
|
|
152
|
-
'eslint.config.cjs',
|
|
153
|
-
'eslint.config.ts',
|
|
154
|
-
'eslint.config.mts',
|
|
155
|
-
'eslint.config.cts',
|
|
156
|
-
],
|
|
157
|
-
plugins: { js },
|
|
158
|
-
extends: [pluginPerfectionist.configs['recommended-natural']],
|
|
159
|
-
rules: {
|
|
160
|
-
'perfectionist/sort-objects': [
|
|
161
|
-
'error',
|
|
162
|
-
{
|
|
163
|
-
groups: ['language', 'files', 'plugins', 'extends', 'rules'],
|
|
164
|
-
customGroups: {
|
|
165
|
-
language: '^language$',
|
|
166
|
-
files: '^files$',
|
|
167
|
-
plugins: '^plugins$',
|
|
168
|
-
extends: '^extends$',
|
|
169
|
-
rules: '^rules$',
|
|
170
|
-
},
|
|
171
|
-
useConfigurationIf: {
|
|
172
|
-
callingFunctionNamePattern: '^defineConfig$',
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
type: 'alphabetical',
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
// eslint-config-prettier: https://github.com/prettier/eslint-config-prettier
|
|
182
|
-
{
|
|
183
|
-
files: jsFiles,
|
|
184
|
-
plugins: { js },
|
|
185
|
-
extends: [configPrettier],
|
|
186
|
-
rules: {},
|
|
187
|
-
},
|
|
188
|
-
// @eslint/json: https://github.com/eslint/json
|
|
189
|
-
{
|
|
190
|
-
language: 'json/json',
|
|
191
|
-
files: ['**/*.json'],
|
|
192
|
-
plugins: { json },
|
|
193
|
-
extends: [json.configs.recommended],
|
|
194
|
-
ignores: ['package-lock.json'],
|
|
195
|
-
rules: {},
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
language: 'json/jsonc',
|
|
199
|
-
files: ['**/*.jsonc'],
|
|
200
|
-
plugins: { json },
|
|
201
|
-
extends: [json.configs.recommended],
|
|
202
|
-
rules: {},
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
language: 'json/json5',
|
|
206
|
-
files: ['**/*.json5'],
|
|
207
|
-
plugins: { json },
|
|
208
|
-
extends: [json.configs.recommended],
|
|
209
|
-
rules: {},
|
|
210
|
-
},
|
|
211
|
-
// @eslint/markdown: https://github.com/eslint/markdown
|
|
212
|
-
{
|
|
213
|
-
language: 'markdown/commonmark',
|
|
214
|
-
files: ['**/*.md'],
|
|
215
|
-
plugins: {
|
|
216
|
-
markdown,
|
|
217
|
-
},
|
|
218
|
-
extends: [markdown.configs.recommended],
|
|
219
|
-
},
|
|
220
|
-
]);
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* @param {Record<'edit' | 'commit' | 'release', unknown | undefined>} toggles
|
|
224
|
-
* @returns {RuleEntry}
|
|
225
|
-
*/
|
|
226
|
-
function mode(toggles) {
|
|
227
|
-
const possibleModes = ['edit', 'commit', 'release'];
|
|
228
|
-
const currentMode = 'edit';
|
|
229
|
-
if (!possibleModes.includes(CurrentMode)) {
|
|
230
|
-
throw new Error(
|
|
231
|
-
`Expected the current mode to be ${new Intl.ListFormat().format(possibleModes.map((/** @type {string} */ item) => `"${item}"`))}. Found "${CurrentMode}"`,
|
|
232
|
-
)
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// if (currentMode === 'edit' && toggles.edit)
|
|
236
|
-
|
|
237
|
-
return /** @type RuleEntry */ (toggles[currentMode])
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export { index as default };
|
package/example/package.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "example",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"check": "cp ../output/index.mjs ./eslint.config.js && eslint --config ./eslint.config.js"
|
|
7
|
-
},
|
|
8
|
-
"devDependencies": {
|
|
9
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
10
|
-
"@eslint/css": "^0.5.0",
|
|
11
|
-
"@eslint/json": "^0.11.0",
|
|
12
|
-
"@eslint/markdown": "^6.3.0",
|
|
13
|
-
"@hyperupcall/eslint-config": "^1.2.0",
|
|
14
|
-
"eslint": "^9.22.0",
|
|
15
|
-
"eslint-config-prettier": "^10.1.1",
|
|
16
|
-
"eslint-plugin-import": "^2.31.0",
|
|
17
|
-
"eslint-plugin-n": "^17.16.2",
|
|
18
|
-
"eslint-plugin-no-unsanitized": "^4.1.2",
|
|
19
|
-
"eslint-plugin-perfectionist": "^4.10.1",
|
|
20
|
-
"eslint-plugin-promise": "^7.2.1",
|
|
21
|
-
"eslint-plugin-regexp": "^2.7.0",
|
|
22
|
-
"eslint-plugin-security": "^3.0.1",
|
|
23
|
-
"eslint-plugin-unicorn": "^57.0.0"
|
|
24
|
-
}
|
|
25
|
-
}
|