@hyperupcall/eslint-config 2.0.1 → 2.0.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.
- package/.commitlintrc.yaml +2 -0
- package/.cz.toml +7 -0
- package/.ls-lint.yml +31 -0
- package/.yamlfmt.yaml +17 -0
- package/.yamllint.yaml +9 -0
- package/dev.toml +5 -0
- package/index.js +36 -12
- package/package.json +23 -25
- package/pnpm-workspace.yaml +2 -1
- package/example/eslint.config.js +0 -240
- package/example/package.json +0 -25
- package/example/pnpm-lock.yaml +0 -4410
- package/project.toml +0 -2
- /package/{example/testdata → testdata}/test.css +0 -0
- /package/{example/testdata → testdata}/test.js +0 -0
- /package/{example/testdata → testdata}/test.json +0 -0
- /package/{example/testdata → testdata}/test.md +0 -0
package/.cz.toml
ADDED
package/.ls-lint.yml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
ls:
|
|
2
|
+
.vscode:
|
|
3
|
+
.*: 'exists:0'
|
|
4
|
+
.json: 'regex:(settings|launch|tasks|extensions|keybindings)'
|
|
5
|
+
|
|
6
|
+
assets:
|
|
7
|
+
.*: 'exists:0'
|
|
8
|
+
.png: 'kebab-case'
|
|
9
|
+
.jpg: 'kebab-case'
|
|
10
|
+
.jpeg: 'kebab-case'
|
|
11
|
+
.svg: 'kebab-case'
|
|
12
|
+
.ico: 'kebab-case'
|
|
13
|
+
|
|
14
|
+
docs:
|
|
15
|
+
.*: 'exists:0'
|
|
16
|
+
.md: 'kebab-case'
|
|
17
|
+
|
|
18
|
+
language-configuration:
|
|
19
|
+
.*: 'exists:0'
|
|
20
|
+
.language-configuration.json: 'kebab-case'
|
|
21
|
+
|
|
22
|
+
scripts:
|
|
23
|
+
.js: 'kebab-case'
|
|
24
|
+
|
|
25
|
+
syntaxes:
|
|
26
|
+
.*: 'exists:0'
|
|
27
|
+
.tmLanguage.json: 'kebab-case'
|
|
28
|
+
|
|
29
|
+
ignore:
|
|
30
|
+
- 'node_modules'
|
|
31
|
+
- '.git'
|
package/.yamlfmt.yaml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
line_ending: 'lf'
|
|
2
|
+
doublestar: true
|
|
3
|
+
gitignore_excludes: false
|
|
4
|
+
exclude:
|
|
5
|
+
- "**/.data/**"
|
|
6
|
+
- '**/node_modules/**'
|
|
7
|
+
- '**/target/**'
|
|
8
|
+
formatter:
|
|
9
|
+
type: 'basic'
|
|
10
|
+
indent: 2
|
|
11
|
+
include_document_start: false
|
|
12
|
+
retain_line_breaks_single: true
|
|
13
|
+
disallow_anchors: false
|
|
14
|
+
indentless_arrays: true
|
|
15
|
+
trim_trailing_whitespace: true
|
|
16
|
+
eof_newline: true
|
|
17
|
+
force_quote_style: "single"
|
package/.yamllint.yaml
ADDED
package/dev.toml
ADDED
package/index.js
CHANGED
|
@@ -134,11 +134,20 @@ export default defineConfig([
|
|
|
134
134
|
'error',
|
|
135
135
|
{
|
|
136
136
|
groups: ['r', 'g', 'b'],
|
|
137
|
-
customGroups:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
customGroups: [
|
|
138
|
+
{
|
|
139
|
+
groupName: 'r',
|
|
140
|
+
elementNamePattern: '^r$',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
groupName: 'g',
|
|
144
|
+
elementNamePattern: '^g$',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
groupName: 'b',
|
|
148
|
+
elementNamePattern: '^b$',
|
|
149
|
+
},
|
|
150
|
+
],
|
|
142
151
|
useConfigurationIf: {
|
|
143
152
|
allNamesMatchPattern: '^r|g|b$',
|
|
144
153
|
},
|
|
@@ -165,13 +174,28 @@ export default defineConfig([
|
|
|
165
174
|
'error',
|
|
166
175
|
{
|
|
167
176
|
groups: ['language', 'files', 'plugins', 'extends', 'rules'],
|
|
168
|
-
customGroups:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
+
],
|
|
175
199
|
useConfigurationIf: {
|
|
176
200
|
callingFunctionNamePattern: '^defineConfig$',
|
|
177
201
|
},
|
package/package.json
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperupcall/eslint-config",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Edwin's ESLint configuration.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "
|
|
8
|
+
"url": "https://github.com/hyperupcall-projects/eslint-config"
|
|
9
9
|
},
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/
|
|
11
|
+
"url": "https://github.com/hyperupcall-projects/eslint-config/issues"
|
|
12
12
|
},
|
|
13
13
|
"author": "Edwin Kofler <edwin@kofler.dev> (https://edwinkofler.com)",
|
|
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": "^1.1.0",
|
|
22
|
+
"@eslint/markdown": "^7.5.1",
|
|
23
|
+
"@hyperupcall/eslint-config": "^1.2.0",
|
|
24
|
+
"eslint-config-prettier": "^10.1.8",
|
|
25
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
26
|
+
"eslint-plugin-mdx": "^3.7.0",
|
|
27
|
+
"eslint-plugin-n": "^17.24.0",
|
|
28
|
+
"eslint-plugin-no-unsanitized": "^4.1.5",
|
|
29
|
+
"eslint-plugin-perfectionist": "^5.9.1",
|
|
30
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
31
|
+
"eslint-plugin-regexp": "^3.1.0",
|
|
32
|
+
"eslint-plugin-security": "^4.0.0",
|
|
33
|
+
"eslint-plugin-unicorn": "^63.0.0",
|
|
35
34
|
"globals": "^17.0.0"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
|
-
"@hyperupcall/scripts-nodejs": "0.
|
|
37
|
+
"@hyperupcall/scripts-nodejs": "0.9.0",
|
|
39
38
|
"@types/node": "^25.0.6",
|
|
40
39
|
"typescript": "^5.9.3"
|
|
41
40
|
},
|
|
@@ -44,9 +43,8 @@
|
|
|
44
43
|
},
|
|
45
44
|
"prettier": "@hyperupcall/scripts-nodejs/config-prettier.js",
|
|
46
45
|
"scripts": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"lint": "eslint ."
|
|
46
|
+
"format": "hyperupcall-scripts-nodejs format",
|
|
47
|
+
"lint": "hyperupcall-scripts-nodejs lint",
|
|
48
|
+
"typecheck": "tsc --project ./tsconfig.json"
|
|
51
49
|
}
|
|
52
50
|
}
|
package/pnpm-workspace.yaml
CHANGED
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
|
-
}
|