@nemigo/configs 1.1.0 → 1.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.
- package/dist/eslint/index.d.ts +3 -2
- package/dist/eslint/index.js +93 -75
- package/dist/index.d.ts +0 -1
- package/dist/prettier/index.d.ts +5 -7
- package/dist/prettier/index.js +3 -6
- package/dist/svelte/index.d.ts +1 -1
- package/dist/svelte/package.d.ts +3 -0
- package/dist/vite/index.d.ts +1 -0
- package/package.json +3 -3
package/dist/eslint/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface EslintConfigOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
strict?: boolean;
|
|
23
23
|
/**
|
|
24
|
-
* Путь к проекту (`import.meta.dirname`) для typed
|
|
24
|
+
* Путь к проекту (`import.meta.dirname`) для typed-linting
|
|
25
25
|
*
|
|
26
26
|
* @see https://typescript-eslint.io/getting-started/typed-linting
|
|
27
27
|
*/
|
|
@@ -37,11 +37,12 @@ export interface EslintConfigOptions {
|
|
|
37
37
|
* Создает готовый flat-конфиг для **ESLint**
|
|
38
38
|
*
|
|
39
39
|
* Включает в себя:
|
|
40
|
-
* -
|
|
40
|
+
* - Глобусы исключений из `.eslint.ignore` пакета или иного
|
|
41
41
|
* - Глобальные переменные для браузера и Node.js (globals)
|
|
42
42
|
* - Рекомендованные правила из `@eslint/js`
|
|
43
43
|
* - Рекомендованные или strict правила из `typescript-eslint`
|
|
44
44
|
* - Опционально: конфигурацию для Svelte
|
|
45
|
+
* - Опционально: typed-linting из `typescript-eslint`
|
|
45
46
|
*
|
|
46
47
|
* Отключены различные правила TypeScript, которые только мешают.
|
|
47
48
|
*
|
package/dist/eslint/index.js
CHANGED
|
@@ -10,11 +10,12 @@ export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePatt
|
|
|
10
10
|
* Создает готовый flat-конфиг для **ESLint**
|
|
11
11
|
*
|
|
12
12
|
* Включает в себя:
|
|
13
|
-
* -
|
|
13
|
+
* - Глобусы исключений из `.eslint.ignore` пакета или иного
|
|
14
14
|
* - Глобальные переменные для браузера и Node.js (globals)
|
|
15
15
|
* - Рекомендованные правила из `@eslint/js`
|
|
16
16
|
* - Рекомендованные или strict правила из `typescript-eslint`
|
|
17
17
|
* - Опционально: конфигурацию для Svelte
|
|
18
|
+
* - Опционально: typed-linting из `typescript-eslint`
|
|
18
19
|
*
|
|
19
20
|
* Отключены различные правила TypeScript, которые только мешают.
|
|
20
21
|
*
|
|
@@ -24,85 +25,102 @@ export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePatt
|
|
|
24
25
|
*
|
|
25
26
|
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
26
27
|
*/
|
|
27
|
-
export const defineEslintConfig = (options, ...rest) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
export const defineEslintConfig = (options, ...rest) => {
|
|
29
|
+
const acc = [];
|
|
30
|
+
acc.push(includeIgnoreFile(options?.ignore || join(import.meta.dirname, "../../.eslint.ignore"), "@nemigo/configs/.eslint.ignore"));
|
|
31
|
+
acc.push(jslint.configs.recommended);
|
|
32
|
+
if (options?.strict) {
|
|
33
|
+
if (options?.service) {
|
|
34
|
+
acc.push(tslint.configs.strictTypeChecked);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
acc.push(tslint.configs.strict);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (options?.service) {
|
|
42
|
+
acc.push(tslint.configs.recommendedTypeChecked);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
acc.push(tslint.configs.recommended);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (options?.service) {
|
|
49
|
+
acc.push({
|
|
50
|
+
languageOptions: {
|
|
51
|
+
parserOptions: {
|
|
52
|
+
projectService: true,
|
|
53
|
+
tsconfigRootDir: options.service,
|
|
54
|
+
},
|
|
39
55
|
},
|
|
40
|
-
}
|
|
56
|
+
});
|
|
41
57
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"@typescript-eslint/no-this-alias": 0,
|
|
63
|
-
"@typescript-eslint/no-unnecessary-type-parameters": 0,
|
|
64
|
-
"@typescript-eslint/no-unsafe-argument": 0,
|
|
65
|
-
"@typescript-eslint/no-unsafe-assignment": 0,
|
|
66
|
-
"@typescript-eslint/no-unsafe-call": 0,
|
|
67
|
-
"@typescript-eslint/no-unsafe-function-type": 0,
|
|
68
|
-
"@typescript-eslint/no-unsafe-member-access": 0,
|
|
69
|
-
"@typescript-eslint/no-unsafe-return": 0,
|
|
70
|
-
"@typescript-eslint/no-unused-expressions": 0,
|
|
71
|
-
"@typescript-eslint/no-unused-vars": [
|
|
72
|
-
"error",
|
|
73
|
-
{
|
|
74
|
-
args: "all",
|
|
75
|
-
argsIgnorePattern: "^_",
|
|
76
|
-
caughtErrors: "all",
|
|
77
|
-
caughtErrorsIgnorePattern: "^_",
|
|
78
|
-
destructuredArrayIgnorePattern: "^_",
|
|
79
|
-
varsIgnorePattern: "^_",
|
|
80
|
-
ignoreRestSiblings: true,
|
|
58
|
+
if (options?.svelte) {
|
|
59
|
+
acc.push(svelteConfigs["flat/recommended"]);
|
|
60
|
+
acc.push({
|
|
61
|
+
files: [
|
|
62
|
+
"**/*.svelte",
|
|
63
|
+
"**/*.svelte.ts",
|
|
64
|
+
"**/*.svelte.js",
|
|
65
|
+
],
|
|
66
|
+
languageOptions: {
|
|
67
|
+
parserOptions: {
|
|
68
|
+
projectService: true,
|
|
69
|
+
extraFileExtensions: [".svelte"],
|
|
70
|
+
parser: tslint.parser,
|
|
71
|
+
svelteConfig: options?.svelte,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
rules: {
|
|
75
|
+
"svelte/no-at-html-tags": 0,
|
|
76
|
+
"svelte/no-navigation-without-resolve": 0,
|
|
77
|
+
"svelte/prefer-svelte-reactivity": 0,
|
|
81
78
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"no-import-assign": 0,
|
|
86
|
-
},
|
|
87
|
-
}, options?.svelte
|
|
88
|
-
? {
|
|
89
|
-
files: [
|
|
90
|
-
"**/*.svelte",
|
|
91
|
-
"**/*.svelte.ts",
|
|
92
|
-
"**/*.svelte.js",
|
|
93
|
-
],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
acc.push({
|
|
94
82
|
languageOptions: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
parser: tslint.parser,
|
|
99
|
-
svelteConfig: options?.svelte,
|
|
83
|
+
globals: {
|
|
84
|
+
...globals.browser,
|
|
85
|
+
...globals.node,
|
|
100
86
|
},
|
|
101
87
|
},
|
|
102
88
|
rules: {
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
89
|
+
"@typescript-eslint/no-confusing-void-expression": 0,
|
|
90
|
+
"@typescript-eslint/no-duplicate-type-constituents": 0,
|
|
91
|
+
"@typescript-eslint/no-dynamic-delete": 0,
|
|
92
|
+
"@typescript-eslint/no-empty-object-type": 0,
|
|
93
|
+
"@typescript-eslint/no-explicit-any": 0,
|
|
94
|
+
"@typescript-eslint/no-invalid-void-type": 0,
|
|
95
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": 0,
|
|
96
|
+
"@typescript-eslint/no-non-null-assertion": 0,
|
|
97
|
+
"@typescript-eslint/no-redundant-type-constituents": 0,
|
|
98
|
+
"@typescript-eslint/no-this-alias": 0,
|
|
99
|
+
"@typescript-eslint/no-unnecessary-type-parameters": 0,
|
|
100
|
+
"@typescript-eslint/no-unsafe-argument": 0,
|
|
101
|
+
"@typescript-eslint/no-unsafe-assignment": 0,
|
|
102
|
+
"@typescript-eslint/no-unsafe-call": 0,
|
|
103
|
+
"@typescript-eslint/no-unsafe-function-type": 0,
|
|
104
|
+
"@typescript-eslint/no-unsafe-member-access": 0,
|
|
105
|
+
"@typescript-eslint/no-unsafe-return": 0,
|
|
106
|
+
"@typescript-eslint/no-unused-expressions": 0,
|
|
107
|
+
"@typescript-eslint/no-unused-vars": [
|
|
108
|
+
"error",
|
|
109
|
+
{
|
|
110
|
+
args: "all",
|
|
111
|
+
argsIgnorePattern: "^_",
|
|
112
|
+
caughtErrors: "all",
|
|
113
|
+
caughtErrorsIgnorePattern: "^_",
|
|
114
|
+
destructuredArrayIgnorePattern: "^_",
|
|
115
|
+
varsIgnorePattern: "^_",
|
|
116
|
+
ignoreRestSiblings: true,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
"@typescript-eslint/restrict-plus-operands": 0,
|
|
120
|
+
"@typescript-eslint/restrict-template-expressions": 0,
|
|
121
|
+
"no-import-assign": 0,
|
|
106
122
|
},
|
|
107
|
-
}
|
|
108
|
-
|
|
123
|
+
});
|
|
124
|
+
acc.push(...rest);
|
|
125
|
+
return defineConfig(acc);
|
|
126
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/prettier/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface PrettierConfigOptions {
|
|
|
15
15
|
*
|
|
16
16
|
* @default 3
|
|
17
17
|
* @alias MultilineArrayOptions.multilineArraysWrapThreshold
|
|
18
|
+
*
|
|
18
19
|
* @see https://www.npmjs.com/package/prettier-plugin-multiline-arrays
|
|
19
20
|
*/
|
|
20
21
|
arraysWrapThreshold?: number;
|
|
@@ -68,21 +69,18 @@ export declare const definePrettierConfig: (options?: PrettierConfigOptions) =>
|
|
|
68
69
|
* // Форматирование TypeScript кода
|
|
69
70
|
* const formatted = await pretty(`const x=1`, 'typescript');
|
|
70
71
|
*
|
|
71
|
-
* // Форматирование Svelte
|
|
72
|
-
* const formatted = await pretty(`<div>hello</div>`, 'svelte'
|
|
73
|
-
*
|
|
74
|
-
* // Форматирование с кастомными опциями
|
|
75
|
-
* const formatted = await pretty(`const x=1`, 'typescript', {
|
|
72
|
+
* // Форматирование Svelte-компонента с кастомными опциями
|
|
73
|
+
* const formatted = await pretty(`<div class="bg-red-500 border border-blue-700">hello</div>`, 'svelte', {
|
|
76
74
|
* arraysWrapThreshold: 5,
|
|
77
75
|
* tailwind: { stylesheet: './src/tailwind.css' }
|
|
78
76
|
* });
|
|
79
77
|
* ```
|
|
80
78
|
*
|
|
81
79
|
* @param {string} content - Исходный код для форматирования
|
|
82
|
-
* @param {Options["parser"]} parser - Парсер для определения типа кода
|
|
80
|
+
* @param {Options["parser"] | "svelte"} parser - Парсер для определения типа кода
|
|
83
81
|
* @param {PrettierConfigOptions} [options] - Дополнительные опции конфигурации
|
|
84
82
|
* @returns {Promise<string>} Отформатированный код
|
|
85
83
|
*
|
|
86
84
|
* @see https://prettier.io/docs/api#format
|
|
87
85
|
*/
|
|
88
|
-
export declare const pretty: (content: string, parser: Options["parser"], options?: PrettierConfigOptions) => Promise<string>;
|
|
86
|
+
export declare const pretty: (content: string, parser: Options["parser"] | "svelte", options?: PrettierConfigOptions) => Promise<string>;
|
package/dist/prettier/index.js
CHANGED
|
@@ -59,18 +59,15 @@ const config = definePrettierConfig();
|
|
|
59
59
|
* // Форматирование TypeScript кода
|
|
60
60
|
* const formatted = await pretty(`const x=1`, 'typescript');
|
|
61
61
|
*
|
|
62
|
-
* // Форматирование Svelte
|
|
63
|
-
* const formatted = await pretty(`<div>hello</div>`, 'svelte'
|
|
64
|
-
*
|
|
65
|
-
* // Форматирование с кастомными опциями
|
|
66
|
-
* const formatted = await pretty(`const x=1`, 'typescript', {
|
|
62
|
+
* // Форматирование Svelte-компонента с кастомными опциями
|
|
63
|
+
* const formatted = await pretty(`<div class="bg-red-500 border border-blue-700">hello</div>`, 'svelte', {
|
|
67
64
|
* arraysWrapThreshold: 5,
|
|
68
65
|
* tailwind: { stylesheet: './src/tailwind.css' }
|
|
69
66
|
* });
|
|
70
67
|
* ```
|
|
71
68
|
*
|
|
72
69
|
* @param {string} content - Исходный код для форматирования
|
|
73
|
-
* @param {Options["parser"]} parser - Парсер для определения типа кода
|
|
70
|
+
* @param {Options["parser"] | "svelte"} parser - Парсер для определения типа кода
|
|
74
71
|
* @param {PrettierConfigOptions} [options] - Дополнительные опции конфигурации
|
|
75
72
|
* @returns {Promise<string>} Отформатированный код
|
|
76
73
|
*
|
package/dist/svelte/index.d.ts
CHANGED
package/dist/svelte/package.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface SveltePackageConfigOptions {
|
|
|
8
8
|
*
|
|
9
9
|
* @default true
|
|
10
10
|
* @alias Config.compilerOptions.runes
|
|
11
|
+
*
|
|
11
12
|
* @see https://svelte.dev/docs/svelte/what-are-runes
|
|
12
13
|
*/
|
|
13
14
|
runes?: boolean;
|
|
@@ -16,6 +17,7 @@ export interface SveltePackageConfigOptions {
|
|
|
16
17
|
*
|
|
17
18
|
* @default true
|
|
18
19
|
* @alias Config.kit.alias
|
|
20
|
+
*
|
|
19
21
|
* @see https://svelte.dev/docs/kit/configuration#alias
|
|
20
22
|
*/
|
|
21
23
|
isolate?: boolean;
|
|
@@ -31,6 +33,7 @@ export interface SveltePackageConfigOptions {
|
|
|
31
33
|
*
|
|
32
34
|
* @default "./src"
|
|
33
35
|
* @alias Config.kit.files.lib
|
|
36
|
+
*
|
|
34
37
|
* @see https://svelte.dev/docs/kit/configuration#files
|
|
35
38
|
*/
|
|
36
39
|
path?: string;
|
package/dist/vite/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nemigo/configs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Vlad Logvin",
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@eslint/compat": "1.4.0",
|
|
83
|
-
"@eslint/js": "9.
|
|
83
|
+
"@eslint/js": "9.38.0",
|
|
84
84
|
"@types/eslint": "9.6.1",
|
|
85
85
|
"eslint-plugin-svelte": "3.12.4",
|
|
86
86
|
"globals": "16.4.0",
|
|
87
87
|
"prettier-plugin-css-order": "2.1.2",
|
|
88
88
|
"prettier-plugin-multiline-arrays": "4.0.3",
|
|
89
89
|
"prettier-plugin-svelte": "3.4.0",
|
|
90
|
-
"prettier-plugin-tailwindcss": "0.7.
|
|
90
|
+
"prettier-plugin-tailwindcss": "0.7.1",
|
|
91
91
|
"typescript-eslint": "8.46.1"
|
|
92
92
|
}
|
|
93
93
|
}
|