@zalib/linter 2.0.5 → 2.0.8

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.
Files changed (2) hide show
  1. package/eslint/node-ts.js +60 -23
  2. package/package.json +11 -12
package/eslint/node-ts.js CHANGED
@@ -3,8 +3,7 @@
3
3
 
4
4
  const tsParser = require('@typescript-eslint/parser');
5
5
  const tsEslintPlugin = require('@typescript-eslint/eslint-plugin');
6
- const tsImportSortPlugin = require('eslint-plugin-simple-import-sort');
7
- const tsSortPlugin = require('eslint-plugin-typescript-sort');
6
+ const tsPerfectionistPlugin = require('eslint-plugin-perfectionist');
8
7
  const tsImportPlugin = require('eslint-plugin-import');
9
8
 
10
9
  function eslintMembersGroup(suffix) {
@@ -48,8 +47,7 @@ module.exports = ({ files, tsconfig } = {}) => [
48
47
  },
49
48
  plugins: {
50
49
  '@typescript-eslint': tsEslintPlugin,
51
- 'simple-import-sort': tsImportSortPlugin,
52
- 'typescript-sort': tsSortPlugin,
50
+ perfectionist: tsPerfectionistPlugin,
53
51
  import: tsImportPlugin,
54
52
  },
55
53
  settings: {
@@ -66,6 +64,7 @@ module.exports = ({ files, tsconfig } = {}) => [
66
64
  ...tsImportPlugin.configs.warnings.rules,
67
65
  ...tsImportPlugin.configs.typescript.rules,
68
66
 
67
+ // переопределения базовых правил плагинов
69
68
  '@typescript-eslint/await-thenable': 'warn',
70
69
  '@typescript-eslint/brace-style': 'off',
71
70
  /*
@@ -258,32 +257,70 @@ module.exports = ({ files, tsconfig } = {}) => [
258
257
  'import/order': 'off',
259
258
  'import/prefer-default-export': 'off',
260
259
  'max-classes-per-file': 'off',
261
- 'simple-import-sort/imports': [
260
+ // Сортировка enum (по имени или значению)
261
+ 'perfectionist/sort-enums': [
262
262
  'error',
263
263
  {
264
+ order: 'asc',
265
+ sortBy: 'name', // или 'value'
266
+ type: 'alphabetical',
267
+ },
268
+ ],
269
+ // Сортировка свойств в типах объектов
270
+ 'perfectionist/sort-object-types': [
271
+ 'error',
272
+ {
273
+ order: 'asc',
274
+ type: 'alphabetical',
275
+ },
276
+ ],
277
+ // Сортировка интерфейсов
278
+ 'perfectionist/sort-interfaces': [
279
+ 'error',
280
+ {
281
+ order: 'asc',
282
+ type: 'alphabetical',
283
+ },
284
+ ],
285
+ 'perfectionist/sort-imports': [
286
+ 'error',
287
+ {
288
+ type: 'alphabetical',
289
+ order: 'asc',
290
+ ignoreCase: true,
264
291
  groups: [
265
- // Side effect imports.
266
- ['^\\u0000'],
267
- // Packages.
268
- // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
269
- ['^@?\\w'],
270
- // Absolute imports and other imports such as Vue-style `@/foo`.
271
- // Anything not matched in another group.
272
- ['^'],
273
- // Relative imports.
274
- // Anything that starts with a dot.
275
- ['^\\.'],
276
- // Interfaces, typings
277
- ['^\\..*(\\/|\\.)(interface|types$|typings$)'],
278
- // Constants
279
- ['^\\..*(\\/|\\.)(constant|config)'],
292
+ 'side-effect', // Side effect imports
293
+ 'external', // Внешние пакеты (npm packages)
294
+ 'internal', // Абсолютные импорты (internalPattern)
295
+ [
296
+ 'parent', // Относительные импорты из родительских директорий
297
+ 'sibling', // Относительные импорты из той же директории
298
+ 'index', // Относительные импорты из текущей директории (index)
299
+ ],
300
+ {
301
+ // Кастомная - интерфейсы и типы
302
+ group: 'types-group',
303
+ selector: 'internal',
304
+ elementNamePattern: '.*(interface|types?|typings).*$',
305
+ type: 'alphabetical',
306
+ },
307
+ {
308
+ // Кастом - константы и конфиги
309
+ group: 'configs-group',
310
+ selector: 'internal',
311
+ elementNamePattern: '.*(constant|config).*$',
312
+ type: 'alphabetical',
313
+ },
280
314
  ],
315
+ // Настройка внутренних паттернов для алиасов
316
+ internalPattern: ['^@/', '^~/', '^src/'],
317
+ // Пустые строки между группами
318
+ newlinesBetween: 'always',
319
+ // Для type-импортов внутри групп
320
+ fallbackSort: { type: 'type-import-first' },
281
321
  },
282
322
  ],
283
323
  'sort-imports': 'off',
284
- 'typescript-sort/interface': 'error',
285
- 'typescript-sort/type': 'error',
286
- 'typescript-sort/enum': 'error',
287
324
  },
288
325
  },
289
326
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zalib/linter",
3
- "version": "2.0.5",
3
+ "version": "2.0.8",
4
4
  "description": "Linter configs",
5
5
  "author": "https://github.com/wsp-repo/",
6
6
  "license": "UNLICENSED",
@@ -29,17 +29,16 @@
29
29
  "test": "exit 0"
30
30
  },
31
31
  "dependencies": {
32
- "@typescript-eslint/eslint-plugin": "^8.32.1",
33
- "@typescript-eslint/parser": "^8.32.1",
34
- "eslint": "^9.27.0",
35
- "eslint-config-prettier": "^10.1.5",
36
- "eslint-import-resolver-typescript": "^4.3.5",
37
- "eslint-plugin-import": "^2.31.0",
38
- "eslint-plugin-jest": "^28.11.0",
39
- "eslint-plugin-prettier": "^5.4.0",
40
- "eslint-plugin-simple-import-sort": "^12.1.1",
41
- "eslint-plugin-typescript-sort": "^0.1.11",
42
- "prettier": "^3.5.3"
32
+ "@typescript-eslint/eslint-plugin": "^8.55.0",
33
+ "@typescript-eslint/parser": "^8.55.0",
34
+ "eslint": "^9.39.2",
35
+ "eslint-config-prettier": "^10.1.8",
36
+ "eslint-import-resolver-typescript": "^4.4.4",
37
+ "eslint-plugin-import": "^2.32.0",
38
+ "eslint-plugin-jest": "^29.14.0",
39
+ "eslint-plugin-perfectionist": "^5.5.0",
40
+ "eslint-plugin-prettier": "^5.5.5",
41
+ "prettier": "^3.8.1"
43
42
  },
44
43
  "prettier": "./prettier"
45
44
  }