@nemigo/configs 0.0.3 → 0.1.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.d.ts +18 -6
- package/dist/eslint.js +36 -35
- package/dist/eslint.types.d.ts +8 -0
- package/dist/eslint.types.js +4 -0
- package/dist/prettier.d.ts +12 -2
- package/dist/prettier.js +16 -4
- package/dist/svelte/package.d.ts +2 -0
- package/dist/svelte/package.js +1 -1
- package/package.json +8 -4
package/dist/eslint.d.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import { includeIgnoreFile } from "@eslint/compat";
|
|
1
|
+
import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/compat";
|
|
2
2
|
import type { Config } from "@sveltejs/kit";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Linter } from "eslint";
|
|
4
|
+
import type { ConfigWithExtendsArray } from "./eslint.types.js";
|
|
5
|
+
export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
|
|
4
6
|
export interface EslintConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Конфиг свелта для его линтига
|
|
9
|
+
*/
|
|
5
10
|
svelte?: Config;
|
|
11
|
+
/**
|
|
12
|
+
* Использование strict-правил tslint
|
|
13
|
+
*/
|
|
6
14
|
strict?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Обычно `import.meta.dirname`. Для более сложного линтинга типов (TypeChecked)
|
|
17
|
+
*/
|
|
7
18
|
service?: string;
|
|
8
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Путь к своему .eslint.ignore
|
|
21
|
+
*/
|
|
22
|
+
ignore?: string;
|
|
9
23
|
}
|
|
10
|
-
export { includeIgnoreFile };
|
|
11
24
|
/**
|
|
12
25
|
* Универсальная сборка flat-конфига для 'eslint'.
|
|
13
|
-
* Взята из `npx sv create`
|
|
14
26
|
*
|
|
15
27
|
* Включает в себя:
|
|
16
28
|
* - .eslint.ignore
|
|
@@ -22,4 +34,4 @@ export { includeIgnoreFile };
|
|
|
22
34
|
*
|
|
23
35
|
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
24
36
|
*/
|
|
25
|
-
export declare const defineConfig: (
|
|
37
|
+
export declare const defineConfig: (opts: EslintConfigOptions, ...rest: ConfigWithExtendsArray) => Linter.Config[];
|
package/dist/eslint.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { includeIgnoreFile } from "@eslint/compat";
|
|
1
|
+
import { convertIgnorePatternToMinimatch, includeIgnoreFile } from "@eslint/compat";
|
|
2
2
|
import jslint from "@eslint/js";
|
|
3
3
|
// import prettier from "eslint-config-prettier";
|
|
4
4
|
import { configs as svelteConfigs } from "eslint-plugin-svelte";
|
|
5
|
+
import { defineConfig as eslintDefineConfig } from "eslint/config";
|
|
5
6
|
import globals from "globals";
|
|
6
7
|
import { join } from "node:path";
|
|
7
8
|
import tslint from "typescript-eslint";
|
|
8
|
-
export { includeIgnoreFile };
|
|
9
|
+
export { includeIgnoreFile, convertIgnorePatternToMinimatch as convertIgnorePattern };
|
|
9
10
|
/**
|
|
10
11
|
* Универсальная сборка flat-конфига для 'eslint'.
|
|
11
|
-
* Взята из `npx sv create`
|
|
12
12
|
*
|
|
13
13
|
* Включает в себя:
|
|
14
14
|
* - .eslint.ignore
|
|
@@ -20,59 +20,38 @@ export { includeIgnoreFile };
|
|
|
20
20
|
*
|
|
21
21
|
* @see https://eslint.org/docs/latest/use/configure/configuration-files
|
|
22
22
|
*/
|
|
23
|
-
export const defineConfig = (
|
|
24
|
-
? service
|
|
23
|
+
export const defineConfig = (opts, ...rest) => eslintDefineConfig(includeIgnoreFile(opts.ignore || join(import.meta.dirname, "../.eslint.ignore"), "@nemigo/configs/.eslint.ignore"), jslint.configs.recommended, ...(opts.strict
|
|
24
|
+
? opts.service
|
|
25
25
|
? tslint.configs.strictTypeChecked
|
|
26
26
|
: tslint.configs.strict
|
|
27
|
-
: service
|
|
27
|
+
: opts.service
|
|
28
28
|
? tslint.configs.recommendedTypeChecked
|
|
29
|
-
: tslint.configs.recommended),
|
|
30
|
-
// prettier,
|
|
31
|
-
// ...(svelte ? svelteConfigs["flat/prettier"] : []),
|
|
32
|
-
service
|
|
29
|
+
: tslint.configs.recommended), opts.service
|
|
33
30
|
? {
|
|
34
31
|
languageOptions: {
|
|
35
32
|
parserOptions: {
|
|
36
33
|
projectService: true,
|
|
37
|
-
tsconfigRootDir: service,
|
|
34
|
+
tsconfigRootDir: opts.service,
|
|
38
35
|
},
|
|
39
36
|
},
|
|
40
37
|
}
|
|
41
|
-
: {},
|
|
38
|
+
: {}, ...(opts.svelte ? svelteConfigs["flat/recommended"] : []),
|
|
39
|
+
// prettier,
|
|
40
|
+
// ...(svelte ? svelteConfigs["flat/prettier"] : []),
|
|
41
|
+
{
|
|
42
42
|
languageOptions: {
|
|
43
43
|
globals: {
|
|
44
44
|
...globals.browser,
|
|
45
45
|
...globals.node,
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
|
-
}, svelte
|
|
49
|
-
? {
|
|
50
|
-
files: [
|
|
51
|
-
"./**/*.svelte",
|
|
52
|
-
"./**/*.svelte.{ts,js}",
|
|
53
|
-
"./**/*.svelte.{test,spec}.{ts,js}",
|
|
54
|
-
],
|
|
55
|
-
languageOptions: {
|
|
56
|
-
parserOptions: {
|
|
57
|
-
projectService: true,
|
|
58
|
-
extraFileExtensions: [".svelte"],
|
|
59
|
-
parser: tslint.parser,
|
|
60
|
-
svelteConfig: svelte,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
rules: {
|
|
64
|
-
"svelte/no-at-html-tags": 0,
|
|
65
|
-
"svelte/no-navigation-without-resolve": 0,
|
|
66
|
-
"svelte/prefer-svelte-reactivity": 0,
|
|
67
|
-
},
|
|
68
|
-
}
|
|
69
|
-
: {}, {
|
|
70
48
|
rules: {
|
|
71
49
|
"@typescript-eslint/no-confusing-void-expression": 0,
|
|
72
50
|
"@typescript-eslint/no-duplicate-type-constituents": 0,
|
|
73
51
|
"@typescript-eslint/no-dynamic-delete": 0,
|
|
74
52
|
"@typescript-eslint/no-empty-object-type": 0,
|
|
75
53
|
"@typescript-eslint/no-explicit-any": 0,
|
|
54
|
+
"@typescript-eslint/no-invalid-void-type": 0,
|
|
76
55
|
"@typescript-eslint/no-non-null-asserted-optional-chain": 0,
|
|
77
56
|
"@typescript-eslint/no-non-null-assertion": 0,
|
|
78
57
|
"@typescript-eslint/no-redundant-type-constituents": 0,
|
|
@@ -81,6 +60,7 @@ service
|
|
|
81
60
|
"@typescript-eslint/no-unsafe-argument": 0,
|
|
82
61
|
"@typescript-eslint/no-unsafe-assignment": 0,
|
|
83
62
|
"@typescript-eslint/no-unsafe-call": 0,
|
|
63
|
+
"@typescript-eslint/no-unsafe-function-type": 0,
|
|
84
64
|
"@typescript-eslint/no-unsafe-member-access": 0,
|
|
85
65
|
"@typescript-eslint/no-unsafe-return": 0,
|
|
86
66
|
"@typescript-eslint/no-unused-expressions": 0,
|
|
@@ -100,4 +80,25 @@ service
|
|
|
100
80
|
"@typescript-eslint/restrict-template-expressions": 0,
|
|
101
81
|
"no-import-assign": 0,
|
|
102
82
|
},
|
|
103
|
-
},
|
|
83
|
+
}, opts.svelte
|
|
84
|
+
? {
|
|
85
|
+
files: [
|
|
86
|
+
"**/*.svelte",
|
|
87
|
+
"**/*.svelte.ts",
|
|
88
|
+
"**/*.svelte.js",
|
|
89
|
+
],
|
|
90
|
+
languageOptions: {
|
|
91
|
+
parserOptions: {
|
|
92
|
+
projectService: true,
|
|
93
|
+
extraFileExtensions: [".svelte"],
|
|
94
|
+
parser: tslint.parser,
|
|
95
|
+
svelteConfig: opts.svelte,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
rules: {
|
|
99
|
+
"svelte/no-at-html-tags": 0,
|
|
100
|
+
"svelte/no-navigation-without-resolve": 0,
|
|
101
|
+
"svelte/prefer-svelte-reactivity": 0,
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
: {}, ...rest);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Linter } from "eslint";
|
|
2
|
+
export type InfiniteArray<T> = T | InfiniteArray<T>[];
|
|
3
|
+
export type SimpleExtendsElement = string | Linter.Config;
|
|
4
|
+
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<Linter.Config>;
|
|
5
|
+
export interface ConfigWithExtends extends Linter.Config {
|
|
6
|
+
extends?: ExtendsElement[];
|
|
7
|
+
}
|
|
8
|
+
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];
|
package/dist/prettier.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import type { Config, Options } from "prettier";
|
|
2
|
-
|
|
3
|
-
|
|
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 (`./src/tailwind.css`)
|
|
12
|
+
*/
|
|
13
|
+
export declare const pretty: (content: string, parser: Options["parser"], tailwindStylesheet?: string) => Promise<string>;
|
package/dist/prettier.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { format } from "prettier";
|
|
2
|
-
|
|
2
|
+
// noinspection TypeScriptCheckImport (у пакетов нет типов)
|
|
3
3
|
import * as css from "prettier-plugin-css-order";
|
|
4
4
|
import * as arrays from "prettier-plugin-multiline-arrays";
|
|
5
|
+
import * as svelte from "prettier-plugin-svelte";
|
|
5
6
|
import * as tailwind from "prettier-plugin-tailwindcss";
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (`./src/tailwind.css`)
|
|
9
|
+
*/
|
|
10
|
+
export const defineConfig = (tailwindStylesheet) => ({
|
|
7
11
|
tabWidth: 2,
|
|
8
12
|
useTabs: true,
|
|
9
13
|
printWidth: 150,
|
|
@@ -24,7 +28,15 @@ export const defineConfig = () => ({
|
|
|
24
28
|
options: { parser: "svelte" },
|
|
25
29
|
},
|
|
26
30
|
],
|
|
31
|
+
tailwindStylesheet,
|
|
27
32
|
});
|
|
28
33
|
//...
|
|
29
|
-
const
|
|
30
|
-
|
|
34
|
+
const config = defineConfig();
|
|
35
|
+
/**
|
|
36
|
+
* Форматирование с помощью *prettier*
|
|
37
|
+
*
|
|
38
|
+
* @param content - содержимое
|
|
39
|
+
* @param parser - какой парсер
|
|
40
|
+
* @param tailwindStylesheet - путь к конфигу Tailwind V4 (`./src/tailwind.css`)
|
|
41
|
+
*/
|
|
42
|
+
export const pretty = (content, parser, tailwindStylesheet) => format(content, { ...config, parser, tailwindStylesheet });
|
package/dist/svelte/package.d.ts
CHANGED
package/dist/svelte/package.js
CHANGED
|
@@ -24,7 +24,7 @@ export const definePackageConfig = ({ runes = true, isolate = true, alias = {} }
|
|
|
24
24
|
*/
|
|
25
25
|
preprocess: vitePreprocess({ script: true }),
|
|
26
26
|
/**
|
|
27
|
-
* Алиас корня пакета и его путь
|
|
27
|
+
* Алиас корня пакета и его путь (+ алиасы от проекта)
|
|
28
28
|
*/
|
|
29
29
|
kit: {
|
|
30
30
|
files: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nemigo/configs",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Vlad Logvin",
|
|
@@ -17,10 +17,17 @@
|
|
|
17
17
|
"typescript.json"
|
|
18
18
|
],
|
|
19
19
|
"exports": {
|
|
20
|
+
"./.eslint.ignore": {
|
|
21
|
+
"default": "./.eslint.ignore"
|
|
22
|
+
},
|
|
20
23
|
"./eslint": {
|
|
21
24
|
"types": "./dist/eslint.d.ts",
|
|
22
25
|
"default": "./dist/eslint.js"
|
|
23
26
|
},
|
|
27
|
+
"./eslint/types": {
|
|
28
|
+
"types": "./dist/eslint/types.d.ts",
|
|
29
|
+
"default": "./dist/eslint/types.js"
|
|
30
|
+
},
|
|
24
31
|
"./prettier": {
|
|
25
32
|
"types": "./dist/prettier.d.ts",
|
|
26
33
|
"default": "./dist/prettier.js"
|
|
@@ -31,9 +38,6 @@
|
|
|
31
38
|
},
|
|
32
39
|
"./typescript.json": {
|
|
33
40
|
"default": "./typescript.json"
|
|
34
|
-
},
|
|
35
|
-
"./.eslint.ignore": {
|
|
36
|
-
"default": "./.eslint.ignore"
|
|
37
41
|
}
|
|
38
42
|
},
|
|
39
43
|
"peerDependencies": {
|