@hyperupcall/eslint-config 1.2.0 → 1.3.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/README.md +2 -2
- package/output/index.cjs +66 -28
- package/output/index.d.ts +2 -2
- package/output/index.mjs +67 -29
- package/package.json +12 -24
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Edwin's [ESLint](https://eslint.org) configuration.
|
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
pnpm i -D \
|
|
9
|
-
eslint eslint-config-prettier @hyperupcall/eslint-config \
|
|
10
|
-
eslint-plugin-import eslint-plugin-
|
|
9
|
+
eslint @eslint/markdown @eslint/css @eslint/json eslint-config-prettier @hyperupcall/eslint-config \
|
|
10
|
+
eslint-plugin-import eslint-plugin-promise \
|
|
11
11
|
eslint-plugin-n eslint-plugin-unicorn eslint-plugin-security \
|
|
12
12
|
@eslint-community/eslint-plugin-eslint-comments eslint-plugin-regexp \
|
|
13
13
|
eslint-plugin-perfectionist eslint-plugin-no-unsanitized eslint-plugin-mdx
|
package/output/index.cjs
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('globals');
|
|
4
|
+
var config = require('eslint/config');
|
|
4
5
|
var langJs = require('@eslint/js');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
require('@eslint/markdown');
|
|
7
|
+
require('eslint-plugin-mdx');
|
|
8
|
+
require('eslint-plugin-promise');
|
|
9
|
+
require('eslint-plugin-n');
|
|
10
|
+
require('eslint-plugin-security');
|
|
11
|
+
require('@eslint-community/eslint-plugin-eslint-comments/configs');
|
|
12
|
+
require('eslint-plugin-unicorn');
|
|
13
|
+
require('eslint-plugin-regexp');
|
|
14
|
+
require('eslint-plugin-no-unsanitized');
|
|
15
|
+
require('eslint-plugin-perfectionist');
|
|
16
|
+
require('eslint-config-prettier');
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @import { RuleEntry } from '@eslint/config-helpers'
|
|
20
|
+
*/
|
|
17
21
|
// TODO: import-x
|
|
18
22
|
|
|
19
23
|
// const config = {
|
|
@@ -42,24 +46,58 @@ var configPrettier = require('eslint-config-prettier');
|
|
|
42
46
|
// ]
|
|
43
47
|
// }
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
// editing
|
|
50
|
+
// commit
|
|
51
|
+
// release
|
|
52
|
+
/** @returns {RuleEntry} */
|
|
53
|
+
function modeSwitch(/** @type {Record<'edit' | 'commit' | 'release', unknown | undefined>} */ toggles) {
|
|
54
|
+
const possibleModes = ['edit', 'commit', 'release'];
|
|
55
|
+
const currentMode = 'edit';
|
|
56
|
+
if (!possibleModes.includes(currentMode)) {
|
|
57
|
+
throw new Error(`Expected the current mode to be ${new Intl.ListFormat().format(possibleModes).map((/** @type {string} */ item) => `"${item}"`)}. Found "${currentMode}"`)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// if (currentMode === 'edit' && toggles.edit)
|
|
62
|
+
|
|
63
|
+
return toggles[currentMode]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
var index = config.defineConfig([
|
|
46
68
|
langJs.configs.recommended,
|
|
47
|
-
...langMarkdown.configs.recommended,
|
|
48
69
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
rules: {
|
|
71
|
+
'array-callback-return': modeSwitch({
|
|
72
|
+
edit: ['off'],
|
|
73
|
+
commit: ['error'],
|
|
74
|
+
release: ['error'],
|
|
75
|
+
}),
|
|
76
|
+
'constructor-super': modeSwitch({
|
|
77
|
+
edit: ['warn'],
|
|
78
|
+
commit: ['error'],
|
|
79
|
+
release: ['error']
|
|
80
|
+
}),
|
|
81
|
+
'for-direction': ['error'],
|
|
82
|
+
}
|
|
53
83
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
]
|
|
84
|
+
// langJs.meta.name.
|
|
85
|
+
// ...langMarkdown.configs.recommended,
|
|
86
|
+
// {
|
|
87
|
+
// ...langMdx.flat,
|
|
88
|
+
// processor: langMdx.createRemarkProcessor({
|
|
89
|
+
// lintCodeBlocks: true,
|
|
90
|
+
// }),
|
|
91
|
+
// },
|
|
92
|
+
// pluginPromise.configs['flat/recommended'],
|
|
93
|
+
// pluginNode.configs["flat/recommended-script"],
|
|
94
|
+
// pluginSecurity.configs.recommended,
|
|
95
|
+
// pluginComments.recomended,
|
|
96
|
+
// pluginUnicorn.configs['flat/recommended'],
|
|
97
|
+
// pluginRegexp.configs["flat/recommended"],
|
|
98
|
+
// pluginNoUnsanitized.configs.recommended,
|
|
99
|
+
// pluginPerfectionist.configs['recommended-natural'],
|
|
100
|
+
// configPrettier
|
|
101
|
+
]);
|
|
64
102
|
|
|
65
|
-
module.exports =
|
|
103
|
+
module.exports = index;
|
package/output/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare const _default: import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
|
|
2
|
+
export default _default;
|
package/output/index.mjs
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import 'globals';
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
2
3
|
import langJs from '@eslint/js';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
4
|
+
import '@eslint/markdown';
|
|
5
|
+
import 'eslint-plugin-mdx';
|
|
6
|
+
import 'eslint-plugin-promise';
|
|
7
|
+
import 'eslint-plugin-n';
|
|
8
|
+
import 'eslint-plugin-security';
|
|
9
|
+
import '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
10
|
+
import 'eslint-plugin-unicorn';
|
|
11
|
+
import 'eslint-plugin-regexp';
|
|
12
|
+
import 'eslint-plugin-no-unsanitized';
|
|
13
|
+
import 'eslint-plugin-perfectionist';
|
|
14
|
+
import 'eslint-config-prettier';
|
|
14
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @import { RuleEntry } from '@eslint/config-helpers'
|
|
18
|
+
*/
|
|
15
19
|
// TODO: import-x
|
|
16
20
|
|
|
17
21
|
// const config = {
|
|
@@ -40,24 +44,58 @@ import configPrettier from 'eslint-config-prettier';
|
|
|
40
44
|
// ]
|
|
41
45
|
// }
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
// editing
|
|
48
|
+
// commit
|
|
49
|
+
// release
|
|
50
|
+
/** @returns {RuleEntry} */
|
|
51
|
+
function modeSwitch(/** @type {Record<'edit' | 'commit' | 'release', unknown | undefined>} */ toggles) {
|
|
52
|
+
const possibleModes = ['edit', 'commit', 'release'];
|
|
53
|
+
const currentMode = 'edit';
|
|
54
|
+
if (!possibleModes.includes(currentMode)) {
|
|
55
|
+
throw new Error(`Expected the current mode to be ${new Intl.ListFormat().format(possibleModes).map((/** @type {string} */ item) => `"${item}"`)}. Found "${currentMode}"`)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// if (currentMode === 'edit' && toggles.edit)
|
|
60
|
+
|
|
61
|
+
return toggles[currentMode]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
var index = defineConfig([
|
|
44
66
|
langJs.configs.recommended,
|
|
45
|
-
...langMarkdown.configs.recommended,
|
|
46
67
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
68
|
+
rules: {
|
|
69
|
+
'array-callback-return': modeSwitch({
|
|
70
|
+
edit: ['off'],
|
|
71
|
+
commit: ['error'],
|
|
72
|
+
release: ['error'],
|
|
73
|
+
}),
|
|
74
|
+
'constructor-super': modeSwitch({
|
|
75
|
+
edit: ['warn'],
|
|
76
|
+
commit: ['error'],
|
|
77
|
+
release: ['error']
|
|
78
|
+
}),
|
|
79
|
+
'for-direction': ['error'],
|
|
80
|
+
}
|
|
51
81
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
// langJs.meta.name.
|
|
83
|
+
// ...langMarkdown.configs.recommended,
|
|
84
|
+
// {
|
|
85
|
+
// ...langMdx.flat,
|
|
86
|
+
// processor: langMdx.createRemarkProcessor({
|
|
87
|
+
// lintCodeBlocks: true,
|
|
88
|
+
// }),
|
|
89
|
+
// },
|
|
90
|
+
// pluginPromise.configs['flat/recommended'],
|
|
91
|
+
// pluginNode.configs["flat/recommended-script"],
|
|
92
|
+
// pluginSecurity.configs.recommended,
|
|
93
|
+
// pluginComments.recomended,
|
|
94
|
+
// pluginUnicorn.configs['flat/recommended'],
|
|
95
|
+
// pluginRegexp.configs["flat/recommended"],
|
|
96
|
+
// pluginNoUnsanitized.configs.recommended,
|
|
97
|
+
// pluginPerfectionist.configs['recommended-natural'],
|
|
98
|
+
// configPrettier
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
export { index as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperupcall/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Edwin's ESLint configuration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@eslint-community/eslint-plugin-eslint-comments": ">=4.0.0",
|
|
26
|
+
"@eslint/css": "^0.5.0",
|
|
26
27
|
"@eslint/js": "^9.0.0",
|
|
28
|
+
"@eslint/json": "^0.11.0",
|
|
27
29
|
"eslint": "^9.0.0",
|
|
28
30
|
"eslint-config-prettier": ">=9.1.0",
|
|
29
31
|
"eslint-plugin-import": ">=2.29.0",
|
|
@@ -31,39 +33,25 @@
|
|
|
31
33
|
"eslint-plugin-mdx": ">=3.0.0",
|
|
32
34
|
"eslint-plugin-n": ">=17.0.0",
|
|
33
35
|
"eslint-plugin-no-unsanitized": ">=4.0.0",
|
|
34
|
-
"eslint-plugin-perfectionist": ">=
|
|
36
|
+
"eslint-plugin-perfectionist": ">=4.0.0",
|
|
35
37
|
"eslint-plugin-promise": ">=7.0.0",
|
|
36
38
|
"eslint-plugin-regexp": ">=2.0.0",
|
|
37
39
|
"eslint-plugin-security": ">=3.0.0",
|
|
38
40
|
"eslint-plugin-unicorn": ">=55.0.0"
|
|
39
41
|
},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@eslint/js": "^9.9.0",
|
|
43
|
-
"@hyperupcall/eslint-config": "^0.11.0",
|
|
43
|
+
"@hyperupcall/eslint-config": "^1.2.0",
|
|
44
44
|
"@hyperupcall/markdownlint-config": "^0.3.2",
|
|
45
|
-
"@hyperupcall/prettier-config": "^0.
|
|
46
|
-
"@rollup/plugin-node-resolve": "^
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"eslint-plugin-import": "^2.29.1",
|
|
50
|
-
"eslint-plugin-markdown": "^5.1.0",
|
|
51
|
-
"eslint-plugin-mdx": "^3.1.5",
|
|
52
|
-
"eslint-plugin-n": "^17.10.2",
|
|
53
|
-
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
54
|
-
"eslint-plugin-perfectionist": "^3.2.0",
|
|
55
|
-
"eslint-plugin-promise": "^7.1.0",
|
|
56
|
-
"eslint-plugin-regexp": "^2.6.0",
|
|
57
|
-
"eslint-plugin-security": "^3.0.1",
|
|
58
|
-
"eslint-plugin-unicorn": "^55.0.0",
|
|
59
|
-
"markdownlint": "^0.34.0",
|
|
60
|
-
"prettier": "^3.3.3",
|
|
45
|
+
"@hyperupcall/prettier-config": "^0.9.1",
|
|
46
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
47
|
+
"markdownlint": "^0.37.4",
|
|
48
|
+
"prettier": "^3.5.3",
|
|
61
49
|
"prettier-plugin-pkg": "^0.18.1",
|
|
62
|
-
"rollup": "^4.
|
|
63
|
-
"typescript": "^5.
|
|
50
|
+
"rollup": "^4.36.0",
|
|
51
|
+
"typescript": "^5.8.2"
|
|
64
52
|
},
|
|
65
53
|
"dependencies": {
|
|
66
|
-
"globals": "^
|
|
54
|
+
"globals": "^16.0.0"
|
|
67
55
|
},
|
|
68
56
|
"markdownlint-cli2": {
|
|
69
57
|
"extends": "./node_modules/@hyperupcall/markdownlint-config/.markdownlint.json"
|