dlzn-ui 1.25.0 → 1.26.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/node/eslint-config.d.ts +3 -0
- package/node/eslint-config.mjs +196 -0
- package/node/prettier-config.d.ts +29 -0
- package/node/prettier-config.mjs +28 -0
- package/node/stylelint-config.d.ts +43 -0
- package/node/stylelint-config.mjs +48 -0
- package/node/utils/index.d.ts +1 -0
- package/node/utils/index.mjs +13 -0
- package/node/vite-config.d.ts +8 -0
- package/node/vite-config.mjs +14 -0
- package/package.json +18 -6
- package/eslint-config.mjs +0 -224
- package/prettier-config.mjs +0 -49
- package/stylelint-config.mjs +0 -73
- package/vite-config.mjs +0 -52
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import prettier_config_default from "./prettier-config.mjs";
|
|
2
|
+
import antfu, { perfectionist } from "@antfu/eslint-config";
|
|
3
|
+
import perfectionist$1 from "eslint-plugin-perfectionist";
|
|
4
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
5
|
+
//#region node/eslint-config.ts
|
|
6
|
+
var eslintConfig = perfectionist({}).then((perfectionistConfig) => antfu({
|
|
7
|
+
formatters: {
|
|
8
|
+
css: true,
|
|
9
|
+
html: true,
|
|
10
|
+
markdown: true,
|
|
11
|
+
prettierOptions: {
|
|
12
|
+
...prettier_config_default,
|
|
13
|
+
xmlQuoteAttributes: "preserve",
|
|
14
|
+
xmlSelfClosingSpace: true,
|
|
15
|
+
xmlSortAttributesByKey: true,
|
|
16
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
17
|
+
},
|
|
18
|
+
svg: true,
|
|
19
|
+
xml: true
|
|
20
|
+
},
|
|
21
|
+
ignores: [
|
|
22
|
+
"folder-alias.json",
|
|
23
|
+
"src/plugins/echarts/china.json",
|
|
24
|
+
"src/layout/vueBits/**/*.vue"
|
|
25
|
+
],
|
|
26
|
+
jsonc: { overrides: {
|
|
27
|
+
"jsonc/sort-array-values": ["error", {
|
|
28
|
+
minValues: 2,
|
|
29
|
+
order: {
|
|
30
|
+
caseSensitive: true,
|
|
31
|
+
natural: true,
|
|
32
|
+
type: "asc"
|
|
33
|
+
},
|
|
34
|
+
pathPattern: ".*"
|
|
35
|
+
}],
|
|
36
|
+
"jsonc/sort-keys": [
|
|
37
|
+
"error",
|
|
38
|
+
"asc",
|
|
39
|
+
{
|
|
40
|
+
allowLineSeparatedGroups: false,
|
|
41
|
+
caseSensitive: true,
|
|
42
|
+
minKeys: 2,
|
|
43
|
+
natural: true
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
} },
|
|
47
|
+
markdown: false,
|
|
48
|
+
perfectionist: true,
|
|
49
|
+
stylistic: {
|
|
50
|
+
indent: 2,
|
|
51
|
+
jsx: true,
|
|
52
|
+
overrides: { "style/padding-line-between-statements": [
|
|
53
|
+
"error",
|
|
54
|
+
{
|
|
55
|
+
blankLine: "never",
|
|
56
|
+
next: "*",
|
|
57
|
+
prev: "*"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
blankLine: "always",
|
|
61
|
+
next: "*",
|
|
62
|
+
prev: [
|
|
63
|
+
"import",
|
|
64
|
+
"export",
|
|
65
|
+
"class",
|
|
66
|
+
"function",
|
|
67
|
+
"multiline-block-like",
|
|
68
|
+
"const",
|
|
69
|
+
"let",
|
|
70
|
+
"var"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
blankLine: "always",
|
|
75
|
+
next: [
|
|
76
|
+
"export",
|
|
77
|
+
"class",
|
|
78
|
+
"function",
|
|
79
|
+
"multiline-block-like",
|
|
80
|
+
"const",
|
|
81
|
+
"let",
|
|
82
|
+
"var"
|
|
83
|
+
],
|
|
84
|
+
prev: "*"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
blankLine: "never",
|
|
88
|
+
next: "import",
|
|
89
|
+
prev: "import"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
blankLine: "never",
|
|
93
|
+
next: "export",
|
|
94
|
+
prev: "export"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
blankLine: "never",
|
|
98
|
+
next: [
|
|
99
|
+
"const",
|
|
100
|
+
"let",
|
|
101
|
+
"var"
|
|
102
|
+
],
|
|
103
|
+
prev: [
|
|
104
|
+
"const",
|
|
105
|
+
"let",
|
|
106
|
+
"var"
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
] },
|
|
110
|
+
quotes: "single",
|
|
111
|
+
semi: false
|
|
112
|
+
},
|
|
113
|
+
typescript: {
|
|
114
|
+
overrides: { "prefer-promise-reject-errors": "off" },
|
|
115
|
+
overridesTypeAware: {
|
|
116
|
+
"ts/no-floating-promises": "off",
|
|
117
|
+
"ts/no-unsafe-assignment": "off",
|
|
118
|
+
"ts/promise-function-async": "off",
|
|
119
|
+
"ts/strict-boolean-expressions": ["error", {
|
|
120
|
+
allowAny: false,
|
|
121
|
+
allowNullableBoolean: true,
|
|
122
|
+
allowNullableEnum: false,
|
|
123
|
+
allowNullableNumber: false,
|
|
124
|
+
allowNullableObject: false,
|
|
125
|
+
allowNullableString: true,
|
|
126
|
+
allowNumber: false,
|
|
127
|
+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
128
|
+
allowString: true
|
|
129
|
+
}],
|
|
130
|
+
"ts/unbound-method": "off"
|
|
131
|
+
},
|
|
132
|
+
tsconfigPath: "tsconfig.json"
|
|
133
|
+
},
|
|
134
|
+
vue: { overrides: {
|
|
135
|
+
"vue/attributes-order": ["error", {
|
|
136
|
+
alphabetical: true,
|
|
137
|
+
ignoreVBindObject: false,
|
|
138
|
+
order: [
|
|
139
|
+
"DEFINITION",
|
|
140
|
+
"LIST_RENDERING",
|
|
141
|
+
"CONDITIONALS",
|
|
142
|
+
"RENDER_MODIFIERS",
|
|
143
|
+
"GLOBAL",
|
|
144
|
+
["UNIQUE", "SLOT"],
|
|
145
|
+
"TWO_WAY_BINDING",
|
|
146
|
+
"OTHER_DIRECTIVES",
|
|
147
|
+
"OTHER_ATTR",
|
|
148
|
+
"EVENTS",
|
|
149
|
+
"CONTENT"
|
|
150
|
+
],
|
|
151
|
+
sortLineLength: false
|
|
152
|
+
}],
|
|
153
|
+
"vue/component-name-in-template-casing": [
|
|
154
|
+
"error",
|
|
155
|
+
"PascalCase",
|
|
156
|
+
{ registeredComponentsOnly: false }
|
|
157
|
+
],
|
|
158
|
+
"vue/html-self-closing": ["error", {
|
|
159
|
+
html: {
|
|
160
|
+
component: "never",
|
|
161
|
+
normal: "never",
|
|
162
|
+
void: "always"
|
|
163
|
+
},
|
|
164
|
+
math: "always",
|
|
165
|
+
svg: "always"
|
|
166
|
+
}],
|
|
167
|
+
"vue/padding-line-between-tags": ["error", [{
|
|
168
|
+
blankLine: "never",
|
|
169
|
+
next: "*",
|
|
170
|
+
prev: "*"
|
|
171
|
+
}]],
|
|
172
|
+
"vue/prop-name-casing": [
|
|
173
|
+
"error",
|
|
174
|
+
"camelCase",
|
|
175
|
+
{ ignoreProps: ["/^onUpdate:*/"] }
|
|
176
|
+
],
|
|
177
|
+
"vue/singleline-html-element-content-newline": "off"
|
|
178
|
+
} }
|
|
179
|
+
}, { rules: {
|
|
180
|
+
"e18e/ban-dependencies": ["error", { allowed: ["crypto-js"] }],
|
|
181
|
+
"no-console": "off"
|
|
182
|
+
} }).override(perfectionistConfig[0].name, { rules: {
|
|
183
|
+
...perfectionist$1.configs["recommended-natural"].rules,
|
|
184
|
+
...perfectionistConfig[0].rules
|
|
185
|
+
} }).append({
|
|
186
|
+
ignores: [
|
|
187
|
+
"**/*.md",
|
|
188
|
+
"**/*.html",
|
|
189
|
+
"**/*.xml",
|
|
190
|
+
"**/*.svg",
|
|
191
|
+
"**/*.jsonc"
|
|
192
|
+
],
|
|
193
|
+
...eslintPluginPrettierRecommended
|
|
194
|
+
}));
|
|
195
|
+
//#endregion
|
|
196
|
+
export { eslintConfig as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: https://prettier.io/docs/en/options
|
|
3
|
+
* @description: 还有些是 prettier-plugin-tailwindcss 的配置 https://github.com/tailwindlabs/prettier-plugin-tailwindcss
|
|
4
|
+
*/
|
|
5
|
+
declare const _default: {
|
|
6
|
+
$schema: string;
|
|
7
|
+
arrowParens: "always";
|
|
8
|
+
bracketSameLine: false;
|
|
9
|
+
bracketSpacing: true;
|
|
10
|
+
embeddedLanguageFormatting: "auto";
|
|
11
|
+
endOfLine: "lf";
|
|
12
|
+
htmlWhitespaceSensitivity: "css";
|
|
13
|
+
insertPragma: false;
|
|
14
|
+
jsxSingleQuote: false;
|
|
15
|
+
plugins: string[];
|
|
16
|
+
printWidth: number;
|
|
17
|
+
proseWrap: "preserve";
|
|
18
|
+
quoteProps: "as-needed";
|
|
19
|
+
requirePragma: false;
|
|
20
|
+
semi: false;
|
|
21
|
+
singleAttributePerLine: false;
|
|
22
|
+
singleQuote: true;
|
|
23
|
+
tabWidth: number;
|
|
24
|
+
tailwindStylesheet: string;
|
|
25
|
+
trailingComma: "all";
|
|
26
|
+
useTabs: false;
|
|
27
|
+
vueIndentScriptAndStyle: false;
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { resolveOne } from "./utils/index.mjs";
|
|
2
|
+
//#region node/prettier-config.ts
|
|
3
|
+
var prettier_config_default = {
|
|
4
|
+
$schema: "https://json.schemastore.org/prettierrc",
|
|
5
|
+
arrowParens: "always",
|
|
6
|
+
bracketSameLine: false,
|
|
7
|
+
bracketSpacing: true,
|
|
8
|
+
embeddedLanguageFormatting: "auto",
|
|
9
|
+
endOfLine: "lf",
|
|
10
|
+
htmlWhitespaceSensitivity: "css",
|
|
11
|
+
insertPragma: false,
|
|
12
|
+
jsxSingleQuote: false,
|
|
13
|
+
plugins: ["prettier-plugin-tailwindcss"],
|
|
14
|
+
printWidth: 100,
|
|
15
|
+
proseWrap: "preserve",
|
|
16
|
+
quoteProps: "as-needed",
|
|
17
|
+
requirePragma: false,
|
|
18
|
+
semi: false,
|
|
19
|
+
singleAttributePerLine: false,
|
|
20
|
+
singleQuote: true,
|
|
21
|
+
tabWidth: 2,
|
|
22
|
+
tailwindStylesheet: resolveOne(["node_modules/dlzn-ui/assets/css/tailwindcss-entry.css", "src/assets/css/tailwindcss-entry.css"]),
|
|
23
|
+
trailingComma: "all",
|
|
24
|
+
useTabs: false,
|
|
25
|
+
vueIndentScriptAndStyle: false
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { prettier_config_default as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
cache: true;
|
|
3
|
+
extends: string[];
|
|
4
|
+
ignoreFiles: string[];
|
|
5
|
+
overrides: ({
|
|
6
|
+
customSyntax: string;
|
|
7
|
+
files: string[];
|
|
8
|
+
rules?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
files: string[];
|
|
11
|
+
rules: {
|
|
12
|
+
'no-descending-specificity': null;
|
|
13
|
+
'no-duplicate-selectors': null;
|
|
14
|
+
'selector-class-pattern': null;
|
|
15
|
+
};
|
|
16
|
+
customSyntax?: undefined;
|
|
17
|
+
})[];
|
|
18
|
+
plugins: string[];
|
|
19
|
+
rules: {
|
|
20
|
+
'@stylistic/declaration-block-trailing-semicolon': null;
|
|
21
|
+
'@stylistic/declaration-colon-newline-after': null;
|
|
22
|
+
'@stylistic/declaration-colon-space-after': null;
|
|
23
|
+
'@stylistic/indentation': null;
|
|
24
|
+
'@stylistic/no-eol-whitespace': null;
|
|
25
|
+
'@stylistic/selector-combinator-space-before': null;
|
|
26
|
+
'@stylistic/string-quotes': null;
|
|
27
|
+
'@stylistic/value-list-comma-newline-after': null;
|
|
28
|
+
'at-rule-no-unknown': (boolean | {
|
|
29
|
+
ignoreAtRules: string[];
|
|
30
|
+
})[];
|
|
31
|
+
'csstools/use-nesting': (string | {
|
|
32
|
+
message: string;
|
|
33
|
+
})[];
|
|
34
|
+
'import-notation': string;
|
|
35
|
+
'selector-class-pattern': (string | {
|
|
36
|
+
message: string;
|
|
37
|
+
})[];
|
|
38
|
+
'value-keyword-case': (string | {
|
|
39
|
+
ignoreFunctions: string[];
|
|
40
|
+
})[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region node/stylelint-config.ts
|
|
2
|
+
var stylelint_config_default = {
|
|
3
|
+
cache: true,
|
|
4
|
+
extends: [
|
|
5
|
+
"@stylistic/stylelint-config",
|
|
6
|
+
"stylelint-config-standard",
|
|
7
|
+
"stylelint-config-recess-order",
|
|
8
|
+
"stylelint-config-recommended-vue"
|
|
9
|
+
],
|
|
10
|
+
ignoreFiles: [
|
|
11
|
+
"**/*.min.css",
|
|
12
|
+
".vscode/**",
|
|
13
|
+
".idea/**",
|
|
14
|
+
"node_modules/**",
|
|
15
|
+
"dist/**",
|
|
16
|
+
"public/**",
|
|
17
|
+
"dist-ssr/**"
|
|
18
|
+
],
|
|
19
|
+
overrides: [{
|
|
20
|
+
customSyntax: "postcss-markdown",
|
|
21
|
+
files: ["*.md", "**/*.md"]
|
|
22
|
+
}, {
|
|
23
|
+
files: ["src/plugins/element-plus/theme-chalk/**/*.css"],
|
|
24
|
+
rules: {
|
|
25
|
+
"no-descending-specificity": null,
|
|
26
|
+
"no-duplicate-selectors": null,
|
|
27
|
+
"selector-class-pattern": null
|
|
28
|
+
}
|
|
29
|
+
}],
|
|
30
|
+
plugins: ["stylelint-use-nesting"],
|
|
31
|
+
rules: {
|
|
32
|
+
"@stylistic/declaration-block-trailing-semicolon": null,
|
|
33
|
+
"@stylistic/declaration-colon-newline-after": null,
|
|
34
|
+
"@stylistic/declaration-colon-space-after": null,
|
|
35
|
+
"@stylistic/indentation": null,
|
|
36
|
+
"@stylistic/no-eol-whitespace": null,
|
|
37
|
+
"@stylistic/selector-combinator-space-before": null,
|
|
38
|
+
"@stylistic/string-quotes": null,
|
|
39
|
+
"@stylistic/value-list-comma-newline-after": null,
|
|
40
|
+
"at-rule-no-unknown": [true, { ignoreAtRules: ["theme"] }],
|
|
41
|
+
"csstools/use-nesting": ["always", { message: "尽量使用嵌套写法" }],
|
|
42
|
+
"import-notation": "string",
|
|
43
|
+
"selector-class-pattern": ["^(t-|el-|([a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9])$)", { message: "自定义 class 名称使用 snake_case" }],
|
|
44
|
+
"value-keyword-case": ["lower", { ignoreFunctions: ["v-bind"] }]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { stylelint_config_default as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveOne(paths: string[]): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { cwd } from "node:process";
|
|
4
|
+
//#region node/utils/index.ts
|
|
5
|
+
function resolveOne(paths) {
|
|
6
|
+
const root = cwd();
|
|
7
|
+
const arr = paths.map((path) => resolve(root, path));
|
|
8
|
+
const result = arr.findIndex((file) => existsSync(file));
|
|
9
|
+
if (result === -1) throw new Error(`resolveOne: path not found: ${paths.join(", ")}`);
|
|
10
|
+
return arr[result];
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { resolveOne };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigEnv, UserConfig } from 'vite';
|
|
2
|
+
import { default as tailwindAutoReference } from 'vite-plugin-vue-tailwind-auto-reference';
|
|
3
|
+
type TailwindAutoReferenceParameters = Parameters<typeof tailwindAutoReference>;
|
|
4
|
+
interface DlznViteOptions {
|
|
5
|
+
tailwindAutoReferenceParameters?: TailwindAutoReferenceParameters;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: (_env: ConfigEnv, options: DlznViteOptions) => UserConfig;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { resolveOne } from "./utils/index.mjs";
|
|
2
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
3
|
+
import vue from "@vitejs/plugin-vue";
|
|
4
|
+
import tailwindAutoReference from "vite-plugin-vue-tailwind-auto-reference";
|
|
5
|
+
//#region node/vite-config.ts
|
|
6
|
+
var vite_config_default = (_env, options) => {
|
|
7
|
+
return { plugins: [
|
|
8
|
+
vue({}),
|
|
9
|
+
tailwindAutoReference(options.tailwindAutoReferenceParameters?.[0] ?? resolveOne(["node_modules/dlzn-ui/assets/css/tailwindcss-entry.css", "src/assets/css/tailwindcss-entry.css"]), options.tailwindAutoReferenceParameters?.[1]),
|
|
10
|
+
tailwindcss()
|
|
11
|
+
] };
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { vite_config_default as default };
|
package/package.json
CHANGED
|
@@ -15,14 +15,26 @@
|
|
|
15
15
|
"import": "./const/index.mjs",
|
|
16
16
|
"types": "./const/index.d.ts"
|
|
17
17
|
},
|
|
18
|
-
"./eslint-config":
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
"./eslint-config": {
|
|
19
|
+
"import": "./node/eslint-config.mjs",
|
|
20
|
+
"types": "./node/eslint-config.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./prettier-config": {
|
|
23
|
+
"import": "./node/prettier-config.mjs",
|
|
24
|
+
"types": "./node/prettier-config.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./stylelint-config": {
|
|
27
|
+
"import": "./node/stylelint-config.mjs",
|
|
28
|
+
"types": "./node/stylelint-config.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./vite-config": {
|
|
31
|
+
"import": "./node/vite-config.mjs",
|
|
32
|
+
"types": "./node/vite-config.d.ts"
|
|
33
|
+
},
|
|
21
34
|
"./utils": {
|
|
22
35
|
"import": "./utils/index.mjs",
|
|
23
36
|
"types": "./utils/index.d.ts"
|
|
24
|
-
}
|
|
25
|
-
"./vite-config": "./vite-config.mjs"
|
|
37
|
+
}
|
|
26
38
|
},
|
|
27
39
|
"keywords": [],
|
|
28
40
|
"license": "MIT",
|
|
@@ -63,6 +75,6 @@
|
|
|
63
75
|
"**/*.css"
|
|
64
76
|
],
|
|
65
77
|
"type": "module",
|
|
66
|
-
"version": "1.
|
|
78
|
+
"version": "1.26.0",
|
|
67
79
|
"scripts": {}
|
|
68
80
|
}
|
package/eslint-config.mjs
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs'
|
|
2
|
-
import { dirname, resolve } from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
|
-
import antfu, { perfectionist as perfectionistConfigFn } from '@antfu/eslint-config'
|
|
5
|
-
import perfectionist from 'eslint-plugin-perfectionist'
|
|
6
|
-
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
|
|
7
|
-
|
|
8
|
-
function resolveOne(metaUrl, paths) {
|
|
9
|
-
const here = dirname(fileURLToPath(metaUrl))
|
|
10
|
-
const arr = paths.map((path) => resolve(here, path))
|
|
11
|
-
const result = arr.findIndex((file) => existsSync(file))
|
|
12
|
-
|
|
13
|
-
if (result === -1) {
|
|
14
|
-
throw new Error(`resolveOne: path not found: ${paths.join(', ')}`)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return paths[result]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const prettierOptions = await import(
|
|
21
|
-
resolveOne(import.meta.url, ['./prettier.config.mjs', './prettier-config.mjs'])
|
|
22
|
-
)
|
|
23
|
-
const perfectionistConfig = await perfectionistConfigFn({})
|
|
24
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
25
|
-
const eslintConfig = await antfu(
|
|
26
|
-
{
|
|
27
|
-
formatters: {
|
|
28
|
-
// 都默认开启了
|
|
29
|
-
css: true, // 与 stylelint 一起
|
|
30
|
-
html: true,
|
|
31
|
-
markdown: true, // 使用 prettier 格式化 markdown 文件,搭配 davidAnson.vscode-markdownlint 插件一起使用
|
|
32
|
-
prettierOptions: {
|
|
33
|
-
...prettierOptions,
|
|
34
|
-
xmlQuoteAttributes: 'preserve',
|
|
35
|
-
xmlSelfClosingSpace: true, // 在自闭合标签之间添加空格
|
|
36
|
-
xmlSortAttributesByKey: true, // 按属性键排序XML元素
|
|
37
|
-
xmlWhitespaceSensitivity: 'ignore', // 对XML全局空白敏感
|
|
38
|
-
}, // 配置 prettier 的配置,这里不会读 ignorePath 这个配置,否则 ignorePath 里面配置的文件都不会被 prettier 格式化了
|
|
39
|
-
svg: true,
|
|
40
|
-
xml: true,
|
|
41
|
-
},
|
|
42
|
-
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
|
|
43
|
-
// GLOB_EXCLUDE 已经包括了大部分的忽略文件,遵守 gitignore 规则
|
|
44
|
-
ignores: ['folder-alias.json', 'src/plugins/echarts/china.json', 'src/layout/vueBits/**/*.vue'],
|
|
45
|
-
jsonc: {
|
|
46
|
-
overrides: {
|
|
47
|
-
'jsonc/sort-array-values': [
|
|
48
|
-
'error',
|
|
49
|
-
{
|
|
50
|
-
minValues: 2,
|
|
51
|
-
order: {
|
|
52
|
-
caseSensitive: true,
|
|
53
|
-
natural: true,
|
|
54
|
-
type: 'asc',
|
|
55
|
-
},
|
|
56
|
-
pathPattern: '.*',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
'jsonc/sort-keys': [
|
|
60
|
-
'error',
|
|
61
|
-
'asc',
|
|
62
|
-
{
|
|
63
|
-
allowLineSeparatedGroups: false,
|
|
64
|
-
caseSensitive: true,
|
|
65
|
-
minKeys: 2,
|
|
66
|
-
natural: true,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
// jsonc: true, // 配合 vscode.json-language-features 一起使用 (默认为true) [jsonc: true 排序, vscode.json-language-features 截断好一点]
|
|
72
|
-
// 1、 Enable linting for **code snippets** in Markdown.
|
|
73
|
-
// 2. 也会把上面的 formatters.markdown 设置为true
|
|
74
|
-
// 3. 默认为true
|
|
75
|
-
// 4. 这里设置为false 是因为 现在格式化错误 https://github.com/antfu/eslint-config/discussions/851
|
|
76
|
-
markdown: false,
|
|
77
|
-
perfectionist: true,
|
|
78
|
-
// https://eslint.style/packages/default#rules
|
|
79
|
-
stylistic: {
|
|
80
|
-
indent: 2,
|
|
81
|
-
jsx: true,
|
|
82
|
-
overrides: {
|
|
83
|
-
'style/padding-line-between-statements': [
|
|
84
|
-
'error',
|
|
85
|
-
{ blankLine: 'never', next: '*', prev: '*' },
|
|
86
|
-
{
|
|
87
|
-
blankLine: 'always',
|
|
88
|
-
next: '*',
|
|
89
|
-
prev: [
|
|
90
|
-
'import',
|
|
91
|
-
'export',
|
|
92
|
-
'class',
|
|
93
|
-
'function',
|
|
94
|
-
'multiline-block-like',
|
|
95
|
-
'const',
|
|
96
|
-
'let',
|
|
97
|
-
'var',
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
blankLine: 'always',
|
|
102
|
-
next: ['export', 'class', 'function', 'multiline-block-like', 'const', 'let', 'var'],
|
|
103
|
-
prev: '*',
|
|
104
|
-
},
|
|
105
|
-
{ blankLine: 'never', next: 'import', prev: 'import' },
|
|
106
|
-
{ blankLine: 'never', next: 'export', prev: 'export' },
|
|
107
|
-
{
|
|
108
|
-
blankLine: 'never',
|
|
109
|
-
next: ['const', 'let', 'var'],
|
|
110
|
-
prev: ['const', 'let', 'var'],
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
quotes: 'single',
|
|
115
|
-
semi: false,
|
|
116
|
-
},
|
|
117
|
-
// https://typescript-eslint.io/rules/
|
|
118
|
-
typescript: {
|
|
119
|
-
// other rules
|
|
120
|
-
overrides: {
|
|
121
|
-
'prefer-promise-reject-errors': 'off',
|
|
122
|
-
},
|
|
123
|
-
// type checked rules
|
|
124
|
-
overridesTypeAware: {
|
|
125
|
-
'ts/no-floating-promises': 'off',
|
|
126
|
-
'ts/no-unsafe-assignment': 'off',
|
|
127
|
-
'ts/promise-function-async': 'off',
|
|
128
|
-
'ts/strict-boolean-expressions': [
|
|
129
|
-
'error',
|
|
130
|
-
{
|
|
131
|
-
allowAny: false,
|
|
132
|
-
allowNullableBoolean: true,
|
|
133
|
-
allowNullableEnum: false,
|
|
134
|
-
allowNullableNumber: false,
|
|
135
|
-
allowNullableObject: false,
|
|
136
|
-
allowNullableString: true,
|
|
137
|
-
allowNumber: false,
|
|
138
|
-
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
139
|
-
allowString: true,
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
'ts/unbound-method': 'off',
|
|
143
|
-
},
|
|
144
|
-
tsconfigPath: 'tsconfig.json', // Linting with Type Information https://typescript-eslint.io/getting-started/typed-linting/
|
|
145
|
-
},
|
|
146
|
-
vue: {
|
|
147
|
-
overrides: {
|
|
148
|
-
'vue/attributes-order': [
|
|
149
|
-
'error',
|
|
150
|
-
{
|
|
151
|
-
alphabetical: true,
|
|
152
|
-
ignoreVBindObject: false,
|
|
153
|
-
order: [
|
|
154
|
-
'DEFINITION',
|
|
155
|
-
'LIST_RENDERING',
|
|
156
|
-
'CONDITIONALS',
|
|
157
|
-
'RENDER_MODIFIERS',
|
|
158
|
-
'GLOBAL',
|
|
159
|
-
['UNIQUE', 'SLOT'],
|
|
160
|
-
'TWO_WAY_BINDING',
|
|
161
|
-
'OTHER_DIRECTIVES',
|
|
162
|
-
'OTHER_ATTR',
|
|
163
|
-
'EVENTS',
|
|
164
|
-
'CONTENT',
|
|
165
|
-
],
|
|
166
|
-
sortLineLength: false,
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
'vue/component-name-in-template-casing': [
|
|
170
|
-
'error',
|
|
171
|
-
'PascalCase',
|
|
172
|
-
{
|
|
173
|
-
registeredComponentsOnly: false,
|
|
174
|
-
},
|
|
175
|
-
], // 组件名必须为PascalCase
|
|
176
|
-
'vue/html-self-closing': [
|
|
177
|
-
'error',
|
|
178
|
-
{
|
|
179
|
-
html: {
|
|
180
|
-
component: 'never',
|
|
181
|
-
normal: 'never',
|
|
182
|
-
void: 'always', // 常见的 HTML 空元素 br, hr...
|
|
183
|
-
},
|
|
184
|
-
math: 'always',
|
|
185
|
-
svg: 'always',
|
|
186
|
-
},
|
|
187
|
-
], // html标签不要自闭合
|
|
188
|
-
'vue/padding-line-between-tags': ['error', [{ blankLine: 'never', next: '*', prev: '*' }]],
|
|
189
|
-
'vue/prop-name-casing': [
|
|
190
|
-
'error',
|
|
191
|
-
'camelCase',
|
|
192
|
-
{
|
|
193
|
-
ignoreProps: ['/^onUpdate:*/'],
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
'vue/singleline-html-element-content-newline': 'off',
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
rules: {
|
|
202
|
-
'e18e/ban-dependencies': [
|
|
203
|
-
'error',
|
|
204
|
-
{
|
|
205
|
-
allowed: ['crypto-js'],
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
|
-
'no-console': 'off',
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
)
|
|
212
|
-
.override(perfectionistConfig[0].name, {
|
|
213
|
-
rules: {
|
|
214
|
-
...perfectionist.configs['recommended-natural'].rules,
|
|
215
|
-
...perfectionistConfig[0].rules,
|
|
216
|
-
},
|
|
217
|
-
})
|
|
218
|
-
.append({
|
|
219
|
-
ignores: ['**/*.md', '**/*.html', '**/*.xml', '**/*.svg', '**/*.jsonc'],
|
|
220
|
-
// https://github.com/prettier/eslint-plugin-prettier
|
|
221
|
-
...eslintPluginPrettierRecommended,
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
export default eslintConfig
|
package/prettier-config.mjs
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description: https://prettier.io/docs/en/options
|
|
3
|
-
* @description: 还有些是 prettier-plugin-tailwindcss 的配置 https://github.com/tailwindlabs/prettier-plugin-tailwindcss
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { existsSync } from 'node:fs'
|
|
7
|
-
import { dirname, resolve } from 'node:path'
|
|
8
|
-
import { fileURLToPath } from 'node:url'
|
|
9
|
-
|
|
10
|
-
function resolveOne(metaUrl, paths) {
|
|
11
|
-
const here = dirname(fileURLToPath(metaUrl))
|
|
12
|
-
const arr = paths.map((path) => resolve(here, path))
|
|
13
|
-
const result = arr.findIndex((file) => existsSync(file))
|
|
14
|
-
|
|
15
|
-
if (result === -1) {
|
|
16
|
-
throw new Error(`resolveOne: path not found: ${paths.join(', ')}`)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return result[result]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
|
|
23
|
-
export default {
|
|
24
|
-
$schema: 'https://json.schemastore.org/prettierrc',
|
|
25
|
-
arrowParens: 'always', // 单参数箭头函数参数周围使用圆括号-eg: (x) => x
|
|
26
|
-
bracketSameLine: false, // 会把多行的 HTML (包括 HTML、JSX、Vue 和 Angular) 元素的 `>` 放在最后一个属性的末尾,而不是另起一行(自闭合标签不受该选项控制)。
|
|
27
|
-
bracketSpacing: true, // 在对象前后添加空格-eg: { foo: bar }
|
|
28
|
-
embeddedLanguageFormatting: 'auto', // 控制嵌入的其他语言代码格式化。
|
|
29
|
-
endOfLine: 'lf', // 结束行形式
|
|
30
|
-
htmlWhitespaceSensitivity: 'css', // 对HTML全局空白不敏感
|
|
31
|
-
insertPragma: false, // 在已被preitter格式化的文件顶部加上标注
|
|
32
|
-
jsxSingleQuote: false, // jsx中使用单引号
|
|
33
|
-
plugins: ['prettier-plugin-tailwindcss'],
|
|
34
|
-
printWidth: 100, // 单行长度
|
|
35
|
-
proseWrap: 'preserve', // 保留原有的换行符,不进行任何修改
|
|
36
|
-
quoteProps: 'as-needed', // 仅在必需时为对象的key添加引号
|
|
37
|
-
requirePragma: false, // 无需顶部注释即可格式化
|
|
38
|
-
semi: false, // 句末使用分号
|
|
39
|
-
singleAttributePerLine: false, // 会在 HTML、JSX、Vue 和 Angular 中格式化为每个属性单独占一行。
|
|
40
|
-
singleQuote: true, // 使用单引号
|
|
41
|
-
tabWidth: 2, // 缩进长度
|
|
42
|
-
tailwindStylesheet: resolveOne(import.meta.url, [
|
|
43
|
-
'./assets/css/tailwindcss-entry.css',
|
|
44
|
-
'./src/assets/css/tailwindcss-entry.css',
|
|
45
|
-
]),
|
|
46
|
-
trailingComma: 'all',
|
|
47
|
-
useTabs: false, // 使用空格代替tab缩进
|
|
48
|
-
vueIndentScriptAndStyle: false, // 不对vue中的script及style标签缩进
|
|
49
|
-
}
|
package/stylelint-config.mjs
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// [插件集合](https://stylelint.io/awesome-stylelint/)
|
|
2
|
-
// [stylelint 内置规则集](https://stylelint.io/user-guide/rules)
|
|
3
|
-
// 最新的版本去除了很多配置,比如缩进, 抛弃的规则 可在 @stylistic/stylelint-config(https://github.com/stylelint-stylistic/stylelint-config/blob/main/stylelint.config.js) 中找回
|
|
4
|
-
/** @type {import('stylelint').Config} */
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
cache: true,
|
|
8
|
-
extends: [
|
|
9
|
-
'@stylistic/stylelint-config',
|
|
10
|
-
'stylelint-config-standard',
|
|
11
|
-
'stylelint-config-recess-order',
|
|
12
|
-
'stylelint-config-recommended-vue', // 放最后一个 依赖 postcss-html
|
|
13
|
-
],
|
|
14
|
-
// 设置 ignoreFiles 会覆盖默认忽略 node_modules,需显式包含
|
|
15
|
-
// https://stylelint.io/user-guide/configure/#ignorefiles
|
|
16
|
-
ignoreFiles: [
|
|
17
|
-
'**/*.min.css',
|
|
18
|
-
'.vscode/**',
|
|
19
|
-
'.idea/**',
|
|
20
|
-
'node_modules/**',
|
|
21
|
-
'dist/**',
|
|
22
|
-
'public/**',
|
|
23
|
-
'dist-ssr/**',
|
|
24
|
-
],
|
|
25
|
-
// 格式化 md 文件中的 css 代码
|
|
26
|
-
overrides: [
|
|
27
|
-
{
|
|
28
|
-
customSyntax: 'postcss-markdown',
|
|
29
|
-
files: ['*.md', '**/*.md'],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
files: ['src/plugins/element-plus/theme-chalk/**/*.css'],
|
|
33
|
-
rules: {
|
|
34
|
-
'no-descending-specificity': null,
|
|
35
|
-
'no-duplicate-selectors': null,
|
|
36
|
-
'selector-class-pattern': null,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
plugins: ['stylelint-use-nesting'],
|
|
41
|
-
// null (to turn the rule off)
|
|
42
|
-
rules: {
|
|
43
|
-
'@stylistic/declaration-block-trailing-semicolon': null, // 与 prettier 保持一致
|
|
44
|
-
'@stylistic/declaration-colon-newline-after': null, // 与 prettier 保持一致
|
|
45
|
-
'@stylistic/declaration-colon-space-after': null, // 与 prettier 保持一致
|
|
46
|
-
'@stylistic/indentation': null, // 与 prettier 保持一致
|
|
47
|
-
'@stylistic/no-eol-whitespace': null, // 与 prettier 保持一致
|
|
48
|
-
'@stylistic/selector-combinator-space-before': null, // 与 prettier 保持一致
|
|
49
|
-
'@stylistic/string-quotes': null, // 与 prettier 保持一致
|
|
50
|
-
'@stylistic/value-list-comma-newline-after': null, // 与 prettier 保持一致
|
|
51
|
-
'at-rule-no-unknown': [
|
|
52
|
-
true,
|
|
53
|
-
{
|
|
54
|
-
ignoreAtRules: ['theme'],
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
'csstools/use-nesting': [
|
|
58
|
-
'always',
|
|
59
|
-
{
|
|
60
|
-
message: '尽量使用嵌套写法',
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
'import-notation': 'string', // TODO url 模式好像 tailwindcss 引入有问题
|
|
64
|
-
'selector-class-pattern': [
|
|
65
|
-
'^(t-|el-|([a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9])$)',
|
|
66
|
-
{
|
|
67
|
-
// disableFix: true, // disable autofix
|
|
68
|
-
message: '自定义 class 名称使用 snake_case',
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
'value-keyword-case': ['lower', { ignoreFunctions: ['v-bind'] }],
|
|
72
|
-
},
|
|
73
|
-
}
|
package/vite-config.mjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs'
|
|
2
|
-
import { dirname, resolve } from 'node:path'
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
4
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
5
|
-
import vue from '@vitejs/plugin-vue'
|
|
6
|
-
import tailwindAutoReference from 'vite-plugin-vue-tailwind-auto-reference'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {import('vite').ConfigEnv} ConfigEnv
|
|
10
|
-
* @typedef {typeof import('vite-plugin-vue-tailwind-auto-reference').default} TailwindAutoReference
|
|
11
|
-
* @typedef {Parameters<TailwindAutoReference>} TailwindAutoReferenceParameters
|
|
12
|
-
* @typedef {{ tailwindAutoReferenceParameters?: TailwindAutoReferenceParameters }} DlznViteOptions
|
|
13
|
-
* @typedef {import('vite').UserConfig} UserConfig
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function resolveOne(metaUrl, paths) {
|
|
17
|
-
const here = dirname(fileURLToPath(metaUrl))
|
|
18
|
-
const arr = paths.map((path) => resolve(here, path))
|
|
19
|
-
const result = arr.findIndex((file) => existsSync(file))
|
|
20
|
-
|
|
21
|
-
if (result === -1) {
|
|
22
|
-
throw new Error(`resolveOne: path not found: ${paths.join(', ')}`)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return paths[result]
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {ConfigEnv} _env
|
|
30
|
-
* @param {DlznViteOptions} options
|
|
31
|
-
* @returns {UserConfig} Vite config
|
|
32
|
-
*/
|
|
33
|
-
export default (_env, options) => {
|
|
34
|
-
return {
|
|
35
|
-
plugins: [
|
|
36
|
-
vue({
|
|
37
|
-
// features: {
|
|
38
|
-
// optionsAPI: false, // 不能删掉,tdesign 内部使用到了
|
|
39
|
-
// },
|
|
40
|
-
}),
|
|
41
|
-
tailwindAutoReference(
|
|
42
|
-
options.tailwindAutoReferenceParameters?.[0] ??
|
|
43
|
-
resolveOne(import.meta.url, [
|
|
44
|
-
'./assets/css/tailwindcss-entry.css',
|
|
45
|
-
'./src/assets/css/tailwindcss-entry.css',
|
|
46
|
-
]),
|
|
47
|
-
options.tailwindAutoReferenceParameters?.[1],
|
|
48
|
-
),
|
|
49
|
-
tailwindcss(),
|
|
50
|
-
],
|
|
51
|
-
}
|
|
52
|
-
}
|