@bhsd/common 0.10.0 → 0.10.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/stylelint.d.ts +3 -2
- package/dist/stylelint.js +7 -5
- package/dist/stylelint.mjs +7 -5
- package/package.json +2 -2
package/dist/stylelint.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { PublicApi, Warning } from 'stylelint';
|
|
|
4
4
|
* @param stylelint Stylelint实例
|
|
5
5
|
* @param code CSS代码
|
|
6
6
|
* @param additionalRules 额外的规则
|
|
7
|
-
* @param
|
|
7
|
+
* @param fix 是否修正
|
|
8
8
|
*/
|
|
9
|
-
export declare
|
|
9
|
+
export declare function styleLint(stylelint: PublicApi, code: string, additionalRules?: Record<string, unknown>, fix: true): Promise<string>;
|
|
10
|
+
export declare function styleLint(stylelint: PublicApi, code: string, additionalRules?: Record<string, unknown>): Promise<Warning[]>;
|
package/dist/stylelint.js
CHANGED
|
@@ -22,12 +22,14 @@ __export(stylelint_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(stylelint_exports);
|
|
24
24
|
var import_stylelint_config_recommended = require("stylelint-config-recommended");
|
|
25
|
-
|
|
25
|
+
async function styleLint(stylelint, code, additionalRules, fix) {
|
|
26
26
|
const config = {
|
|
27
|
-
rules: { ...import_stylelint_config_recommended.rules, ...additionalRules }
|
|
27
|
+
rules: { ...import_stylelint_config_recommended.rules, ...additionalRules },
|
|
28
|
+
computeEditInfo: true,
|
|
29
|
+
fix: fix || false
|
|
28
30
|
};
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
+
if (fix) {
|
|
32
|
+
return (await stylelint.lint({ code, config })).code;
|
|
31
33
|
}
|
|
32
34
|
return (await stylelint.lint({ code, config })).results.flatMap(({ warnings }) => warnings).filter(({ text }) => !text.startsWith("Unknown rule "));
|
|
33
|
-
}
|
|
35
|
+
}
|
package/dist/stylelint.mjs
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { rules } from "stylelint-config-recommended";
|
|
2
|
-
|
|
2
|
+
async function styleLint(stylelint, code, additionalRules, fix) {
|
|
3
3
|
const config = {
|
|
4
|
-
rules: { ...rules, ...additionalRules }
|
|
4
|
+
rules: { ...rules, ...additionalRules },
|
|
5
|
+
computeEditInfo: true,
|
|
6
|
+
fix: fix || false
|
|
5
7
|
};
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
+
if (fix) {
|
|
9
|
+
return (await stylelint.lint({ code, config })).code;
|
|
8
10
|
}
|
|
9
11
|
return (await stylelint.lint({ code, config })).results.flatMap(({ warnings }) => warnings).filter(({ text }) => !text.startsWith("Unknown rule "));
|
|
10
|
-
}
|
|
12
|
+
}
|
|
11
13
|
export {
|
|
12
14
|
styleLint
|
|
13
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bhsd/common",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Bhsd",
|
|
6
6
|
"files": [
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"mocha": "^11.1.0",
|
|
64
64
|
"stylelint": "^16.19.1",
|
|
65
65
|
"typescript": "^5.8.2",
|
|
66
|
-
"wikiparser-node": "^1.20.
|
|
66
|
+
"wikiparser-node": "^1.20.3"
|
|
67
67
|
}
|
|
68
68
|
}
|