@nemigo/configs 0.2.2 → 1.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/dist/eslint/index.d.ts +53 -0
- package/dist/{eslint.js → eslint/index.js} +20 -16
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/prettier/index.d.ts +74 -0
- package/dist/prettier/index.js +72 -0
- package/dist/svelte/index.d.ts +56 -15
- package/dist/svelte/index.js +15 -4
- package/dist/svelte/package.d.ts +36 -4
- package/dist/svelte/package.js +19 -7
- package/dist/types.d.ts +7 -0
- package/dist/types.js +1 -0
- package/dist/vite/index.d.ts +22 -4
- package/dist/vite/index.js +20 -17
- package/dist/vite/proxy.d.ts +9 -5
- package/dist/vite/proxy.js +13 -4
- package/package.json +21 -10
- package/dist/eslint.d.ts +0 -37
- package/dist/prettier.d.ts +0 -13
- package/dist/prettier.js +0 -42
- /package/dist/{eslint.types.d.ts → eslint/types.d.ts} +0 -0
- /package/dist/{eslint.types.js → eslint/types.js} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/compat";
|
|
2
|
+
import type { Config } from "@sveltejs/kit";
|
|
3
|
+
import type { Linter } from "eslint";
|
|
4
|
+
import type { ConfigWithExtendsArray } from "./types.js";
|
|
5
|
+
export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
|
|
6
|
+
/**
|
|
7
|
+
* Опции конфигурации для {@link defineEslintConfig}
|
|
8
|
+
*/
|
|
9
|
+
export interface EslintConfigOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Конфиг свелта для его линтига
|
|
12
|
+
*
|
|
13
|
+
* @see https://sveltejs.github.io/eslint-plugin-svelte
|
|
14
|
+
*/
|
|
15
|
+
svelte?: Config;
|
|
16
|
+
/**
|
|
17
|
+
* Использование strict-правил tslint
|
|
18
|
+
*
|
|
19
|
+
* @see https://typescript-eslint.io/users/configs/#strict
|
|
20
|
+
*/
|
|
21
|
+
strict?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Путь к проекту (`import.meta.dirname`) для более сложного линтинга типов (TypeChecked)
|
|
24
|
+
*
|
|
25
|
+
* @see https://typescript-eslint.io/getting-started/typed-linting
|
|
26
|
+
*/
|
|
27
|
+
service?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Путь к иному .eslint.ignore
|
|
30
|
+
*
|
|
31
|
+
* @see https://github.com/eslint/rewrite/tree/main/packages/compat#readme
|
|
32
|
+
*/
|
|
33
|
+
ignore?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Готовый flat-конфиг для `eslint`
|
|
37
|
+
*
|
|
38
|
+
* Включает в себя:
|
|
39
|
+
*
|
|
40
|
+
* - .eslint.ignore
|
|
41
|
+
* - Globals
|
|
42
|
+
* - Javascript
|
|
43
|
+
* - Typescript
|
|
44
|
+
* - Svelte (опционально)
|
|
45
|
+
*
|
|
46
|
+
* Отключено много раздражающих бессмысленных правил
|
|
47
|
+
*
|
|
48
|
+
* @param {EslintConfigOptions} [options]
|
|
49
|
+
* @param {...ConfigWithExtendsArray} [rest]
|
|
50
|
+
* @returns {Linter.Config[]}
|
|
51
|
+
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
52
|
+
*/
|
|
53
|
+
export declare const defineEslintConfig: (options?: EslintConfigOptions, ...rest: ConfigWithExtendsArray) => Linter.Config[];
|
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/compat";
|
|
2
2
|
import jslint from "@eslint/js";
|
|
3
|
-
// import prettier from "eslint-config-prettier";
|
|
4
3
|
import { configs as svelteConfigs } from "eslint-plugin-svelte";
|
|
5
|
-
import { defineConfig
|
|
4
|
+
import { defineConfig } from "eslint/config";
|
|
6
5
|
import globals from "globals";
|
|
7
6
|
import { join } from "node:path";
|
|
8
7
|
import tslint from "typescript-eslint";
|
|
9
8
|
export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
10
|
+
* Готовый flat-конфиг для `eslint`
|
|
12
11
|
*
|
|
13
12
|
* Включает в себя:
|
|
13
|
+
*
|
|
14
14
|
* - .eslint.ignore
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
*
|
|
15
|
+
* - Globals
|
|
16
|
+
* - Javascript
|
|
17
|
+
* - Typescript
|
|
18
|
+
* - Svelte (опционально)
|
|
19
|
+
*
|
|
20
|
+
* Отключено много раздражающих бессмысленных правил
|
|
20
21
|
*
|
|
22
|
+
* @param {EslintConfigOptions} [options]
|
|
23
|
+
* @param {...ConfigWithExtendsArray} [rest]
|
|
24
|
+
* @returns {Linter.Config[]}
|
|
21
25
|
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
22
26
|
*/
|
|
23
|
-
export const
|
|
24
|
-
?
|
|
27
|
+
export const defineEslintConfig = (options, ...rest) => defineConfig(includeIgnoreFile(options?.ignore || join(import.meta.dirname, "../../.eslint.ignore"), "@nemigo/configs/.eslint.ignore"), jslint.configs.recommended, ...(options?.strict
|
|
28
|
+
? options?.service
|
|
25
29
|
? tslint.configs.strictTypeChecked
|
|
26
30
|
: tslint.configs.strict
|
|
27
|
-
:
|
|
31
|
+
: options?.service
|
|
28
32
|
? tslint.configs.recommendedTypeChecked
|
|
29
|
-
: tslint.configs.recommended),
|
|
33
|
+
: tslint.configs.recommended), options?.service
|
|
30
34
|
? {
|
|
31
35
|
languageOptions: {
|
|
32
36
|
parserOptions: {
|
|
33
37
|
projectService: true,
|
|
34
|
-
tsconfigRootDir:
|
|
38
|
+
tsconfigRootDir: options.service,
|
|
35
39
|
},
|
|
36
40
|
},
|
|
37
41
|
}
|
|
38
|
-
: {}, ...(
|
|
42
|
+
: {}, ...(options?.svelte ? svelteConfigs["flat/recommended"] : []),
|
|
39
43
|
// prettier,
|
|
40
44
|
// ...(svelte ? svelteConfigs["flat/prettier"] : []),
|
|
41
45
|
{
|
|
@@ -80,7 +84,7 @@ export const defineConfig = (opts, ...rest) => eslintDefineConfig(includeIgnoreF
|
|
|
80
84
|
"@typescript-eslint/restrict-template-expressions": 0,
|
|
81
85
|
"no-import-assign": 0,
|
|
82
86
|
},
|
|
83
|
-
},
|
|
87
|
+
}, options?.svelte
|
|
84
88
|
? {
|
|
85
89
|
files: [
|
|
86
90
|
"**/*.svelte",
|
|
@@ -92,7 +96,7 @@ export const defineConfig = (opts, ...rest) => eslintDefineConfig(includeIgnoreF
|
|
|
92
96
|
projectService: true,
|
|
93
97
|
extraFileExtensions: [".svelte"],
|
|
94
98
|
parser: tslint.parser,
|
|
95
|
-
svelteConfig:
|
|
99
|
+
svelteConfig: options?.svelte,
|
|
96
100
|
},
|
|
97
101
|
},
|
|
98
102
|
rules: {
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { defineEslintConfig, convertIgnorePattern, includeIgnoreFile } from "./eslint/index.js";
|
|
2
|
+
export { definePrettierConfig, pretty } from "./prettier/index.js";
|
|
3
|
+
export { defineSvelteConfig } from "./svelte/index.js";
|
|
4
|
+
export { defineSveltePackageConfig } from "./svelte/package.js";
|
|
5
|
+
export { defineViteConfig } from "./vite/index.js";
|
|
6
|
+
export { defineViteProxyConfig } from "./vite/proxy.js";
|
|
7
|
+
export type * from "./types.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { defineEslintConfig, convertIgnorePattern, includeIgnoreFile } from "./eslint/index.js";
|
|
2
|
+
export { definePrettierConfig, pretty } from "./prettier/index.js";
|
|
3
|
+
export { defineSvelteConfig } from "./svelte/index.js";
|
|
4
|
+
export { defineSveltePackageConfig } from "./svelte/package.js";
|
|
5
|
+
export { defineViteConfig } from "./vite/index.js";
|
|
6
|
+
export { defineViteProxyConfig } from "./vite/proxy.js";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Config, Options } from "prettier";
|
|
2
|
+
import type { Options as JSDocPrettier } from "prettier-plugin-jsdoc";
|
|
3
|
+
import type { MultilineArrayOptions } from "prettier-plugin-multiline-arrays";
|
|
4
|
+
import type { PluginConfig as SveltePrettier } from "prettier-plugin-svelte";
|
|
5
|
+
import type { PluginOptions as TailwindPrettier } from "prettier-plugin-tailwindcss";
|
|
6
|
+
export type PrettierConfig = TailwindPrettier & Config & JSDocPrettier & Partial<MultilineArrayOptions> & SveltePrettier;
|
|
7
|
+
/**
|
|
8
|
+
* Опции конфигурации для {@link definePrettierConfig}
|
|
9
|
+
*/
|
|
10
|
+
export interface PrettierConfigOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Порог длины для переноса массивов
|
|
13
|
+
*
|
|
14
|
+
* @default 3
|
|
15
|
+
*
|
|
16
|
+
* @alias MultilineArrayOptions.multilineArraysWrapThreshold
|
|
17
|
+
*
|
|
18
|
+
* @see https://www.npmjs.com/package/prettier-plugin-multiline-arrays
|
|
19
|
+
*/
|
|
20
|
+
arraysWrapThreshold?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Дополнительные настройки для `prettier-plugin-tailwindcss`
|
|
23
|
+
*
|
|
24
|
+
* @see https://www.npmjs.com/package/prettier-plugin-tailwindcss
|
|
25
|
+
*/
|
|
26
|
+
tailwind: {
|
|
27
|
+
/**
|
|
28
|
+
* Путь к конфигу Tailwind V4 (`./src/tailwind.css`)
|
|
29
|
+
*
|
|
30
|
+
* @alias TailwindPrettier.tailwindStylesheet
|
|
31
|
+
*
|
|
32
|
+
* @see https://www.npmjs.com/package/prettier-plugin-tailwindcss
|
|
33
|
+
*/
|
|
34
|
+
stylesheet?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Переопределение конфига
|
|
38
|
+
*
|
|
39
|
+
* @see https://prettier.io/docs/options
|
|
40
|
+
* @see https://www.npmjs.com/package/prettier-plugin-tailwindcss
|
|
41
|
+
*/
|
|
42
|
+
override?: PrettierConfig;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Готовый конфиг для `prettier`
|
|
46
|
+
*
|
|
47
|
+
* Включает в себя плагины:
|
|
48
|
+
*
|
|
49
|
+
* - Prettier-plugin-svelte
|
|
50
|
+
* - Prettier-plugin-css-order
|
|
51
|
+
* - Prettier-plugin-multiline-arrays
|
|
52
|
+
* - Prettier-plugin-jsdoc
|
|
53
|
+
* - Prettier-plugin-tailwindcss
|
|
54
|
+
*
|
|
55
|
+
* Используются:
|
|
56
|
+
*
|
|
57
|
+
* - Табы длинной 2
|
|
58
|
+
* - Двойные кавычки
|
|
59
|
+
*
|
|
60
|
+
* @param {PrettierConfigOptions} [options]
|
|
61
|
+
* @returns {PrettierConfig}
|
|
62
|
+
* @see https://prettier.io
|
|
63
|
+
*/
|
|
64
|
+
export declare const definePrettierConfig: (options?: PrettierConfigOptions) => PrettierConfig;
|
|
65
|
+
/**
|
|
66
|
+
* Форматирование с помощью `prettier` по сборке из {@link definePrettierConfig}
|
|
67
|
+
*
|
|
68
|
+
* @param {string} content
|
|
69
|
+
* @param {Options["parser"]} parser
|
|
70
|
+
* @param {PrettierConfigOptions} [options]
|
|
71
|
+
* @returns {Promise<string>}
|
|
72
|
+
* @see https://prettier.io
|
|
73
|
+
*/
|
|
74
|
+
export declare const pretty: (content: string, parser: Options["parser"], options?: PrettierConfigOptions) => Promise<string>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { format } from "prettier";
|
|
2
|
+
// noinspection TypeScriptCheckImport (у пакета нет типов)
|
|
3
|
+
import * as css from "prettier-plugin-css-order";
|
|
4
|
+
import * as jsdoc from "prettier-plugin-jsdoc";
|
|
5
|
+
import * as arrays from "prettier-plugin-multiline-arrays";
|
|
6
|
+
import * as svelte from "prettier-plugin-svelte";
|
|
7
|
+
import * as tailwind from "prettier-plugin-tailwindcss";
|
|
8
|
+
/**
|
|
9
|
+
* Готовый конфиг для `prettier`
|
|
10
|
+
*
|
|
11
|
+
* Включает в себя плагины:
|
|
12
|
+
*
|
|
13
|
+
* - Prettier-plugin-svelte
|
|
14
|
+
* - Prettier-plugin-css-order
|
|
15
|
+
* - Prettier-plugin-multiline-arrays
|
|
16
|
+
* - Prettier-plugin-jsdoc
|
|
17
|
+
* - Prettier-plugin-tailwindcss
|
|
18
|
+
*
|
|
19
|
+
* Используются:
|
|
20
|
+
*
|
|
21
|
+
* - Табы длинной 2
|
|
22
|
+
* - Двойные кавычки
|
|
23
|
+
*
|
|
24
|
+
* @param {PrettierConfigOptions} [options]
|
|
25
|
+
* @returns {PrettierConfig}
|
|
26
|
+
* @see https://prettier.io
|
|
27
|
+
*/
|
|
28
|
+
export const definePrettierConfig = (options) => ({
|
|
29
|
+
tabWidth: 2,
|
|
30
|
+
useTabs: true,
|
|
31
|
+
printWidth: 150,
|
|
32
|
+
singleQuote: false,
|
|
33
|
+
trailingComma: "es5",
|
|
34
|
+
bracketSameLine: true,
|
|
35
|
+
experimentalTernaries: false,
|
|
36
|
+
multilineArraysWrapThreshold: options?.arraysWrapThreshold ?? 3,
|
|
37
|
+
plugins: [
|
|
38
|
+
svelte,
|
|
39
|
+
css,
|
|
40
|
+
arrays,
|
|
41
|
+
jsdoc,
|
|
42
|
+
tailwind,
|
|
43
|
+
],
|
|
44
|
+
overrides: [
|
|
45
|
+
{
|
|
46
|
+
files: "*.svelte",
|
|
47
|
+
options: { parser: "svelte" },
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
tsdoc: true,
|
|
51
|
+
tailwindStylesheet: options?.tailwind.stylesheet,
|
|
52
|
+
jsdocCommentLineStrategy: "multiline",
|
|
53
|
+
...(options?.override ?? {}),
|
|
54
|
+
});
|
|
55
|
+
//...
|
|
56
|
+
const config = definePrettierConfig();
|
|
57
|
+
/**
|
|
58
|
+
* Форматирование с помощью `prettier` по сборке из {@link definePrettierConfig}
|
|
59
|
+
*
|
|
60
|
+
* @param {string} content
|
|
61
|
+
* @param {Options["parser"]} parser
|
|
62
|
+
* @param {PrettierConfigOptions} [options]
|
|
63
|
+
* @returns {Promise<string>}
|
|
64
|
+
* @see https://prettier.io
|
|
65
|
+
*/
|
|
66
|
+
export const pretty = (content, parser, options) => format(content, {
|
|
67
|
+
...config,
|
|
68
|
+
parser,
|
|
69
|
+
multilineArraysWrapThreshold: options?.arraysWrapThreshold ?? 3,
|
|
70
|
+
tailwindStylesheet: options?.tailwind.stylesheet,
|
|
71
|
+
...(options?.override ?? {}),
|
|
72
|
+
});
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import type { Adapter, Config } from "@sveltejs/kit";
|
|
2
|
+
/**
|
|
3
|
+
* Опции конфигурации для {@link defineSvelteConfig}
|
|
4
|
+
*/
|
|
2
5
|
export interface SvelteConfigOptions {
|
|
3
6
|
/**
|
|
4
7
|
* Адаптер серверной платформы
|
|
5
8
|
*
|
|
9
|
+
* @alias Config.kit.adapter
|
|
10
|
+
*
|
|
6
11
|
* @see https://svelte.dev/docs/kit/adapters
|
|
7
12
|
*/
|
|
8
13
|
adapter: Adapter;
|
|
9
14
|
/**
|
|
10
15
|
* Только руны
|
|
11
16
|
*
|
|
12
|
-
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
13
|
-
*
|
|
14
17
|
* @default true
|
|
18
|
+
*
|
|
19
|
+
* @alias Config.compilerOptions.runes
|
|
20
|
+
*
|
|
21
|
+
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
15
22
|
*/
|
|
16
23
|
runes?: boolean;
|
|
17
24
|
/**
|
|
@@ -19,47 +26,81 @@ export interface SvelteConfigOptions {
|
|
|
19
26
|
*
|
|
20
27
|
* Отключить, если нужна возможность обращения с локалки на прод-приложения
|
|
21
28
|
*
|
|
29
|
+
* @alias Config.kit.csrf.checkOrigin
|
|
30
|
+
*
|
|
22
31
|
* @see https://svelte.dev/docs/kit/configuration#csrf
|
|
23
32
|
* @see https://developer.mozilla.org/en-US/docs/Web/Security/Types_of_attacks#cross-site_request_forgery_csrf
|
|
24
|
-
*
|
|
25
|
-
* @default `true`
|
|
26
33
|
*/
|
|
27
34
|
csrfCheckOrigin?: boolean;
|
|
28
35
|
/**
|
|
29
36
|
* Алиасы путей
|
|
30
37
|
*
|
|
31
|
-
* @
|
|
38
|
+
* @alias Config.kit.alias
|
|
39
|
+
*
|
|
40
|
+
* @see https://svelte.dev/docs/kit/configuration#alias
|
|
32
41
|
*/
|
|
33
42
|
alias?: Record<string, string>;
|
|
34
43
|
/**
|
|
35
|
-
*
|
|
44
|
+
* Переопределение путей кита
|
|
45
|
+
*
|
|
46
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
36
47
|
*/
|
|
37
48
|
files?: {
|
|
38
49
|
/**
|
|
39
|
-
*
|
|
50
|
+
* Путь к директории со статическими файлами
|
|
51
|
+
*
|
|
52
|
+
* @alias Config.kit.files.assets
|
|
53
|
+
*
|
|
54
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
40
55
|
*/
|
|
41
56
|
assets?: string;
|
|
42
57
|
/**
|
|
43
|
-
*
|
|
58
|
+
* Путь к главному `app.html` приложения
|
|
59
|
+
*
|
|
60
|
+
* @alias Config.kit.files.appTemplate
|
|
61
|
+
*
|
|
62
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
44
63
|
*/
|
|
45
64
|
app_html?: string;
|
|
46
65
|
/**
|
|
47
|
-
*
|
|
66
|
+
* Путь к `error.html` приложения
|
|
67
|
+
*
|
|
68
|
+
* @alias Config.kit.files.errorTemplate
|
|
69
|
+
*
|
|
70
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
48
71
|
*/
|
|
49
72
|
error_html?: string;
|
|
50
73
|
};
|
|
51
74
|
/**
|
|
52
|
-
* Глобусы
|
|
75
|
+
* Глобусы включений для tsconfig-а
|
|
76
|
+
*
|
|
77
|
+
* @alias Config.kit.typescript.config.include
|
|
78
|
+
*
|
|
79
|
+
* @see @https://svelte.dev/docs/kit/configuration#typescript
|
|
80
|
+
* @see https://www.typescriptlang.org/tsconfig/#include
|
|
53
81
|
*/
|
|
54
|
-
|
|
82
|
+
include?: string[];
|
|
55
83
|
/**
|
|
56
|
-
* Глобусы
|
|
84
|
+
* Глобусы исключений для tsconfig-а
|
|
85
|
+
*
|
|
86
|
+
* @alias Config.kit.typescript.config.exclude
|
|
87
|
+
*
|
|
88
|
+
* @see @https://svelte.dev/docs/kit/configuration#typescript
|
|
89
|
+
* @see https://www.typescriptlang.org/tsconfig/#exclude
|
|
57
90
|
*/
|
|
58
|
-
|
|
91
|
+
exclude?: string[];
|
|
59
92
|
}
|
|
60
93
|
/**
|
|
61
|
-
*
|
|
94
|
+
* Реструктурированная конфигурация приложений на `@sveltejs/kit`
|
|
95
|
+
*
|
|
96
|
+
* - По умолчанию **только** руны
|
|
97
|
+
* - Подключён VitePreprocess (@sveltejs/vite-plugin-svelte)
|
|
98
|
+
* - Иная конфигурация tsconfig-а
|
|
62
99
|
*
|
|
100
|
+
* @param {SvelteConfigOptions} options
|
|
101
|
+
* @returns {Config}
|
|
63
102
|
* @see https://svelte.dev/docs/kit/introduction
|
|
103
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
104
|
+
* @see https://www.typescriptlang.org/tsconfig
|
|
64
105
|
*/
|
|
65
|
-
export declare const
|
|
106
|
+
export declare const defineSvelteConfig: (options: SvelteConfigOptions) => Config;
|
package/dist/svelte/index.js
CHANGED
|
@@ -5,11 +5,19 @@ const getOptionalObject = (value) => (isObject(value) ? value : {});
|
|
|
5
5
|
const getOptionalArray = (value) => (Array.isArray(value) ? value : []);
|
|
6
6
|
const setifyArray = (array) => Array.from(new Set(array));
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Реструктурированная конфигурация приложений на `@sveltejs/kit`
|
|
9
9
|
*
|
|
10
|
+
* - По умолчанию **только** руны
|
|
11
|
+
* - Подключён VitePreprocess (@sveltejs/vite-plugin-svelte)
|
|
12
|
+
* - Иная конфигурация tsconfig-а
|
|
13
|
+
*
|
|
14
|
+
* @param {SvelteConfigOptions} options
|
|
15
|
+
* @returns {Config}
|
|
10
16
|
* @see https://svelte.dev/docs/kit/introduction
|
|
17
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
18
|
+
* @see https://www.typescriptlang.org/tsconfig
|
|
11
19
|
*/
|
|
12
|
-
export const
|
|
20
|
+
export const defineSvelteConfig = (options) => ({
|
|
13
21
|
/**
|
|
14
22
|
* Настройки поведения svelte-компилятора
|
|
15
23
|
*
|
|
@@ -25,7 +33,7 @@ export const defineConfig = (options) => ({
|
|
|
25
33
|
/**
|
|
26
34
|
* Расширение поддержки всякого в svelte (в т.ч. и полной для typescript)
|
|
27
35
|
*
|
|
28
|
-
* @see https://svelte.dev/docs/kit/integrations
|
|
36
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
29
37
|
*/
|
|
30
38
|
preprocess: vitePreprocess({ script: true }),
|
|
31
39
|
kit: {
|
|
@@ -63,7 +71,6 @@ export const defineConfig = (options) => ({
|
|
|
63
71
|
resolveJsonModule: true,
|
|
64
72
|
skipLibCheck: true,
|
|
65
73
|
disableSizeLimit: true,
|
|
66
|
-
erasableSyntaxOnly: true,
|
|
67
74
|
};
|
|
68
75
|
config["exclude"] = setifyArray([
|
|
69
76
|
...getOptionalArray(config["exclude"]),
|
|
@@ -76,7 +83,11 @@ export const defineConfig = (options) => ({
|
|
|
76
83
|
"../scripts",
|
|
77
84
|
"../types",
|
|
78
85
|
"../*.ts",
|
|
86
|
+
"../*.mts",
|
|
87
|
+
"../*.cts",
|
|
79
88
|
"../*.js",
|
|
89
|
+
"../*.mjs",
|
|
90
|
+
"../*.cjs",
|
|
80
91
|
...(options.include ?? []),
|
|
81
92
|
]);
|
|
82
93
|
return config;
|
package/dist/svelte/package.d.ts
CHANGED
|
@@ -1,24 +1,56 @@
|
|
|
1
1
|
import type { Config } from "@sveltejs/kit";
|
|
2
|
+
/**
|
|
3
|
+
* Опции конфигурации для {@link defineSveltePackageConfig}
|
|
4
|
+
*/
|
|
2
5
|
export interface SveltePackageConfigOptions {
|
|
3
6
|
/**
|
|
4
7
|
* Только руны
|
|
5
8
|
*
|
|
6
|
-
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
7
|
-
*
|
|
8
9
|
* @default true
|
|
10
|
+
*
|
|
11
|
+
* @alias Config.compilerOptions.runes
|
|
12
|
+
*
|
|
13
|
+
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
9
14
|
*/
|
|
10
15
|
runes?: boolean;
|
|
11
16
|
/**
|
|
12
17
|
* Добавляет алиас `{ "#": "src" }`
|
|
13
18
|
*
|
|
14
19
|
* @default true
|
|
20
|
+
*
|
|
21
|
+
* @alias Config.kit.alias
|
|
22
|
+
*
|
|
23
|
+
* @see https://svelte.dev/docs/kit/configuration#alias
|
|
15
24
|
*/
|
|
16
25
|
isolate?: boolean;
|
|
17
26
|
/**
|
|
18
27
|
* Алиасы путей
|
|
19
28
|
*
|
|
20
|
-
* @
|
|
29
|
+
* @alias Config.kit.alias
|
|
30
|
+
*
|
|
31
|
+
* @see https://svelte.dev/docs/kit/configuration#alias
|
|
21
32
|
*/
|
|
22
33
|
alias?: Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Путь, который транспилер будет считать корневым для пакета
|
|
36
|
+
*
|
|
37
|
+
* @default "./src"
|
|
38
|
+
* @alias Config.kit.files.lib
|
|
39
|
+
*
|
|
40
|
+
* @see https://svelte.dev/docs/kit/configuration#files
|
|
41
|
+
*/
|
|
42
|
+
path?: string;
|
|
23
43
|
}
|
|
24
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Реструктурированная конфигурация для `@sveltejs/package`
|
|
46
|
+
*
|
|
47
|
+
* - По умолчанию **только** руны.
|
|
48
|
+
* - Подключён VitePreprocess (@sveltejs/vite-plugin-svelte).
|
|
49
|
+
* - По умолчанию иной путь к пакету ("./src/lib" -> "./src")
|
|
50
|
+
*
|
|
51
|
+
* @param {SveltePackageConfigOptions} [options]
|
|
52
|
+
* @returns {Config}
|
|
53
|
+
* @see https://svelte.dev/docs/kit/packaging
|
|
54
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
55
|
+
*/
|
|
56
|
+
export declare const defineSveltePackageConfig: (options?: SveltePackageConfigOptions) => Config;
|
package/dist/svelte/package.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Реструктурированная конфигурация для `@sveltejs/package`
|
|
4
|
+
*
|
|
5
|
+
* - По умолчанию **только** руны.
|
|
6
|
+
* - Подключён VitePreprocess (@sveltejs/vite-plugin-svelte).
|
|
7
|
+
* - По умолчанию иной путь к пакету ("./src/lib" -> "./src")
|
|
8
|
+
*
|
|
9
|
+
* @param {SveltePackageConfigOptions} [options]
|
|
10
|
+
* @returns {Config}
|
|
11
|
+
* @see https://svelte.dev/docs/kit/packaging
|
|
12
|
+
* @see https://svelte.dev/docs/kit/integrations#vitePreprocess
|
|
13
|
+
*/
|
|
14
|
+
export const defineSveltePackageConfig = (options) => ({
|
|
3
15
|
/**
|
|
4
16
|
* Настройки поведения svelte-компилятора
|
|
5
17
|
*
|
|
6
18
|
* @see https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions
|
|
7
19
|
*/
|
|
8
20
|
compilerOptions: {
|
|
9
|
-
runes,
|
|
21
|
+
runes: options?.runes ?? true,
|
|
10
22
|
/**
|
|
11
|
-
* Использование современного AST
|
|
23
|
+
* Использование современного AST (не знаю, на что влияет)
|
|
12
24
|
*/
|
|
13
25
|
modernAst: true,
|
|
14
26
|
},
|
|
@@ -21,13 +33,13 @@ export const definePackageConfig = ({ runes = true, isolate = true, alias = {} }
|
|
|
21
33
|
kit: {
|
|
22
34
|
files: {
|
|
23
35
|
/**
|
|
24
|
-
*
|
|
36
|
+
* Путь, который сборщик будет корневым считать для пакета
|
|
25
37
|
*/
|
|
26
|
-
lib: "src",
|
|
38
|
+
lib: options?.path ?? "./src",
|
|
27
39
|
},
|
|
28
40
|
alias: {
|
|
29
|
-
...(isolate ? { "#": "src" } : {}),
|
|
30
|
-
...alias,
|
|
41
|
+
...(options?.isolate ? { "#": "src" } : {}),
|
|
42
|
+
...(options?.alias ?? {}),
|
|
31
43
|
},
|
|
32
44
|
},
|
|
33
45
|
});
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { EslintConfigOptions } from "./eslint/index.js";
|
|
2
|
+
export type { ConfigWithExtendsArray } from "./eslint/types.js";
|
|
3
|
+
export type { PrettierConfigOptions, PrettierConfig } from "./prettier/index.js";
|
|
4
|
+
export type { SvelteConfigOptions } from "./svelte/index.js";
|
|
5
|
+
export type { SveltePackageConfigOptions } from "./svelte/package.js";
|
|
6
|
+
export type { ViteConfigOptions } from "./vite/index.js";
|
|
7
|
+
export type { ViteProxyConfigOptions } from "./vite/proxy.js";
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import type { BuildOptions, PluginOption, ServerOptions } from "vite";
|
|
2
2
|
import type { ViteUserConfig } from "vitest/config";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Опции конфигурации для {@link defineViteConfig}
|
|
5
5
|
*/
|
|
6
6
|
export interface ViteConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Путь к директории, где читает .env-файлы. Отключено, т.к. файлы читаются через dotenv
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*
|
|
12
|
+
* @alias ViteUserConfig.envDir
|
|
13
|
+
*
|
|
14
|
+
* @see https://vite.dev/config/shared-options.html#envdir
|
|
15
|
+
*/
|
|
16
|
+
env?: string | false;
|
|
7
17
|
/**
|
|
8
18
|
* Порт приложения
|
|
9
19
|
*
|
|
@@ -17,7 +27,7 @@ export interface ViteConfigOptions {
|
|
|
17
27
|
*/
|
|
18
28
|
offStrictPort?: boolean;
|
|
19
29
|
/**
|
|
20
|
-
*
|
|
30
|
+
* Минификация при сборке
|
|
21
31
|
*
|
|
22
32
|
* @see https://vite.dev/config/build-options.html#build-minify
|
|
23
33
|
*/
|
|
@@ -42,9 +52,17 @@ export interface ViteConfigOptions {
|
|
|
42
52
|
plugins?: PluginOption[];
|
|
43
53
|
}
|
|
44
54
|
/**
|
|
45
|
-
* Реструктурированная конфигурация `vite` через `vitest`
|
|
55
|
+
* Реструктурированная конфигурация для `vite` через `vitest`
|
|
56
|
+
*
|
|
57
|
+
* - По умолчанию отключено чтение env-файлов
|
|
58
|
+
* - "PUBLIC_" префикс для публичных env-переменных
|
|
59
|
+
* - Строгая конфигурация порта сервера
|
|
60
|
+
* - По умолчанию путь к тестам "./src/**_/*.{test,spec}.{ts,js}"
|
|
46
61
|
*
|
|
62
|
+
* @param {ViteConfigOptions} [options]
|
|
63
|
+
* @param {ViteUserConfig["test"]} [test]
|
|
64
|
+
* @returns {ViteUserConfig}
|
|
47
65
|
* @see https://vite.dev/ Документация Vite
|
|
48
66
|
* @see https://vitest.dev/ Документация Vitest
|
|
49
67
|
*/
|
|
50
|
-
export declare const
|
|
68
|
+
export declare const defineViteConfig: (options?: ViteConfigOptions, test?: ViteUserConfig["test"]) => ViteUserConfig;
|
package/dist/vite/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { defineConfig
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
2
|
/**
|
|
3
|
-
* Реструктурированная конфигурация `vite` через `vitest`
|
|
3
|
+
* Реструктурированная конфигурация для `vite` через `vitest`
|
|
4
4
|
*
|
|
5
|
+
* - По умолчанию отключено чтение env-файлов
|
|
6
|
+
* - "PUBLIC_" префикс для публичных env-переменных
|
|
7
|
+
* - Строгая конфигурация порта сервера
|
|
8
|
+
* - По умолчанию путь к тестам "./src/**_/*.{test,spec}.{ts,js}"
|
|
9
|
+
*
|
|
10
|
+
* @param {ViteConfigOptions} [options]
|
|
11
|
+
* @param {ViteUserConfig["test"]} [test]
|
|
12
|
+
* @returns {ViteUserConfig}
|
|
5
13
|
* @see https://vite.dev/ Документация Vite
|
|
6
14
|
* @see https://vitest.dev/ Документация Vitest
|
|
7
15
|
*/
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
* Где смотрит .env-файлы. Отключено, т.к. файлы читаются через dotenv
|
|
11
|
-
*
|
|
12
|
-
* @see https://vite.dev/config/shared-options.html#envdir
|
|
13
|
-
*/
|
|
14
|
-
envDir: false,
|
|
16
|
+
export const defineViteConfig = (options, test) => defineConfig({
|
|
17
|
+
envDir: options?.env,
|
|
15
18
|
/**
|
|
16
19
|
* Префикс публичных env-переменных (чтобы совпадало с svelte-kit)
|
|
17
20
|
*
|
|
@@ -24,16 +27,16 @@ export const defineConfig = (options = {}, test) => defineVitestConfig({
|
|
|
24
27
|
* @see https://vite.dev/config/server-options.html
|
|
25
28
|
*/
|
|
26
29
|
server: {
|
|
27
|
-
port: options
|
|
30
|
+
port: options?.port,
|
|
28
31
|
/**
|
|
29
32
|
* Выдаёт ошибку, если порт занят
|
|
30
33
|
*
|
|
31
34
|
* @see https://vite.dev/config/server-options.html#server-strictport
|
|
32
35
|
*/
|
|
33
|
-
strictPort: !options
|
|
34
|
-
proxy: options
|
|
36
|
+
strictPort: !options?.offStrictPort,
|
|
37
|
+
proxy: options?.proxy,
|
|
35
38
|
fs: {
|
|
36
|
-
allow: options
|
|
39
|
+
allow: options?.allow,
|
|
37
40
|
},
|
|
38
41
|
},
|
|
39
42
|
/**
|
|
@@ -42,9 +45,9 @@ export const defineConfig = (options = {}, test) => defineVitestConfig({
|
|
|
42
45
|
* @see https://vite.dev/config/build-options.html
|
|
43
46
|
*/
|
|
44
47
|
build: {
|
|
45
|
-
minify: options
|
|
48
|
+
minify: options?.minify,
|
|
46
49
|
},
|
|
47
|
-
plugins: options
|
|
50
|
+
plugins: options?.plugins,
|
|
48
51
|
/**
|
|
49
52
|
* Конфигурация `vitest`
|
|
50
53
|
*
|
|
@@ -52,10 +55,10 @@ export const defineConfig = (options = {}, test) => defineVitestConfig({
|
|
|
52
55
|
*/
|
|
53
56
|
test: test ?? {
|
|
54
57
|
/**
|
|
55
|
-
*
|
|
58
|
+
* Glob-путь к файлам тестов
|
|
56
59
|
*
|
|
57
60
|
* @see https://vitest.dev/config/#include
|
|
58
61
|
*/
|
|
59
|
-
include: ["src/**/*.{test,spec}.{ts,js}"],
|
|
62
|
+
include: ["./src/**/*.{test,spec}.{ts,js}"],
|
|
60
63
|
},
|
|
61
64
|
});
|
package/dist/vite/proxy.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ServerOptions } from "vite";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Опции конфигурации для {@link defineViteProxyConfig}
|
|
4
4
|
*/
|
|
5
5
|
export interface ViteProxyConfigOptions {
|
|
6
6
|
/**
|
|
7
7
|
* URL-адрес сервера, на который будет направляться прокси
|
|
8
8
|
*
|
|
9
|
-
* @example
|
|
9
|
+
* @example http://localhost:3000
|
|
10
10
|
*/
|
|
11
11
|
domain: string;
|
|
12
12
|
/**
|
|
13
13
|
* Префикс маршрута, который будет перенаправляться.
|
|
14
14
|
*
|
|
15
|
-
* @example
|
|
15
|
+
* @example /api/
|
|
16
16
|
*/
|
|
17
17
|
prefix: string;
|
|
18
18
|
/**
|
|
@@ -23,8 +23,12 @@ export interface ViteProxyConfigOptions {
|
|
|
23
23
|
changeOrigin?: boolean;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Создания прокси-конфига для
|
|
26
|
+
* Создания прокси-конфига для `vite`
|
|
27
27
|
*
|
|
28
28
|
* Используется для проксирования запросов на основной сервер у приложений
|
|
29
|
+
*
|
|
30
|
+
* @param {ViteProxyConfigOptions} options
|
|
31
|
+
* @returns {ServerOptions["proxy"]}
|
|
32
|
+
* @see https://vite.dev/config/server-options.html#server-proxy
|
|
29
33
|
*/
|
|
30
|
-
export declare const
|
|
34
|
+
export declare const defineViteProxyConfig: (options: ViteProxyConfigOptions) => ServerOptions["proxy"];
|
package/dist/vite/proxy.js
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Создания прокси-конфига для
|
|
2
|
+
* Создания прокси-конфига для `vite`
|
|
3
3
|
*
|
|
4
4
|
* Используется для проксирования запросов на основной сервер у приложений
|
|
5
|
+
*
|
|
6
|
+
* @param {ViteProxyConfigOptions} options
|
|
7
|
+
* @returns {ServerOptions["proxy"]}
|
|
8
|
+
* @see https://vite.dev/config/server-options.html#server-proxy
|
|
5
9
|
*/
|
|
6
|
-
export const
|
|
10
|
+
export const defineViteProxyConfig = (options) => {
|
|
7
11
|
const pad = (v) => v.toString().padStart(2, "0");
|
|
8
12
|
const now = new Date();
|
|
9
13
|
const hours = pad(now.getHours());
|
|
10
14
|
const mins = pad(now.getMinutes());
|
|
11
15
|
const secs = pad(now.getSeconds());
|
|
12
16
|
const PROXY = "\x1b[1m\x1b[96m[PROXY]\x1b[0m\x1b[22m";
|
|
13
|
-
console.log(`${hours}:${mins}:${secs} ${PROXY} ${
|
|
14
|
-
return {
|
|
17
|
+
console.log(`${hours}:${mins}:${secs} ${PROXY} ${options.domain} \n`);
|
|
18
|
+
return {
|
|
19
|
+
[options.prefix]: {
|
|
20
|
+
target: options.domain,
|
|
21
|
+
changeOrigin: options.changeOrigin ?? true,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
15
24
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nemigo/configs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Vlad Logvin",
|
|
7
7
|
"email": "vlad.logvin84@gmail.com"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=22"
|
|
12
|
+
},
|
|
10
13
|
"scripts": {
|
|
11
14
|
"build": "svelte-package && rimraf .svelte-kit",
|
|
12
15
|
"format": "prettier --write ./"
|
|
@@ -17,20 +20,24 @@
|
|
|
17
20
|
"typescript.json"
|
|
18
21
|
],
|
|
19
22
|
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
20
27
|
"./.eslint.ignore": {
|
|
21
28
|
"default": "./.eslint.ignore"
|
|
22
29
|
},
|
|
23
30
|
"./eslint": {
|
|
24
|
-
"types": "./dist/eslint.d.ts",
|
|
25
|
-
"default": "./dist/eslint.js"
|
|
31
|
+
"types": "./dist/eslint/index.d.ts",
|
|
32
|
+
"default": "./dist/eslint/index.js"
|
|
26
33
|
},
|
|
27
34
|
"./eslint/types": {
|
|
28
35
|
"types": "./dist/eslint/types.d.ts",
|
|
29
36
|
"default": "./dist/eslint/types.js"
|
|
30
37
|
},
|
|
31
38
|
"./prettier": {
|
|
32
|
-
"types": "./dist/prettier.d.ts",
|
|
33
|
-
"default": "./dist/prettier.js"
|
|
39
|
+
"types": "./dist/prettier/index.d.ts",
|
|
40
|
+
"default": "./dist/prettier/index.js"
|
|
34
41
|
},
|
|
35
42
|
"./svelte": {
|
|
36
43
|
"types": "./dist/svelte/index.d.ts",
|
|
@@ -40,8 +47,9 @@
|
|
|
40
47
|
"types": "./dist/svelte/package.d.ts",
|
|
41
48
|
"default": "./dist/svelte/package.js"
|
|
42
49
|
},
|
|
43
|
-
"./
|
|
44
|
-
"
|
|
50
|
+
"./types": {
|
|
51
|
+
"types": "./dist/types.d.ts",
|
|
52
|
+
"default": "./dist/types.js"
|
|
45
53
|
},
|
|
46
54
|
"./vite": {
|
|
47
55
|
"types": "./dist/vite/index.d.ts",
|
|
@@ -50,6 +58,9 @@
|
|
|
50
58
|
"./vite/proxy": {
|
|
51
59
|
"types": "./dist/vite/proxy.d.ts",
|
|
52
60
|
"default": "./dist/vite/proxy.js"
|
|
61
|
+
},
|
|
62
|
+
"./typescript.json": {
|
|
63
|
+
"default": "./typescript.json"
|
|
53
64
|
}
|
|
54
65
|
},
|
|
55
66
|
"peerDependencies": {
|
|
@@ -71,13 +82,13 @@
|
|
|
71
82
|
"@eslint/compat": "1.4.0",
|
|
72
83
|
"@eslint/js": "9.37.0",
|
|
73
84
|
"@types/eslint": "9.6.1",
|
|
74
|
-
"eslint-config-prettier": "10.1.8",
|
|
75
85
|
"eslint-plugin-svelte": "3.12.4",
|
|
76
86
|
"globals": "16.4.0",
|
|
77
87
|
"prettier-plugin-css-order": "2.1.2",
|
|
88
|
+
"prettier-plugin-jsdoc": "1.3.3",
|
|
78
89
|
"prettier-plugin-multiline-arrays": "4.0.3",
|
|
79
90
|
"prettier-plugin-svelte": "3.4.0",
|
|
80
|
-
"prettier-plugin-tailwindcss": "0.
|
|
81
|
-
"typescript-eslint": "8.46.
|
|
91
|
+
"prettier-plugin-tailwindcss": "0.7.0",
|
|
92
|
+
"typescript-eslint": "8.46.1"
|
|
82
93
|
}
|
|
83
94
|
}
|
package/dist/eslint.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/compat";
|
|
2
|
-
import type { Config } from "@sveltejs/kit";
|
|
3
|
-
import type { Linter } from "eslint";
|
|
4
|
-
import type { ConfigWithExtendsArray } from "./eslint.types.js";
|
|
5
|
-
export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
|
|
6
|
-
export interface EslintConfigOptions {
|
|
7
|
-
/**
|
|
8
|
-
* Конфиг свелта для его линтига
|
|
9
|
-
*/
|
|
10
|
-
svelte?: Config;
|
|
11
|
-
/**
|
|
12
|
-
* Использование strict-правил tslint
|
|
13
|
-
*/
|
|
14
|
-
strict?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Путь к проекту (`import.meta.dirname`) для более сложного линтинга типов (TypeChecked)
|
|
17
|
-
*/
|
|
18
|
-
service?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Путь к иному .eslint.ignore
|
|
21
|
-
*/
|
|
22
|
-
ignore?: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Универсальная сборка flat-конфига для 'eslint'.
|
|
26
|
-
*
|
|
27
|
-
* Включает в себя:
|
|
28
|
-
* - .eslint.ignore
|
|
29
|
-
* - globals
|
|
30
|
-
* - javascript
|
|
31
|
-
* - typescript
|
|
32
|
-
* - prettier (отключён)
|
|
33
|
-
* - svelte (опционально)
|
|
34
|
-
*
|
|
35
|
-
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
36
|
-
*/
|
|
37
|
-
export declare const defineConfig: (opts: EslintConfigOptions, ...rest: ConfigWithExtendsArray) => Linter.Config[];
|
package/dist/prettier.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Config, Options } from "prettier";
|
|
2
|
-
/**
|
|
3
|
-
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (`./src/tailwind.css`)
|
|
4
|
-
*/
|
|
5
|
-
export declare const defineConfig: (tailwindStylesheet?: string) => Config;
|
|
6
|
-
/**
|
|
7
|
-
* Форматирование с помощью *prettier*
|
|
8
|
-
*
|
|
9
|
-
* @param content - содержимое
|
|
10
|
-
* @param parser - какой парсер
|
|
11
|
-
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (ex. `./src/tailwind.css`)
|
|
12
|
-
*/
|
|
13
|
-
export declare const pretty: (content: string, parser: Options["parser"], tailwindStylesheet?: string) => Promise<string>;
|
package/dist/prettier.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { format } from "prettier";
|
|
2
|
-
// noinspection TypeScriptCheckImport (у пакетов нет типов)
|
|
3
|
-
import * as css from "prettier-plugin-css-order";
|
|
4
|
-
import * as arrays from "prettier-plugin-multiline-arrays";
|
|
5
|
-
import * as svelte from "prettier-plugin-svelte";
|
|
6
|
-
import * as tailwind from "prettier-plugin-tailwindcss";
|
|
7
|
-
/**
|
|
8
|
-
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (`./src/tailwind.css`)
|
|
9
|
-
*/
|
|
10
|
-
export const defineConfig = (tailwindStylesheet) => ({
|
|
11
|
-
tabWidth: 2,
|
|
12
|
-
useTabs: true,
|
|
13
|
-
printWidth: 150,
|
|
14
|
-
singleQuote: false,
|
|
15
|
-
trailingComma: "es5",
|
|
16
|
-
bracketSameLine: true,
|
|
17
|
-
experimentalTernaries: false,
|
|
18
|
-
multilineArraysWrapThreshold: 3,
|
|
19
|
-
plugins: [
|
|
20
|
-
svelte,
|
|
21
|
-
css,
|
|
22
|
-
arrays,
|
|
23
|
-
tailwind,
|
|
24
|
-
],
|
|
25
|
-
overrides: [
|
|
26
|
-
{
|
|
27
|
-
files: "*.svelte",
|
|
28
|
-
options: { parser: "svelte" },
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
tailwindStylesheet,
|
|
32
|
-
});
|
|
33
|
-
//...
|
|
34
|
-
const config = defineConfig();
|
|
35
|
-
/**
|
|
36
|
-
* Форматирование с помощью *prettier*
|
|
37
|
-
*
|
|
38
|
-
* @param content - содержимое
|
|
39
|
-
* @param parser - какой парсер
|
|
40
|
-
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (ex. `./src/tailwind.css`)
|
|
41
|
-
*/
|
|
42
|
-
export const pretty = (content, parser, tailwindStylesheet) => format(content, { ...config, parser, tailwindStylesheet });
|
|
File without changes
|
|
File without changes
|