@hyperupcall/eslint-config 1.4.0 → 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 +2 -2
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperupcall/eslint-config",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Edwin's ESLint configuration.",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
|
-
"output"
|
|
23
|
+
"output/*"
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@eslint-community/eslint-plugin-eslint-comments": ">=4.0.0",
|