@front-cmdt/format 1.1.0 → 1.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.
package/README.md CHANGED
@@ -16,7 +16,7 @@ yarn add -D @front-cmdt/format prettier
16
16
  pnpm add -D @front-cmdt/format prettier
17
17
  ```
18
18
 
19
- ### Создайте: `prettier.js` в проекте
19
+ ### Создайте: `prettier.config.js` в проекте
20
20
 
21
21
  ```js
22
22
  import config from "@front-cmdt/format/prettier"
@@ -57,7 +57,7 @@ yarn add -D @front-cmdt/format prettier
57
57
  pnpm add -D @front-cmdt/format prettier
58
58
  ```
59
59
 
60
- ### Create: `prettier.js` in your project
60
+ ### Create: `prettier.config.js` in your project
61
61
 
62
62
  ```js
63
63
  import config from "@front-cmdt/format/prettier"
package/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
2
  "name": "@front-cmdt/format",
3
- "version": "1.1.0",
4
- "keywords": [],
3
+ "version": "1.2.1",
4
+ "keywords": [
5
+ "prettier",
6
+ "trivago",
7
+ "prettier-plugin-sort-imports",
8
+ "lint",
9
+ "linting",
10
+ "format",
11
+ "formatting",
12
+ "code style",
13
+ "code formatting",
14
+ "code styling"
15
+ ],
5
16
  "type": "module",
6
17
  "publishConfig": {
7
18
  "access": "public"
@@ -11,7 +22,8 @@
11
22
  "prettier": "^3.0.0"
12
23
  },
13
24
  "dependencies": {
14
- "@trivago/prettier-plugin-sort-imports": "^5.2.2"
25
+ "@trivago/prettier-plugin-sort-imports": "^5.2.2",
26
+ "prettier-plugin-astro": "^0.14.1"
15
27
  },
16
28
  "scripts": {
17
29
  "release:patch": "npm version patch -m \"release: v%s\" && git push --follow-tags",
@@ -1,20 +1,65 @@
1
1
  /** @type {import("prettier").Config} */
2
2
 
3
3
  export default {
4
- trailingComma: 'none',
5
- tabWidth: 2,
6
- useTabs: true,
7
- semi: false,
8
- singleQuote: true,
9
- jsxSingleQuote: true,
10
- arrowParens: 'avoid',
11
- printWidth: 120,
4
+ // Запятые в конце: "none" - без запятых, "es5" - где допустимо в ES5, "all" - везде
5
+ trailingComma: "none",
6
+ // Количество пробелов для отступа
7
+ tabWidth: 2,
8
+ // Использовать табы вместо пробелов
9
+ useTabs: false,
10
+ // Добавлять точку с запятой в конце выражений
11
+ semi: false,
12
+ // Использовать одинарные кавычки вместо двойных
13
+ singleQuote: true,
14
+ // Одинарные кавычки в JSX
15
+ jsSingleQuote: true,
16
+ // Скобки вокруг единственного параметра стрелочной функции: "avoid" - убирать, "always" - всегда
17
+ arrowParens: "avoid",
18
+ // Максимальная длина строки перед переносом
19
+ printWidth: 120,
20
+ // Пробелы внутри фигурных скобок объектов: { foo: bar }
21
+ bracketSpacing: true,
22
+ // Кавычки вокруг ключей объекта: "as-needed" - только когда необходимо
23
+ quoteProps: "as-needed",
24
+ // Закрывающая скобка > на той же строке что и последний атрибут
25
+ bracketSameLine: false,
26
+ // Чувствительность к пробелам в HTML: "css" - как в CSS display свойстве
27
+ htmlWhitespaceSensitivity: "css",
12
28
 
13
- importOrderSeparation: true,
14
- singleAttributePerLine: true,
15
- importOrderSortSpecifiers: true,
16
- importOrderCaseInsensitive: true,
17
- importOrderParserPlugins: ['classProperties', 'decorators-legacy', 'typescript', 'jsx'],
18
- importOrder: ['<THIRD_PARTY_MODULES>', '^react$', '^@/(.*)$', '^../(.*)$', '^./(.*)$'],
19
- plugins: ['@trivago/prettier-plugin-sort-imports']
29
+ // --- Настройки плагина сортировки импортов (@trivago/prettier-plugin-sort-imports) ---
30
+ // Добавлять пустую строку между группами импортов
31
+ importOrderSeparation: true,
32
+ // Каждый атрибут JSX на отдельной строке
33
+ singleAttributePerLine: true,
34
+ // Сортировать спецификаторы внутри импорта: import { a, b, c } from 'module'
35
+ importOrderSortSpecifiers: true,
36
+ // Сортировка без учёта регистра
37
+ importOrderInsensitive: true,
38
+ // Плагины парсера для корректной обработки синтаксиса
39
+ importOrderParserPlugins: ["classProperties", "decorators-legacy", "typescript"],
40
+ // Порядок группировки импортов (регулярные выражения)
41
+ importOrder: [
42
+ "<THIRD_PARTY_MODULES>", // Сторонние модули (node_modules)
43
+ "^react$", // React отдельно
44
+ // "^@/app/(.*)$",
45
+ // "^@/pages/(.*)$",
46
+ // "^@/widgets/(.*)$",
47
+ // "^@/features/(.*)$",
48
+ // "^@/entities/(.*)$",
49
+ // "^@/shared/(.*)$",
50
+ "^@/(.*)$", // Алиасы проекта (@/)
51
+ "^../(.*)$", // Относительные импорты из родительских директорий
52
+ "^./(.*)$", // Относительные импорты из текущей директории
53
+ ],
54
+ // Подключённые плагины Prettier
55
+ plugins: ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-astro"],
56
+ // Переопределения для конкретных типов файлов
57
+ overrides: [
58
+ {
59
+ files: "*.astro",
60
+ options: {
61
+ parser: "astro", // Использовать Astro парсер для .astro файлов
62
+ },
63
+ },
64
+ ],
20
65
  }