@nemigo/configs 2.1.2 → 2.2.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.
@@ -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: {
@@ -87,13 +84,14 @@ export const defineEslintConfig = (options, ...rest) => {
87
84
  },
88
85
  },
89
86
  rules: {
87
+ "@typescript-eslint/no-unused-expressions": 0,
90
88
  "svelte/no-at-html-tags": 0,
91
89
  "svelte/no-navigation-without-resolve": 0,
92
90
  "svelte/prefer-svelte-reactivity": 0,
93
91
  },
94
92
  });
95
93
  }
96
- acc.push({
94
+ acc.push(unicorn.configs.all, {
97
95
  languageOptions: {
98
96
  globals: {
99
97
  ...globals.browser,
@@ -101,24 +99,61 @@ export const defineEslintConfig = (options, ...rest) => {
101
99
  },
102
100
  },
103
101
  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,
102
+ // Вызов неоднозначных any-функций
103
+ "@typescript-eslint/no-unsafe-call": 0,
104
+ // Несколько return у функции
105
+ "consistent-return": 0,
106
+ // Присвоения any значения
107
+ "@typescript-eslint/no-unsafe-assignment": 0,
108
+ // Использование void, вместо undefined в некоторых контекстах
109
109
  "@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,
110
+ // Передача any значений в функции
115
111
  "@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,
112
+ // Без ограничений на операции внутри
113
+ "max-statements": 0,
114
+ // Использование obj!.property (!)
115
+ "@typescript-eslint/no-non-null-assertion": 0,
116
+ // Использование запятой
117
+ "no-sequences": 0,
118
+ // Методы в классе не использующие this
119
+ "class-methods-use-this": 0,
120
+ // Возвращение any из функций
120
121
  "@typescript-eslint/no-unsafe-return": 0,
121
- "@typescript-eslint/no-unused-expressions": 0,
122
+ // Доступ к свойствам объектов с any типами
123
+ "@typescript-eslint/no-unsafe-member-access": 0,
124
+ // Символы подчеркивания в начале/конце идентификаторов (__private)
125
+ "no-underscore-dangle": 0,
126
+ // Неявное приведение типов (!!value)
127
+ "no-implicit-coercion": 0,
128
+ // Переимпорт
129
+ "no-import-assign": 0,
130
+ // Без проверок hasOwnProperty для for in
131
+ "guard-for-in": 0,
132
+ // Без ограничений на количество аргументов у функций
133
+ "max-params": 0,
134
+ // Использование мета-типизации
135
+ "@typescript-eslint/no-unnecessary-type-parameters": 0,
136
+ // Без ограничений на длину названий идентификаторов
137
+ "id-length": 0,
138
+ // Использование внутри функций идентификаторов объявленных уже после
139
+ "no-use-before-define": 0,
140
+ // Без приоритета у деструктуризации
141
+ "prefer-destructuring": 0,
142
+ // Без ограничений на числовые идентификаторы
143
+ "no-magic-numbers": 0,
144
+ // Без ограничений на "сложность"
145
+ complexity: 0,
146
+ // Без ограничений на вложенность
147
+ "max-depth": 0,
148
+ // Без ограничений на длину функции
149
+ "max-lines-per-function": 0,
150
+ // Без ограничений на длину файла
151
+ "max-lines": 0,
152
+ // Использование значений в шаблонных строках без String(value)
153
+ "@typescript-eslint/restrict-template-expressions": 0,
154
+ // Без фигурных скобок везде
155
+ curly: 0,
156
+ // Игнорирование _unused идентификаторов
122
157
  "@typescript-eslint/no-unused-vars": [
123
158
  "error",
124
159
  {
@@ -131,11 +166,111 @@ export const defineEslintConfig = (options, ...rest) => {
131
166
  ignoreRestSiblings: true,
132
167
  },
133
168
  ],
134
- "@typescript-eslint/restrict-plus-operands": 0,
135
- "@typescript-eslint/restrict-template-expressions": 0,
136
- "no-import-assign": 0,
169
+ // Объявления без инициализирующих значений
170
+ "init-declarations": 0,
171
+ // Использование нескольких импортов из одного источника
172
+ "no-duplicate-imports": 0,
173
+ // Использование {} типа
174
+ "@typescript-eslint/no-empty-object-type": 0,
175
+ // Использование any
176
+ "@typescript-eslint/no-explicit-any": 0,
177
+ // Любой регистр у начала комментария
178
+ "capitalized-comments": 0,
179
+ // Сохранение this в идентификатор
180
+ "@typescript-eslint/no-this-alias": 0,
181
+ // switch без default
182
+ "default-case": 0,
183
+ // Использование delete
184
+ "@typescript-eslint/no-dynamic-delete": 0,
185
+ // Использование не только camelCase
186
+ camelcase: 0,
187
+ // Использование undefined
188
+ "no-undefined": 0,
189
+ // Использование тернаров
190
+ "no-ternary": 0,
191
+ // Использование continue
192
+ "no-continue": 0,
193
+ // Битовые операции
194
+ "no-bitwise": 0,
195
+ // Вложенные тернары
196
+ "no-nested-ternary": 0,
197
+ // Инлайн-комменты
198
+ "no-inline-comments": 0,
199
+ // Использование value++
200
+ "no-plusplus": 0,
201
+ // Использование void
202
+ "no-void": 0,
203
+ // Не нужно объединять несколько объявлений в один const|let
204
+ "one-var": 0,
205
+ // Импорты не по алфавиту (используется сортировка от биома)
206
+ "sort-imports": 0,
207
+ // Ключи объектов не в алфавитном порядке
208
+ "sort-keys": 0,
209
+ // Создание Symbol без описания
210
+ "symbol-description": 0,
211
+ // Дублирующиеся или избыточные типы (например, 0 | TimeStamp)
212
+ "@typescript-eslint/no-duplicate-type-constituents": 0,
213
+ "@typescript-eslint/no-redundant-type-constituents": 0,
214
+ // Сохранение this в идентификатор
215
+ "consistent-this": 0,
216
+ "unicorn/no-this-assignment": 0,
217
+ // Убираем странный приоритет у string.replaceAll() над string.replace()
218
+ "unicorn/prefer-string-replace-all": 0,
219
+ // Фоллбэк {} для объектов при деструктуризация
220
+ "unicorn/no-useless-fallback-in-spread": 0,
221
+ // Любой регистр у числовых идентификаторов
222
+ "unicorn/number-literal-case": 0,
223
+ // Приоритет деструктуризации у массивов для создания вместо Array.from()
224
+ "unicorn/prefer-spread": 0,
225
+ // Приоритет у globalThis
226
+ "unicorn/prefer-global-this": 0,
227
+ // Мутации объектов
228
+ "unicorn/no-immediate-mutation": 0,
229
+ // Объект как значение аргумента по умолчанию
230
+ "unicorn/no-object-as-default-parameter": 0,
231
+ // Использование null
232
+ "unicorn/no-null": 0,
233
+ // Вложенные тернары
234
+ "unicorn/no-nested-ternary": 0,
235
+ // Использование document.cookie
236
+ "unicorn/no-document-cookie": 0,
237
+ // Использование array.reduce
238
+ "unicorn/no-array-reduce": 0,
239
+ // Использование array.reverse
240
+ "unicorn/no-array-reverse": 0,
241
+ // Использование array.sort
242
+ "unicorn/no-array-sort": 0,
243
+ // Приоритет у array.at(index)
244
+ "unicorn/prefer-at": 0,
245
+ // Передача функций в методы массивов
246
+ "unicorn/no-array-callback-reference": 0,
247
+ // Свободный стиль наименования файлов
248
+ "unicorn/filename-case": 0,
249
+ // Возможность экпорта из импортов
250
+ "unicorn/prefer-export-from": 0,
251
+ // Без фигурных скобок у case
252
+ "unicorn/switch-case-braces": 0,
253
+ // Без приоритета у structuredClone
254
+ "unicorn/prefer-structured-clone": 0,
255
+ // Использование for i
256
+ "unicorn/no-for-loop": 0,
257
+ // export {}
258
+ "unicorn/require-module-specifiers": 0,
259
+ // Стили наименований
260
+ "unicorn/prevent-abbreviations": 0,
261
+ "unicorn/no-keyword-prefix": 0,
262
+ "unicorn/import-style": [
263
+ "error",
264
+ {
265
+ styles: {
266
+ "node:path": {
267
+ named: true,
268
+ default: false,
269
+ },
270
+ },
271
+ },
272
+ ],
137
273
  },
138
- });
139
- acc.push(...rest);
274
+ }, ...rest);
140
275
  return defineConfig(acc);
141
276
  };
@@ -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.1",
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",