@hyperupcall/eslint-config 1.4.1 → 2.0.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.mjs DELETED
@@ -1,144 +0,0 @@
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 };