@xiaohe01/stylelint-config 2.4.0 → 3.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024-PRESENT xiaohe0601 <https://github.com/xiaohe0601>
3
+ Copyright (c) 2025-PRESENT xiaohe0601 <https://github.com/xiaohe0601>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
- <h1>xiaohe-stylelint-config</h1>
3
- <span>🤚 Stylelint config preset for xiaohe (inspired by antfu/eslint-config)</span>
2
+ <h1>Xiaohe Stylelint Config</h1>
3
+ <span>🤚 Xiaohe's Stylelint config preset (inspired by antfu/eslint-config)</span>
4
4
  </div>
5
5
 
6
6
  <br>
@@ -11,8 +11,6 @@
11
11
  [![JSDocs][jsdocs-src]][jsdocs-href]
12
12
  [![License][license-src]][license-href]
13
13
 
14
- xiaohe0601 / [github@xiaohe0601](https://github.com/xiaohe0601) / [gitee@xiaohe0601](https://gitee.com/xiaohe0601)
15
-
16
14
  ### 🚁 Installation
17
15
 
18
16
  ```shell
@@ -27,11 +25,11 @@ npm install -D stylelint @xiaohe01/stylelint-config
27
25
  ```
28
26
 
29
27
  > [!WARNING]
30
- > Stylelint `16.13.0+` is now required
28
+ > Require Stylelint >= 16.13.0.
31
29
 
32
30
  ### 🛹 Usage
33
31
 
34
- Create `stylelint.config.mjs` in your project root
32
+ Create `stylelint.config.mjs` in your project root:
35
33
 
36
34
  ```js
37
35
  import { defineConfig } from "@xiaohe01/stylelint-config";
@@ -39,7 +37,7 @@ import { defineConfig } from "@xiaohe01/stylelint-config";
39
37
  export default defineConfig();
40
38
  ```
41
39
 
42
- Add script for `package.json`, for example
40
+ Add script for `package.json`, for example:
43
41
 
44
42
  ```json
45
43
  {
@@ -54,15 +52,15 @@ For more information, please refer to [stylelint](https://stylelint.io).
54
52
 
55
53
  ### 🏆 License
56
54
 
57
- - MIT [LICENSE](./LICENSE)
55
+ MIT [LICENSE](../../LICENSE)
58
56
 
59
- [github-stars-src]: https://img.shields.io/github/stars/xiaohe0601/xiaohe-stylelint-config?style=flat&colorA=080f12&colorB=1fa669&logo=GitHub
60
- [github-stars-href]: https://github.com/xiaohe0601/xiaohe-stylelint-config
61
- [npm-version-src]: https://img.shields.io/npm/v/@xiaohe01/stylelint-config?style=flat&colorA=080f12&colorB=1fa669
57
+ [github-stars-src]: https://img.shields.io/github/stars/xiaohe0601/xiaohe-config?style=flat&color=1fa669&labelColor=18181b&logo=github
58
+ [github-stars-href]: https://github.com/xiaohe0601/xiaohe-config
59
+ [npm-version-src]: https://img.shields.io/npm/v/@xiaohe01/stylelint-config?style=flat&color=1fa669&labelColor=18181b&logo=npm
62
60
  [npm-version-href]: https://npmjs.com/package/@xiaohe01/stylelint-config
63
- [npm-downloads-src]: https://img.shields.io/npm/dm/@xiaohe01/stylelint-config?style=flat&colorA=080f12&colorB=1fa669
61
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@xiaohe01/stylelint-config?style=flat&color=1fa669&labelColor=18181b
64
62
  [npm-downloads-href]: https://npmjs.com/package/@xiaohe01/stylelint-config
65
- [jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
63
+ [jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-1fa669?style=flat&labelColor=18181b
66
64
  [jsdocs-href]: https://www.jsdocs.io/package/@xiaohe01/stylelint-config
67
- [license-src]: https://img.shields.io/github/license/xiaohe0601/xiaohe-stylelint-config.svg?style=flat&colorA=080f12&colorB=1fa669
68
- [license-href]: https://github.com/xiaohe0601/xiaohe-stylelint-config/blob/main/LICENSE
65
+ [license-src]: https://img.shields.io/github/license/xiaohe0601/xiaohe-config.svg?style=flat&color=1fa669&labelColor=18181b
66
+ [license-href]: https://github.com/xiaohe0601/xiaohe-config/blob/main/LICENSE
package/dist/index.cjs CHANGED
@@ -1,28 +1,30 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ let local_pkg = require("local-pkg");
3
+
4
+ //#region ../shared/src/constants.ts
5
+ const SCSS_PACKAGES = [
6
+ "sass",
7
+ "sass-embedded",
8
+ "node-sass"
9
+ ];
10
+ const UNI_PACKAGES = ["@dcloudio/uni-app"];
11
+ const VUE_PACKAGES = [
12
+ "vue",
13
+ "nuxt",
14
+ "vitepress",
15
+ "@slidev/cli"
16
+ ];
22
17
 
23
18
  //#endregion
24
- const local_pkg = __toESM(require("local-pkg"));
19
+ //#region ../shared/src/helpers.ts
20
+ function castArray(value) {
21
+ return Array.isArray(value) ? value : [value];
22
+ }
23
+ function isPkgExists(pkg) {
24
+ return castArray(pkg).some((it) => (0, local_pkg.isPackageExists)(it));
25
+ }
25
26
 
27
+ //#endregion
26
28
  //#region src/globs.ts
27
29
  const GLOB_CSS = ["*.css", "**/*.css"];
28
30
  const GLOB_SCSS = ["*.scss", "**/*.scss"];
@@ -128,7 +130,7 @@ function html(options = {}) {
128
130
  //#endregion
129
131
  //#region src/configs/scss.ts
130
132
  function scss(options = {}) {
131
- const { vue: vue$1 = false, uniapp = false } = options;
133
+ const { vue: vue$1 = false, uni = false } = options;
132
134
  return [{
133
135
  name: "xiaohe/scss/rules",
134
136
  files: [...GLOB_SCSS, ...vue$1 ? GLOB_VUE : []],
@@ -154,7 +156,7 @@ function scss(options = {}) {
154
156
  "scss/operator-no-newline-after": true,
155
157
  "scss/operator-no-newline-before": true,
156
158
  "scss/operator-no-unspaced": true,
157
- ...uniapp ? { "scss/load-partial-extension": "always" } : {},
159
+ ...uni ? { "scss/load-partial-extension": "always" } : {},
158
160
  ...options.overrides
159
161
  }
160
162
  }];
@@ -195,34 +197,10 @@ function vue(options = {}) {
195
197
  }];
196
198
  }
197
199
 
198
- //#endregion
199
- //#region src/constants.ts
200
- const SCSS_PACKAGES = [
201
- "sass",
202
- "sass-embedded",
203
- "node-sass"
204
- ];
205
- const VUE_PACKAGES = [
206
- "vue",
207
- "nuxt",
208
- "vitepress",
209
- "@slidev/cli"
210
- ];
211
- const UNIAPP_PACKAGES = ["@dcloudio/uni-app"];
212
-
213
- //#endregion
214
- //#region src/helpers.ts
215
- function castArray(value) {
216
- return Array.isArray(value) ? value : [value];
217
- }
218
- function isPkgExists(pkg) {
219
- return castArray(pkg).some((it) => (0, local_pkg.isPackageExists)(it));
220
- }
221
-
222
200
  //#endregion
223
201
  //#region src/factory.ts
224
202
  function defineConfig(options = {}, ...userOverrides) {
225
- const { scss: enableScss = isPkgExists(SCSS_PACKAGES), html: enableHtml = true, vue: enableVue = isPkgExists(VUE_PACKAGES), uniapp: enableUniApp = isPkgExists(UNIAPP_PACKAGES) } = options;
203
+ const { scss: enableScss = isPkgExists(SCSS_PACKAGES), html: enableHtml = true, vue: enableVue = isPkgExists(VUE_PACKAGES), uni: enableUni = isPkgExists(UNI_PACKAGES) } = options;
226
204
  const overrides = [
227
205
  ...setup({
228
206
  scss: !!enableScss,
@@ -238,7 +216,7 @@ function defineConfig(options = {}, ...userOverrides) {
238
216
  if (enableScss) overrides.push(...scss({
239
217
  overrides: getOverrides(options.scss),
240
218
  vue: !!enableVue,
241
- uniapp: enableUniApp
219
+ uni: enableUni
242
220
  }));
243
221
  if (enableHtml) overrides.push(...html({ overrides: getOverrides(options.html) }));
244
222
  if (enableVue) overrides.push(...vue({ overrides: getOverrides(options.vue) }));
@@ -262,4 +240,5 @@ exports.GLOB_CSS = GLOB_CSS;
262
240
  exports.GLOB_HTML = GLOB_HTML;
263
241
  exports.GLOB_SCSS = GLOB_SCSS;
264
242
  exports.GLOB_VUE = GLOB_VUE;
243
+ exports.default = defineConfig;
265
244
  exports.defineConfig = defineConfig;
package/dist/index.d.cts CHANGED
@@ -1,10 +1,6 @@
1
1
  import { Config } from "stylelint";
2
2
 
3
3
  //#region src/types.d.ts
4
- type ConfigOverride = Omit<Config, "overrides"> & {
5
- files: string | string[];
6
- name?: string;
7
- };
8
4
  type ConfigRules = Config["rules"];
9
5
  interface OptionsOverrides {
10
6
  overrides?: ConfigRules;
@@ -37,15 +33,20 @@ interface OptionsConfig {
37
33
  */
38
34
  vue?: boolean | OptionsOverrides;
39
35
  /**
40
- * Enable uniapp support.
36
+ * Enable uni-app support.
41
37
  *
42
38
  * @default auto-detect based on the dependencies
43
39
  */
44
- uniapp?: boolean;
40
+ uni?: boolean;
45
41
  }
42
+ type Options = OptionsConfig & Omit<Config, "overrides">;
43
+ type ConfigOverride = Omit<Config, "overrides"> & {
44
+ files: string | string[];
45
+ name?: string;
46
+ };
46
47
  //#endregion
47
48
  //#region src/factory.d.ts
48
- declare function defineConfig(options?: OptionsConfig & Omit<Config, "overrides">, ...userOverrides: ConfigOverride[]): Config;
49
+ declare function defineConfig(options?: Options, ...userOverrides: ConfigOverride[]): Config;
49
50
  //#endregion
50
51
  //#region src/globs.d.ts
51
52
  declare const GLOB_CSS: string[];
@@ -54,4 +55,4 @@ declare const GLOB_HTML: string[];
54
55
  declare const GLOB_VUE: string[];
55
56
  declare const GLOB_ALL: string[];
56
57
  //#endregion
57
- export { GLOB_ALL, GLOB_CSS, GLOB_HTML, GLOB_SCSS, GLOB_VUE, defineConfig };
58
+ export { GLOB_ALL, GLOB_CSS, GLOB_HTML, GLOB_SCSS, GLOB_VUE, defineConfig as default, defineConfig };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,6 @@
1
1
  import { Config } from "stylelint";
2
2
 
3
3
  //#region src/types.d.ts
4
- type ConfigOverride = Omit<Config, "overrides"> & {
5
- files: string | string[];
6
- name?: string;
7
- };
8
4
  type ConfigRules = Config["rules"];
9
5
  interface OptionsOverrides {
10
6
  overrides?: ConfigRules;
@@ -37,15 +33,20 @@ interface OptionsConfig {
37
33
  */
38
34
  vue?: boolean | OptionsOverrides;
39
35
  /**
40
- * Enable uniapp support.
36
+ * Enable uni-app support.
41
37
  *
42
38
  * @default auto-detect based on the dependencies
43
39
  */
44
- uniapp?: boolean;
40
+ uni?: boolean;
45
41
  }
42
+ type Options = OptionsConfig & Omit<Config, "overrides">;
43
+ type ConfigOverride = Omit<Config, "overrides"> & {
44
+ files: string | string[];
45
+ name?: string;
46
+ };
46
47
  //#endregion
47
48
  //#region src/factory.d.ts
48
- declare function defineConfig(options?: OptionsConfig & Omit<Config, "overrides">, ...userOverrides: ConfigOverride[]): Config;
49
+ declare function defineConfig(options?: Options, ...userOverrides: ConfigOverride[]): Config;
49
50
  //#endregion
50
51
  //#region src/globs.d.ts
51
52
  declare const GLOB_CSS: string[];
@@ -54,4 +55,4 @@ declare const GLOB_HTML: string[];
54
55
  declare const GLOB_VUE: string[];
55
56
  declare const GLOB_ALL: string[];
56
57
  //#endregion
57
- export { GLOB_ALL, GLOB_CSS, GLOB_HTML, GLOB_SCSS, GLOB_VUE, defineConfig };
58
+ export { GLOB_ALL, GLOB_CSS, GLOB_HTML, GLOB_SCSS, GLOB_VUE, defineConfig as default, defineConfig };
package/dist/index.js CHANGED
@@ -1,5 +1,29 @@
1
1
  import { isPackageExists } from "local-pkg";
2
2
 
3
+ //#region ../shared/src/constants.ts
4
+ const SCSS_PACKAGES = [
5
+ "sass",
6
+ "sass-embedded",
7
+ "node-sass"
8
+ ];
9
+ const UNI_PACKAGES = ["@dcloudio/uni-app"];
10
+ const VUE_PACKAGES = [
11
+ "vue",
12
+ "nuxt",
13
+ "vitepress",
14
+ "@slidev/cli"
15
+ ];
16
+
17
+ //#endregion
18
+ //#region ../shared/src/helpers.ts
19
+ function castArray(value) {
20
+ return Array.isArray(value) ? value : [value];
21
+ }
22
+ function isPkgExists(pkg) {
23
+ return castArray(pkg).some((it) => isPackageExists(it));
24
+ }
25
+
26
+ //#endregion
3
27
  //#region src/globs.ts
4
28
  const GLOB_CSS = ["*.css", "**/*.css"];
5
29
  const GLOB_SCSS = ["*.scss", "**/*.scss"];
@@ -105,7 +129,7 @@ function html(options = {}) {
105
129
  //#endregion
106
130
  //#region src/configs/scss.ts
107
131
  function scss(options = {}) {
108
- const { vue: vue$1 = false, uniapp = false } = options;
132
+ const { vue: vue$1 = false, uni = false } = options;
109
133
  return [{
110
134
  name: "xiaohe/scss/rules",
111
135
  files: [...GLOB_SCSS, ...vue$1 ? GLOB_VUE : []],
@@ -131,7 +155,7 @@ function scss(options = {}) {
131
155
  "scss/operator-no-newline-after": true,
132
156
  "scss/operator-no-newline-before": true,
133
157
  "scss/operator-no-unspaced": true,
134
- ...uniapp ? { "scss/load-partial-extension": "always" } : {},
158
+ ...uni ? { "scss/load-partial-extension": "always" } : {},
135
159
  ...options.overrides
136
160
  }
137
161
  }];
@@ -172,34 +196,10 @@ function vue(options = {}) {
172
196
  }];
173
197
  }
174
198
 
175
- //#endregion
176
- //#region src/constants.ts
177
- const SCSS_PACKAGES = [
178
- "sass",
179
- "sass-embedded",
180
- "node-sass"
181
- ];
182
- const VUE_PACKAGES = [
183
- "vue",
184
- "nuxt",
185
- "vitepress",
186
- "@slidev/cli"
187
- ];
188
- const UNIAPP_PACKAGES = ["@dcloudio/uni-app"];
189
-
190
- //#endregion
191
- //#region src/helpers.ts
192
- function castArray(value) {
193
- return Array.isArray(value) ? value : [value];
194
- }
195
- function isPkgExists(pkg) {
196
- return castArray(pkg).some((it) => isPackageExists(it));
197
- }
198
-
199
199
  //#endregion
200
200
  //#region src/factory.ts
201
201
  function defineConfig(options = {}, ...userOverrides) {
202
- const { scss: enableScss = isPkgExists(SCSS_PACKAGES), html: enableHtml = true, vue: enableVue = isPkgExists(VUE_PACKAGES), uniapp: enableUniApp = isPkgExists(UNIAPP_PACKAGES) } = options;
202
+ const { scss: enableScss = isPkgExists(SCSS_PACKAGES), html: enableHtml = true, vue: enableVue = isPkgExists(VUE_PACKAGES), uni: enableUni = isPkgExists(UNI_PACKAGES) } = options;
203
203
  const overrides = [
204
204
  ...setup({
205
205
  scss: !!enableScss,
@@ -215,7 +215,7 @@ function defineConfig(options = {}, ...userOverrides) {
215
215
  if (enableScss) overrides.push(...scss({
216
216
  overrides: getOverrides(options.scss),
217
217
  vue: !!enableVue,
218
- uniapp: enableUniApp
218
+ uni: enableUni
219
219
  }));
220
220
  if (enableHtml) overrides.push(...html({ overrides: getOverrides(options.html) }));
221
221
  if (enableVue) overrides.push(...vue({ overrides: getOverrides(options.vue) }));
@@ -234,4 +234,4 @@ function getOverrides(options) {
234
234
  }
235
235
 
236
236
  //#endregion
237
- export { GLOB_ALL, GLOB_CSS, GLOB_HTML, GLOB_SCSS, GLOB_VUE, defineConfig };
237
+ export { GLOB_ALL, GLOB_CSS, GLOB_HTML, GLOB_SCSS, GLOB_VUE, defineConfig as default, defineConfig };
package/package.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
2
  "name": "@xiaohe01/stylelint-config",
3
3
  "type": "module",
4
- "version": "2.4.0",
5
- "description": "🤚 Stylelint config preset for xiaohe",
4
+ "version": "3.0.1",
5
+ "description": "🤚 Xiaohe's Stylelint config preset",
6
6
  "author": "xiaohe0601 <xiaohe0601@outlook.com>",
7
7
  "license": "MIT",
8
- "homepage": "https://github.com/xiaohe0601/xiaohe-stylelint-config#readme",
8
+ "homepage": "https://github.com/xiaohe0601/xiaohe-config/tree/main/packages/stylelint-config",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/xiaohe0601/xiaohe-stylelint-config.git"
11
+ "url": "git+https://github.com/xiaohe0601/xiaohe-config.git",
12
+ "directory": "packages/stylelint-config"
12
13
  },
13
- "bugs": "https://github.com/xiaohe0601/xiaohe-stylelint-config/issues",
14
+ "bugs": "https://github.com/xiaohe0601/xiaohe-config/issues",
14
15
  "keywords": [
15
16
  "stylelint-config"
16
17
  ],
@@ -26,14 +27,6 @@
26
27
  "main": "./dist/index.js",
27
28
  "module": "./dist/index.js",
28
29
  "types": "./dist/index.d.ts",
29
- "typesVersions": {
30
- "*": {
31
- "*": [
32
- "./dist/*",
33
- "./dist/index.d.ts"
34
- ]
35
- }
36
- },
37
30
  "files": [
38
31
  "dist"
39
32
  ],
@@ -41,18 +34,20 @@
41
34
  "stylelint": ">=16.13.0"
42
35
  },
43
36
  "dependencies": {
44
- "local-pkg": "^1.1.1",
37
+ "local-pkg": "^1.1.2",
45
38
  "postcss-html": "^1.8.0",
46
39
  "postcss-scss": "^4.0.9",
47
- "stylelint-config-recess-order": "^7.1.0",
40
+ "stylelint-config-recess-order": "^7.4.0",
48
41
  "stylelint-order": "^7.0.0",
49
- "stylelint-scss": "^6.12.1"
42
+ "stylelint-scss": "^6.13.0"
50
43
  },
51
44
  "devDependencies": {
52
- "stylelint": "^16.21.0"
45
+ "stylelint": "^16.26.1",
46
+ "@xiaohe-config/shared": "^0.0.0"
53
47
  },
54
48
  "scripts": {
55
49
  "dev": "tsdown --watch",
56
- "build": "tsdown"
50
+ "build": "tsdown",
51
+ "release": "bumpp"
57
52
  }
58
53
  }