@hyperupcall/eslint-config 1.3.1 → 1.4.1
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/output/index.cjs +146 -0
- package/output/index.d.ts +2 -0
- package/output/index.mjs +144 -0
- package/package.json +14 -11
package/output/index.cjs
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('globals');
|
|
4
|
+
var config = require('eslint/config');
|
|
5
|
+
var langJs = require('@eslint/js');
|
|
6
|
+
var langMarkdown = require('@eslint/markdown');
|
|
7
|
+
var langCss = require('@eslint/css');
|
|
8
|
+
var langJson = require('@eslint/json');
|
|
9
|
+
var pluginPromise = require('eslint-plugin-promise');
|
|
10
|
+
var pluginNode = require('eslint-plugin-n');
|
|
11
|
+
var pluginSecurity = require('eslint-plugin-security');
|
|
12
|
+
var pluginComments = require('@eslint-community/eslint-plugin-eslint-comments/configs');
|
|
13
|
+
var pluginUnicorn = require('eslint-plugin-unicorn');
|
|
14
|
+
var pluginRegexp = require('eslint-plugin-regexp');
|
|
15
|
+
var pluginNoUnsanitized = require('eslint-plugin-no-unsanitized');
|
|
16
|
+
var pluginPerfectionist = require('eslint-plugin-perfectionist');
|
|
17
|
+
var configPrettier = require('eslint-config-prettier');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @import { RuleEntry } from '@eslint/config-helpers'
|
|
21
|
+
*/
|
|
22
|
+
// TODO: import-x
|
|
23
|
+
|
|
24
|
+
const CurrentMode = process.env.HYPERUPCALL_LINT_MODE || 'release';
|
|
25
|
+
|
|
26
|
+
var index = config.defineConfig([
|
|
27
|
+
// https://github.com/eslint/eslint/tree/main/packages/js
|
|
28
|
+
langJs.configs.recommended,
|
|
29
|
+
{
|
|
30
|
+
rules: {
|
|
31
|
+
'array-callback-return': modeSwitch({
|
|
32
|
+
edit: ['off'],
|
|
33
|
+
commit: ['error'],
|
|
34
|
+
release: ['error'],
|
|
35
|
+
}),
|
|
36
|
+
'constructor-super': modeSwitch({
|
|
37
|
+
edit: ['warn'],
|
|
38
|
+
commit: ['error'],
|
|
39
|
+
release: ['error'],
|
|
40
|
+
}),
|
|
41
|
+
'for-direction': ['error'],
|
|
42
|
+
'getter-return': modeSwitch({
|
|
43
|
+
edit: ['off'],
|
|
44
|
+
commit: ['error'],
|
|
45
|
+
release: ['error'],
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// https://github.com/eslint-community/eslint-plugin-promise
|
|
51
|
+
pluginPromise.configs['flat/recommended'],
|
|
52
|
+
|
|
53
|
+
// https://github.com/eslint-community/eslint-plugin-n
|
|
54
|
+
pluginNode.configs['flat/recommended-script'],
|
|
55
|
+
|
|
56
|
+
// https://github.com/eslint-community/eslint-plugin-security
|
|
57
|
+
pluginSecurity.configs.recommended,
|
|
58
|
+
|
|
59
|
+
// https://github.com/eslint-community/eslint-plugin-eslint-comments
|
|
60
|
+
pluginComments.recomended,
|
|
61
|
+
|
|
62
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
63
|
+
pluginUnicorn.configs['flat/recommended'],
|
|
64
|
+
|
|
65
|
+
// https://www.npmjs.com/package/eslint-plugin-regexp
|
|
66
|
+
pluginRegexp.configs['flat/recommended'],
|
|
67
|
+
|
|
68
|
+
// https://github.com/mozilla/eslint-plugin-no-unsanitized
|
|
69
|
+
pluginNoUnsanitized.configs.recommended,
|
|
70
|
+
|
|
71
|
+
// https://github.com/azat-io/eslint-plugin-perfectionist
|
|
72
|
+
pluginPerfectionist.configs['recommended-natural'],
|
|
73
|
+
|
|
74
|
+
// https://github.com/prettier/eslint-config-prettier
|
|
75
|
+
configPrettier,
|
|
76
|
+
|
|
77
|
+
// https://github.com/eslint/markdown
|
|
78
|
+
...langMarkdown.configs.recommended,
|
|
79
|
+
{
|
|
80
|
+
files: ['**/*.md'],
|
|
81
|
+
plugins: {
|
|
82
|
+
langMarkdown,
|
|
83
|
+
},
|
|
84
|
+
language: 'markdown/commonmark',
|
|
85
|
+
rules: {},
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
// https://github.com/mdx-js/eslint-mdx/tree/master/packages/eslint-plugin-mdx
|
|
89
|
+
// ...langMdx.flat,
|
|
90
|
+
// processor: langMdx.createRemarkProcessor({
|
|
91
|
+
// lintCodeBlocks: true,
|
|
92
|
+
// }),
|
|
93
|
+
// },
|
|
94
|
+
|
|
95
|
+
// https://github.com/eslint/css
|
|
96
|
+
{
|
|
97
|
+
files: ['**/*.css'],
|
|
98
|
+
language: 'css/css',
|
|
99
|
+
...langCss.configs.recommended,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
// https://github.com/eslint/json
|
|
103
|
+
{
|
|
104
|
+
plugins: {
|
|
105
|
+
langJson,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
files: ['**/*.json'],
|
|
110
|
+
ignores: ['package-lock.json'],
|
|
111
|
+
language: 'json/json',
|
|
112
|
+
...langJson.configs.recommended,
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
{
|
|
116
|
+
files: ['**/*.jsonc'],
|
|
117
|
+
language: 'json/jsonc',
|
|
118
|
+
...langJson.configs.recommended,
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
{
|
|
122
|
+
files: ['**/*.json5'],
|
|
123
|
+
language: 'json/json5',
|
|
124
|
+
...langJson.configs.recommended,
|
|
125
|
+
},
|
|
126
|
+
]);
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param {Record<'edit' | 'commit' | 'release', unknown | undefined>} toggles
|
|
130
|
+
* @returns {RuleEntry}
|
|
131
|
+
*/
|
|
132
|
+
function modeSwitch(toggles) {
|
|
133
|
+
const possibleModes = ['edit', 'commit', 'release'];
|
|
134
|
+
const currentMode = 'edit';
|
|
135
|
+
if (!possibleModes.includes(CurrentMode)) {
|
|
136
|
+
throw new Error(
|
|
137
|
+
`Expected the current mode to be ${new Intl.ListFormat().format(possibleModes).map((/** @type {string} */ item) => `"${item}"`)}. Found "${CurrentMode}"`,
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// if (currentMode === 'edit' && toggles.edit)
|
|
142
|
+
|
|
143
|
+
return /** @type RuleEntry */ (toggles[currentMode])
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
module.exports = index;
|
package/output/index.mjs
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import 'globals';
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
3
|
+
import langJs from '@eslint/js';
|
|
4
|
+
import langMarkdown from '@eslint/markdown';
|
|
5
|
+
import langCss from '@eslint/css';
|
|
6
|
+
import langJson from '@eslint/json';
|
|
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
|
+
var index = defineConfig([
|
|
25
|
+
// https://github.com/eslint/eslint/tree/main/packages/js
|
|
26
|
+
langJs.configs.recommended,
|
|
27
|
+
{
|
|
28
|
+
rules: {
|
|
29
|
+
'array-callback-return': modeSwitch({
|
|
30
|
+
edit: ['off'],
|
|
31
|
+
commit: ['error'],
|
|
32
|
+
release: ['error'],
|
|
33
|
+
}),
|
|
34
|
+
'constructor-super': modeSwitch({
|
|
35
|
+
edit: ['warn'],
|
|
36
|
+
commit: ['error'],
|
|
37
|
+
release: ['error'],
|
|
38
|
+
}),
|
|
39
|
+
'for-direction': ['error'],
|
|
40
|
+
'getter-return': modeSwitch({
|
|
41
|
+
edit: ['off'],
|
|
42
|
+
commit: ['error'],
|
|
43
|
+
release: ['error'],
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
// https://github.com/eslint-community/eslint-plugin-promise
|
|
49
|
+
pluginPromise.configs['flat/recommended'],
|
|
50
|
+
|
|
51
|
+
// https://github.com/eslint-community/eslint-plugin-n
|
|
52
|
+
pluginNode.configs['flat/recommended-script'],
|
|
53
|
+
|
|
54
|
+
// https://github.com/eslint-community/eslint-plugin-security
|
|
55
|
+
pluginSecurity.configs.recommended,
|
|
56
|
+
|
|
57
|
+
// https://github.com/eslint-community/eslint-plugin-eslint-comments
|
|
58
|
+
pluginComments.recomended,
|
|
59
|
+
|
|
60
|
+
// https://github.com/sindresorhus/eslint-plugin-unicorn
|
|
61
|
+
pluginUnicorn.configs['flat/recommended'],
|
|
62
|
+
|
|
63
|
+
// https://www.npmjs.com/package/eslint-plugin-regexp
|
|
64
|
+
pluginRegexp.configs['flat/recommended'],
|
|
65
|
+
|
|
66
|
+
// https://github.com/mozilla/eslint-plugin-no-unsanitized
|
|
67
|
+
pluginNoUnsanitized.configs.recommended,
|
|
68
|
+
|
|
69
|
+
// https://github.com/azat-io/eslint-plugin-perfectionist
|
|
70
|
+
pluginPerfectionist.configs['recommended-natural'],
|
|
71
|
+
|
|
72
|
+
// https://github.com/prettier/eslint-config-prettier
|
|
73
|
+
configPrettier,
|
|
74
|
+
|
|
75
|
+
// https://github.com/eslint/markdown
|
|
76
|
+
...langMarkdown.configs.recommended,
|
|
77
|
+
{
|
|
78
|
+
files: ['**/*.md'],
|
|
79
|
+
plugins: {
|
|
80
|
+
langMarkdown,
|
|
81
|
+
},
|
|
82
|
+
language: 'markdown/commonmark',
|
|
83
|
+
rules: {},
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
// https://github.com/mdx-js/eslint-mdx/tree/master/packages/eslint-plugin-mdx
|
|
87
|
+
// ...langMdx.flat,
|
|
88
|
+
// processor: langMdx.createRemarkProcessor({
|
|
89
|
+
// lintCodeBlocks: true,
|
|
90
|
+
// }),
|
|
91
|
+
// },
|
|
92
|
+
|
|
93
|
+
// https://github.com/eslint/css
|
|
94
|
+
{
|
|
95
|
+
files: ['**/*.css'],
|
|
96
|
+
language: 'css/css',
|
|
97
|
+
...langCss.configs.recommended,
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
// https://github.com/eslint/json
|
|
101
|
+
{
|
|
102
|
+
plugins: {
|
|
103
|
+
langJson,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
files: ['**/*.json'],
|
|
108
|
+
ignores: ['package-lock.json'],
|
|
109
|
+
language: 'json/json',
|
|
110
|
+
...langJson.configs.recommended,
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
files: ['**/*.jsonc'],
|
|
115
|
+
language: 'json/jsonc',
|
|
116
|
+
...langJson.configs.recommended,
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
{
|
|
120
|
+
files: ['**/*.json5'],
|
|
121
|
+
language: 'json/json5',
|
|
122
|
+
...langJson.configs.recommended,
|
|
123
|
+
},
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @param {Record<'edit' | 'commit' | 'release', unknown | undefined>} toggles
|
|
128
|
+
* @returns {RuleEntry}
|
|
129
|
+
*/
|
|
130
|
+
function modeSwitch(toggles) {
|
|
131
|
+
const possibleModes = ['edit', 'commit', 'release'];
|
|
132
|
+
const currentMode = 'edit';
|
|
133
|
+
if (!possibleModes.includes(CurrentMode)) {
|
|
134
|
+
throw new Error(
|
|
135
|
+
`Expected the current mode to be ${new Intl.ListFormat().format(possibleModes).map((/** @type {string} */ item) => `"${item}"`)}. Found "${CurrentMode}"`,
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// if (currentMode === 'edit' && toggles.edit)
|
|
140
|
+
|
|
141
|
+
return /** @type RuleEntry */ (toggles[currentMode])
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { index as default };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperupcall/eslint-config",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Edwin's ESLint configuration.",
|
|
3
|
+
"version": "1.4.1",
|
|
5
4
|
"type": "module",
|
|
5
|
+
"description": "Edwin's ESLint configuration.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/fox-land/eslint-config-hyperupcall.git"
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"author": "Edwin Kofler <edwin@kofler.dev> (https://edwinkofler.com)",
|
|
14
14
|
"license": "MPL-2.0",
|
|
15
|
+
"private": false,
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
17
18
|
"import": "./output/index.mjs",
|
|
@@ -19,16 +20,17 @@
|
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
"files": [
|
|
22
|
-
"output"
|
|
23
|
+
"output/*"
|
|
23
24
|
],
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"@eslint-community/eslint-plugin-eslint-comments": ">=4.0.0",
|
|
26
|
-
"@eslint/css": "
|
|
27
|
-
"@eslint/js": "
|
|
28
|
-
"@eslint/json": "
|
|
27
|
+
"@eslint/css": ">=0.5.0",
|
|
28
|
+
"@eslint/js": ">=9.0.0",
|
|
29
|
+
"@eslint/json": ">=0.11.0",
|
|
30
|
+
"@eslint/markdown": ">=6.0.0",
|
|
29
31
|
"eslint": "^9.0.0",
|
|
30
32
|
"eslint-config-prettier": ">=9.1.0",
|
|
31
|
-
"eslint-plugin-import": ">=
|
|
33
|
+
"eslint-plugin-import-x": ">=4.0.0",
|
|
32
34
|
"eslint-plugin-markdown": ">=5.0.0",
|
|
33
35
|
"eslint-plugin-mdx": ">=3.0.0",
|
|
34
36
|
"eslint-plugin-n": ">=17.0.0",
|
|
@@ -39,25 +41,26 @@
|
|
|
39
41
|
"eslint-plugin-security": ">=3.0.0",
|
|
40
42
|
"eslint-plugin-unicorn": ">=55.0.0"
|
|
41
43
|
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"globals": "^16.0.0"
|
|
46
|
+
},
|
|
42
47
|
"devDependencies": {
|
|
48
|
+
"@eslint/markdown": "^6.4.0",
|
|
43
49
|
"@hyperupcall/eslint-config": "^1.2.0",
|
|
44
50
|
"@hyperupcall/markdownlint-config": "^0.3.2",
|
|
45
51
|
"@hyperupcall/prettier-config": "^0.9.1",
|
|
46
52
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
47
53
|
"@types/node": "^22.15.17",
|
|
54
|
+
"eslint-plugin-import-x": "^4.11.1",
|
|
48
55
|
"markdownlint": "^0.37.4",
|
|
49
56
|
"prettier": "^3.5.3",
|
|
50
57
|
"prettier-plugin-pkg": "^0.18.1",
|
|
51
58
|
"rollup": "^4.36.0",
|
|
52
59
|
"typescript": "^5.8.2"
|
|
53
60
|
},
|
|
54
|
-
"dependencies": {
|
|
55
|
-
"globals": "^16.0.0"
|
|
56
|
-
},
|
|
57
61
|
"markdownlint-cli2": {
|
|
58
62
|
"extends": "./node_modules/@hyperupcall/markdownlint-config/.markdownlint.json"
|
|
59
63
|
},
|
|
60
|
-
"private": false,
|
|
61
64
|
"prettier": "@hyperupcall/prettier-config",
|
|
62
65
|
"scripts": {
|
|
63
66
|
"build": "rm -rf ./output && rollup --config ./rollup.config.js && tsc --project ./tsconfig.json",
|