@hyperupcall/eslint-config 1.0.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 +103 -0
- package/output/index.d.ts +2 -0
- package/output/index.mjs +101 -0
- package/package.json +26 -26
- package/eslint.config.js +0 -63
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
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('globals');
|
|
4
|
+
var config = require('eslint/config');
|
|
5
|
+
var langJs = require('@eslint/js');
|
|
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');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @import { RuleEntry } from '@eslint/config-helpers'
|
|
20
|
+
*/
|
|
21
|
+
// TODO: import-x
|
|
22
|
+
|
|
23
|
+
// const config = {
|
|
24
|
+
// "extends": [
|
|
25
|
+
// "plugin:import/recommended",
|
|
26
|
+
// "plugin:mdx/recommended",
|
|
27
|
+
// ],
|
|
28
|
+
// "env": {
|
|
29
|
+
// "shared-node-browser": true,
|
|
30
|
+
// "es2022": true
|
|
31
|
+
// },
|
|
32
|
+
// "parserOptions": {
|
|
33
|
+
// "ecmaVersion": 2022,
|
|
34
|
+
// "sourceType": "module"
|
|
35
|
+
// },
|
|
36
|
+
// "overrides": [
|
|
37
|
+
// {
|
|
38
|
+
// "files": ["*.cjs"],
|
|
39
|
+
// "env": {
|
|
40
|
+
// "commonjs": true
|
|
41
|
+
// },
|
|
42
|
+
// "parserOptions": {
|
|
43
|
+
// "sourceType": "script"
|
|
44
|
+
// }
|
|
45
|
+
// }
|
|
46
|
+
// ]
|
|
47
|
+
// }
|
|
48
|
+
|
|
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([
|
|
68
|
+
langJs.configs.recommended,
|
|
69
|
+
{
|
|
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
|
+
}
|
|
83
|
+
},
|
|
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
|
+
]);
|
|
102
|
+
|
|
103
|
+
module.exports = index;
|
package/output/index.mjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import 'globals';
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
3
|
+
import langJs from '@eslint/js';
|
|
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';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @import { RuleEntry } from '@eslint/config-helpers'
|
|
18
|
+
*/
|
|
19
|
+
// TODO: import-x
|
|
20
|
+
|
|
21
|
+
// const config = {
|
|
22
|
+
// "extends": [
|
|
23
|
+
// "plugin:import/recommended",
|
|
24
|
+
// "plugin:mdx/recommended",
|
|
25
|
+
// ],
|
|
26
|
+
// "env": {
|
|
27
|
+
// "shared-node-browser": true,
|
|
28
|
+
// "es2022": true
|
|
29
|
+
// },
|
|
30
|
+
// "parserOptions": {
|
|
31
|
+
// "ecmaVersion": 2022,
|
|
32
|
+
// "sourceType": "module"
|
|
33
|
+
// },
|
|
34
|
+
// "overrides": [
|
|
35
|
+
// {
|
|
36
|
+
// "files": ["*.cjs"],
|
|
37
|
+
// "env": {
|
|
38
|
+
// "commonjs": true
|
|
39
|
+
// },
|
|
40
|
+
// "parserOptions": {
|
|
41
|
+
// "sourceType": "script"
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
// ]
|
|
45
|
+
// }
|
|
46
|
+
|
|
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([
|
|
66
|
+
langJs.configs.recommended,
|
|
67
|
+
{
|
|
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
|
+
}
|
|
81
|
+
},
|
|
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": {
|
|
@@ -12,13 +12,20 @@
|
|
|
12
12
|
},
|
|
13
13
|
"author": "Edwin Kofler <edwin@kofler.dev> (https://edwinkofler.com)",
|
|
14
14
|
"license": "MPL-2.0",
|
|
15
|
-
"
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./output/index.mjs",
|
|
18
|
+
"require": "./output/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
16
21
|
"files": [
|
|
17
|
-
"
|
|
22
|
+
"output"
|
|
18
23
|
],
|
|
19
24
|
"peerDependencies": {
|
|
20
25
|
"@eslint-community/eslint-plugin-eslint-comments": ">=4.0.0",
|
|
26
|
+
"@eslint/css": "^0.5.0",
|
|
21
27
|
"@eslint/js": "^9.0.0",
|
|
28
|
+
"@eslint/json": "^0.11.0",
|
|
22
29
|
"eslint": "^9.0.0",
|
|
23
30
|
"eslint-config-prettier": ">=9.1.0",
|
|
24
31
|
"eslint-plugin-import": ">=2.29.0",
|
|
@@ -26,40 +33,33 @@
|
|
|
26
33
|
"eslint-plugin-mdx": ">=3.0.0",
|
|
27
34
|
"eslint-plugin-n": ">=17.0.0",
|
|
28
35
|
"eslint-plugin-no-unsanitized": ">=4.0.0",
|
|
29
|
-
"eslint-plugin-perfectionist": ">=
|
|
36
|
+
"eslint-plugin-perfectionist": ">=4.0.0",
|
|
30
37
|
"eslint-plugin-promise": ">=7.0.0",
|
|
31
38
|
"eslint-plugin-regexp": ">=2.0.0",
|
|
32
39
|
"eslint-plugin-security": ">=3.0.0",
|
|
33
40
|
"eslint-plugin-unicorn": ">=55.0.0"
|
|
34
41
|
},
|
|
35
42
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@eslint/js": "^9.9.0",
|
|
38
|
-
"@hyperupcall/eslint-config": "^0.11.0",
|
|
43
|
+
"@hyperupcall/eslint-config": "^1.2.0",
|
|
39
44
|
"@hyperupcall/markdownlint-config": "^0.3.2",
|
|
40
|
-
"@hyperupcall/prettier-config": "^0.
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"eslint-plugin-n": "^17.10.2",
|
|
48
|
-
"eslint-plugin-no-unsanitized": "^4.0.2",
|
|
49
|
-
"eslint-plugin-perfectionist": "^3.2.0",
|
|
50
|
-
"eslint-plugin-promise": "^7.1.0",
|
|
51
|
-
"eslint-plugin-regexp": "^2.6.0",
|
|
52
|
-
"eslint-plugin-security": "^3.0.1",
|
|
53
|
-
"eslint-plugin-unicorn": "^55.0.0",
|
|
54
|
-
"markdownlint": "^0.34.0",
|
|
55
|
-
"prettier": "^3.3.3",
|
|
56
|
-
"prettier-plugin-pkg": "^0.18.1"
|
|
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",
|
|
49
|
+
"prettier-plugin-pkg": "^0.18.1",
|
|
50
|
+
"rollup": "^4.36.0",
|
|
51
|
+
"typescript": "^5.8.2"
|
|
57
52
|
},
|
|
58
53
|
"dependencies": {
|
|
59
|
-
"globals": "^
|
|
54
|
+
"globals": "^16.0.0"
|
|
55
|
+
},
|
|
56
|
+
"markdownlint-cli2": {
|
|
57
|
+
"extends": "./node_modules/@hyperupcall/markdownlint-config/.markdownlint.json"
|
|
60
58
|
},
|
|
59
|
+
"private": false,
|
|
60
|
+
"prettier": "@hyperupcall/scripts-nodejs/config-prettier.js",
|
|
61
61
|
"scripts": {
|
|
62
|
-
"build": "
|
|
62
|
+
"build": "rm -rf ./output && rollup --config ./rollup.config.js && tsc --project ./tsconfig.json",
|
|
63
63
|
"format": "prettier --check .",
|
|
64
64
|
"lint": "eslint ."
|
|
65
65
|
}
|
package/eslint.config.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import globals from 'globals'
|
|
2
|
-
import langJs from "@eslint/js";
|
|
3
|
-
import langMarkdown from "@eslint/markdown";
|
|
4
|
-
import langMdx from 'eslint-plugin-mdx'
|
|
5
|
-
import pluginPromise from 'eslint-plugin-promise'
|
|
6
|
-
import pluginNode from "eslint-plugin-n"
|
|
7
|
-
import pluginSecurity from 'eslint-plugin-security'
|
|
8
|
-
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments/configs"
|
|
9
|
-
import pluginUnicorn from 'eslint-plugin-unicorn';
|
|
10
|
-
import pluginRegexp from "eslint-plugin-regexp"
|
|
11
|
-
import pluginNoUnsanitized from "eslint-plugin-no-unsanitized";
|
|
12
|
-
import pluginPerfectionist from 'eslint-plugin-perfectionist'
|
|
13
|
-
import configPrettier from "eslint-config-prettier";
|
|
14
|
-
|
|
15
|
-
// TODO: import-x
|
|
16
|
-
|
|
17
|
-
// const config = {
|
|
18
|
-
// "extends": [
|
|
19
|
-
// "plugin:import/recommended",
|
|
20
|
-
// "plugin:mdx/recommended",
|
|
21
|
-
// ],
|
|
22
|
-
// "env": {
|
|
23
|
-
// "shared-node-browser": true,
|
|
24
|
-
// "es2022": true
|
|
25
|
-
// },
|
|
26
|
-
// "parserOptions": {
|
|
27
|
-
// "ecmaVersion": 2022,
|
|
28
|
-
// "sourceType": "module"
|
|
29
|
-
// },
|
|
30
|
-
// "overrides": [
|
|
31
|
-
// {
|
|
32
|
-
// "files": ["*.cjs"],
|
|
33
|
-
// "env": {
|
|
34
|
-
// "commonjs": true
|
|
35
|
-
// },
|
|
36
|
-
// "parserOptions": {
|
|
37
|
-
// "sourceType": "script"
|
|
38
|
-
// }
|
|
39
|
-
// }
|
|
40
|
-
// ]
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
const config = [
|
|
44
|
-
langJs.configs.recommended,
|
|
45
|
-
...langMarkdown.configs.recommended,
|
|
46
|
-
{
|
|
47
|
-
...langMdx.flat,
|
|
48
|
-
processor: mdx.createRemarkProcessor({
|
|
49
|
-
lintCodeBlocks: true,
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
pluginPromise.configs['flat/recommended'],
|
|
53
|
-
pluginNode.configs["flat/recommended-script"],
|
|
54
|
-
pluginSecurity.configs.recommended,
|
|
55
|
-
pluginComments.recomended,
|
|
56
|
-
pluginUnicorn.configs['flat/recommended'],
|
|
57
|
-
pluginRegexp.configs["flat/recommended"],
|
|
58
|
-
pluginNoUnsanitized.configs.recommended,
|
|
59
|
-
pluginPerfectionist.configs['recommended-natural'],
|
|
60
|
-
configPrettier
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
export default config
|