@nemigo/configs 2.1.2 → 2.2.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.
@@ -3,6 +3,7 @@ import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/comp
3
3
  import jslint from "@eslint/js";
4
4
  import { defineConfig } from "eslint/config";
5
5
  import { configs as svelteConfigs } from "eslint-plugin-svelte";
6
+ import unicorn from "eslint-plugin-unicorn";
6
7
  import globals from "globals";
7
8
  import tslint from "typescript-eslint";
8
9
  export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
@@ -46,8 +47,7 @@ export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePatt
46
47
  */
47
48
  export const defineEslintConfig = (options, ...rest) => {
48
49
  const acc = [];
49
- acc.push(includeIgnoreFile(options?.ignore || join(import.meta.dirname, "../../.eslint.ignore"), "@nemigo/configs/.eslint.ignore"));
50
- acc.push(jslint.configs.recommended);
50
+ acc.push(includeIgnoreFile(options?.ignore || join(import.meta.dirname, "../../.eslint.ignore"), "@nemigo/configs/.eslint.ignore"), jslint.configs.all);
51
51
  if (options?.strict) {
52
52
  if (options.service) {
53
53
  acc.push(tslint.configs.strictTypeChecked);
@@ -56,13 +56,11 @@ export const defineEslintConfig = (options, ...rest) => {
56
56
  acc.push(tslint.configs.strict);
57
57
  }
58
58
  }
59
+ else if (options?.service) {
60
+ acc.push(tslint.configs.recommendedTypeChecked);
61
+ }
59
62
  else {
60
- if (options?.service) {
61
- acc.push(tslint.configs.recommendedTypeChecked);
62
- }
63
- else {
64
- acc.push(tslint.configs.recommended);
65
- }
63
+ acc.push(tslint.configs.recommended);
66
64
  }
67
65
  if (options?.service) {
68
66
  acc.push({
@@ -75,8 +73,7 @@ export const defineEslintConfig = (options, ...rest) => {
75
73
  });
76
74
  }
77
75
  if (options?.svelte) {
78
- acc.push(svelteConfigs["flat/recommended"]);
79
- acc.push({
76
+ acc.push(svelteConfigs["flat/recommended"], {
80
77
  files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
81
78
  languageOptions: {
82
79
  parserOptions: {
@@ -93,7 +90,7 @@ export const defineEslintConfig = (options, ...rest) => {
93
90
  },
94
91
  });
95
92
  }
96
- acc.push({
93
+ acc.push(unicorn.configs.all, {
97
94
  languageOptions: {
98
95
  globals: {
99
96
  ...globals.browser,
@@ -101,24 +98,61 @@ export const defineEslintConfig = (options, ...rest) => {
101
98
  },
102
99
  },
103
100
  rules: {
104
- "@typescript-eslint/no-confusing-void-expression": 0,
105
- "@typescript-eslint/no-duplicate-type-constituents": 0,
106
- "@typescript-eslint/no-dynamic-delete": 0,
107
- "@typescript-eslint/no-empty-object-type": 0,
108
- "@typescript-eslint/no-explicit-any": 0,
101
+ // Вызов неоднозначных any-функций
102
+ "@typescript-eslint/no-unsafe-call": 0,
103
+ // Несколько return у функции
104
+ "consistent-return": 0,
105
+ // Присвоения any значения
106
+ "@typescript-eslint/no-unsafe-assignment": 0,
107
+ // Использование void, вместо undefined в некоторых контекстах
109
108
  "@typescript-eslint/no-invalid-void-type": 0,
110
- "@typescript-eslint/no-non-null-asserted-optional-chain": 0,
111
- "@typescript-eslint/no-non-null-assertion": 0,
112
- "@typescript-eslint/no-redundant-type-constituents": 0,
113
- "@typescript-eslint/no-this-alias": 0,
114
- "@typescript-eslint/no-unnecessary-type-parameters": 0,
109
+ // Передача any значений в функции
115
110
  "@typescript-eslint/no-unsafe-argument": 0,
116
- "@typescript-eslint/no-unsafe-assignment": 0,
117
- "@typescript-eslint/no-unsafe-call": 0,
118
- "@typescript-eslint/no-unsafe-function-type": 0,
119
- "@typescript-eslint/no-unsafe-member-access": 0,
111
+ // Без ограничений на операции внутри
112
+ "max-statements": 0,
113
+ // Использование obj!.property (!)
114
+ "@typescript-eslint/no-non-null-assertion": 0,
115
+ // Использование запятой
116
+ "no-sequences": 0,
117
+ // Методы в классе не использующие this
118
+ "class-methods-use-this": 0,
119
+ // Возвращение any из функций
120
120
  "@typescript-eslint/no-unsafe-return": 0,
121
- "@typescript-eslint/no-unused-expressions": 0,
121
+ // Доступ к свойствам объектов с any типами
122
+ "@typescript-eslint/no-unsafe-member-access": 0,
123
+ // Символы подчеркивания в начале/конце идентификаторов (__private)
124
+ "no-underscore-dangle": 0,
125
+ // Неявное приведение типов (!!value)
126
+ "no-implicit-coercion": 0,
127
+ // Переимпорт
128
+ "no-import-assign": 0,
129
+ // Без проверок hasOwnProperty для for in
130
+ "guard-for-in": 0,
131
+ // Без ограничений на количество аргументов у функций
132
+ "max-params": 0,
133
+ // Использование мета-типизации
134
+ "@typescript-eslint/no-unnecessary-type-parameters": 0,
135
+ // Без ограничений на длину названий идентификаторов
136
+ "id-length": 0,
137
+ // Использование внутри функций идентификаторов объявленных уже после
138
+ "no-use-before-define": 0,
139
+ // Без приоритета у деструктуризации
140
+ "prefer-destructuring": 0,
141
+ // Без ограничений на числовые идентификаторы
142
+ "no-magic-numbers": 0,
143
+ // Без ограничений на "сложность"
144
+ complexity: 0,
145
+ // Без ограничений на вложенность
146
+ "max-depth": 0,
147
+ // Без ограничений на длину функции
148
+ "max-lines-per-function": 0,
149
+ // Без ограничений на длину файла
150
+ "max-lines": 0,
151
+ // Использование значений в шаблонных строках без String(value)
152
+ "@typescript-eslint/restrict-template-expressions": 0,
153
+ // Без фигурных скобок везде
154
+ curly: 0,
155
+ // Игнорирование _unused идентификаторов
122
156
  "@typescript-eslint/no-unused-vars": [
123
157
  "error",
124
158
  {
@@ -131,11 +165,108 @@ export const defineEslintConfig = (options, ...rest) => {
131
165
  ignoreRestSiblings: true,
132
166
  },
133
167
  ],
134
- "@typescript-eslint/restrict-plus-operands": 0,
135
- "@typescript-eslint/restrict-template-expressions": 0,
136
- "no-import-assign": 0,
168
+ // Объявления без инициализирующих значений
169
+ "init-declarations": 0,
170
+ // Использование нескольких импортов из одного источника
171
+ "no-duplicate-imports": 0,
172
+ // Использование {} типа
173
+ "@typescript-eslint/no-empty-object-type": 0,
174
+ // Использование any
175
+ "@typescript-eslint/no-explicit-any": 0,
176
+ // Любой регистр у начала комментария
177
+ "capitalized-comments": 0,
178
+ // Сохранение this в идентификатор
179
+ "@typescript-eslint/no-this-alias": 0,
180
+ // switch без default
181
+ "default-case": 0,
182
+ // Использование delete
183
+ "@typescript-eslint/no-dynamic-delete": 0,
184
+ // Использование не только camelCase
185
+ camelcase: 0,
186
+ // Использование undefined
187
+ "no-undefined": 0,
188
+ // Использование тернаров
189
+ "no-ternary": 0,
190
+ // Использование continue
191
+ "no-continue": 0,
192
+ // Битовые операции
193
+ "no-bitwise": 0,
194
+ // Вложенные тернары
195
+ "no-nested-ternary": 0,
196
+ // Инлайн-комменты
197
+ "no-inline-comments": 0,
198
+ // Использование value++
199
+ "no-plusplus": 0,
200
+ // Использование void
201
+ "no-void": 0,
202
+ // Не нужно объединять несколько объявлений в один const|let
203
+ "one-var": 0,
204
+ // Импорты не по алфавиту (используется сортировка от биома)
205
+ "sort-imports": 0,
206
+ // Ключи объектов не в алфавитном порядке
207
+ "sort-keys": 0,
208
+ // Создание Symbol без описания
209
+ "symbol-description": 0,
210
+ // Дублирующиеся или избыточные типы (например, 0 | TimeStamp)
211
+ "@typescript-eslint/no-duplicate-type-constituents": 0,
212
+ "@typescript-eslint/no-redundant-type-constituents": 0,
213
+ // Странный приоритет у string.replaceAll() над string.replace()
214
+ "unicorn/prefer-string-replace-all": 0,
215
+ // Фоллбэк {} для объектов при деструктуризация
216
+ "unicorn/no-useless-fallback-in-spread": 0,
217
+ // Любой регистр у числовых идентификаторов
218
+ "unicorn/number-literal-case": 0,
219
+ // Приоритет деструктуризации у массивов для создания вместо Array.from()
220
+ "unicorn/prefer-spread": 0,
221
+ // Приоритет у globalThis
222
+ "unicorn/prefer-global-this": 0,
223
+ // Мутации объектов
224
+ "unicorn/no-immediate-mutation": 0,
225
+ // Объект как значение аргумента по умолчанию
226
+ "unicorn/no-object-as-default-parameter": 0,
227
+ // Использование null
228
+ "unicorn/no-null": 0,
229
+ // Вложенные тернары
230
+ "unicorn/no-nested-ternary": 0,
231
+ // Использование document.cookie
232
+ "unicorn/no-document-cookie": 0,
233
+ // Использование array.reduce
234
+ "unicorn/no-array-reduce": 0,
235
+ // Использование array.reverse
236
+ "unicorn/no-array-reverse": 0,
237
+ // Использование array.sort
238
+ "unicorn/no-array-sort": 0,
239
+ // Приоритет у array.at(index)
240
+ "unicorn/prefer-at": 0,
241
+ // Передача функций в методы массивов
242
+ "unicorn/no-array-callback-reference": 0,
243
+ // Свободный стиль наименования файлов
244
+ "unicorn/filename-case": 0,
245
+ // Возможность экпорта из импортов
246
+ "unicorn/prefer-export-from": 0,
247
+ // Без фигурных скобок у case
248
+ "unicorn/switch-case-braces": 0,
249
+ // Без приоритета у structuredClone
250
+ "unicorn/prefer-structured-clone": 0,
251
+ // Использование for i
252
+ "unicorn/no-for-loop": 0,
253
+ // export {}
254
+ "unicorn/require-module-specifiers": 0,
255
+ // Стили наименований
256
+ "unicorn/prevent-abbreviations": 0,
257
+ "unicorn/no-keyword-prefix": 0,
258
+ "unicorn/import-style": [
259
+ "error",
260
+ {
261
+ styles: {
262
+ "node:path": {
263
+ named: true,
264
+ default: false,
265
+ },
266
+ },
267
+ },
268
+ ],
137
269
  },
138
- });
139
- acc.push(...rest);
270
+ }, ...rest);
140
271
  return defineConfig(acc);
141
272
  };
@@ -8,6 +8,6 @@ export interface ConfigWithExtends extends ConfigObject {
8
8
  /**
9
9
  * Массив конфигов для {@link defineConfig} из {@link https://www.npmjs.com/package/eslint/config eslint/config}
10
10
  *
11
- * @remarks Взято из {@link https://www.npmjs.com/package/@eslint/config-helpers @eslint/config-helpers/types (0.4.2)}, т.к. этот тип не экспортируется
11
+ * @author Взято из {@link https://www.npmjs.com/package/@eslint/config-helpers @eslint/config-helpers/types (0.4.2)}, т.к. этот тип не экспортируется
12
12
  */
13
13
  export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];
@@ -1,3 +1,4 @@
1
+ // oxlint-disable import/no-namespace
1
2
  import { format } from "prettier";
2
3
  import * as css from "prettier-plugin-css-order";
3
4
  import * as arrays from "prettier-plugin-multiline-arrays";
@@ -69,7 +69,13 @@ export const defineSvelteConfig = (options) => ({
69
69
  skipLibCheck: true,
70
70
  disableSizeLimit: true,
71
71
  };
72
- config.exclude = setifyArray([...getOptionalArray(config.exclude), "../**/trash/**", "../**/drafts/**", ...(options.exclude ?? [])]);
72
+ // biome-ignore format : ухудшение читаемости
73
+ config.exclude = setifyArray([
74
+ ...getOptionalArray(config.exclude),
75
+ "../**/trash/**",
76
+ "../**/drafts/**",
77
+ ...(options.exclude ?? [])
78
+ ]);
73
79
  config.include = setifyArray([
74
80
  ...getOptionalArray(config.include),
75
81
  "../scripts",
@@ -1,3 +1,4 @@
1
+ const pad = (v) => v.toString().padStart(2, "0");
1
2
  /**
2
3
  * Создание конфигурации для проксирования запросов из {@link https://vite.dev Vite}
3
4
  *
@@ -16,12 +17,13 @@
16
17
  * @see https://vite.dev/config/server-options.html#server-proxy
17
18
  */
18
19
  export const defineViteProxyConfig = (options) => {
19
- const pad = (v) => v.toString().padStart(2, "0");
20
20
  const now = new Date();
21
21
  const hours = pad(now.getHours());
22
22
  const mins = pad(now.getMinutes());
23
23
  const secs = pad(now.getSeconds());
24
- const PROXY = "\x1b[1m\x1b[96m[PROXY]\x1b[0m\x1b[22m";
24
+ const PROXY = "\u001B[1m\u001B[96m[PROXY]\u001B[0m\u001B[22m";
25
+ // oxlint-disable-next-line no-console
26
+ // eslint-disable-next-line no-console
25
27
  console.log(`${hours}:${mins}:${secs} ${PROXY} ${options.domain} \n`);
26
28
  return {
27
29
  [options.prefix]: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nemigo/configs",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "private": false,
5
5
  "author": {
6
6
  "name": "Vlad Logvin",
@@ -11,11 +11,9 @@
11
11
  "build": "bunx --bun svelte-package && bunx --bun rimraf .svelte-kit",
12
12
  "check": "bunx --bun tsc --noemit",
13
13
  "eslint": "bunx --bun eslint ./",
14
- "eslint:fix": "bunx --bun eslint --fix ./",
15
- "lint": "biome lint",
16
- "lint:fix": "biome lint --fix --unsafe",
17
- "lint:fix:unsafe": "biome lint --fix --unsafe",
18
- "format": "biome check --write --linter-enabled=false"
14
+ "oxlint": "bunx --bun oxlint --config .././../oxlintrc.jsonc --ignore-path ./.eslint.ignore ./",
15
+ "bilint": "bunx --bun biome lint",
16
+ "format": "bunx --bun biome check --write --linter-enabled=false"
19
17
  },
20
18
  "files": [
21
19
  "dist",
@@ -88,6 +86,7 @@
88
86
  "@eslint/js": "9.39.1",
89
87
  "@types/eslint": "9.6.1",
90
88
  "eslint-plugin-svelte": "3.13.0",
89
+ "eslint-plugin-unicorn": "62.0.0",
91
90
  "globals": "16.5.0",
92
91
  "prettier-plugin-css-order": "2.1.2",
93
92
  "prettier-plugin-multiline-arrays": "4.0.3",