@flint.fyi/css 0.3.0 → 0.3.2
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/index.d.mts +2 -6
- package/dist/index.mjs +22 -21
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
//#region src/plugin.d.ts
|
|
2
|
-
declare const css: import("@flint.fyi/core").Plugin<import("@flint.fyi/core").RuleAbout<string>, "all", [import("@flint.fyi/core").Rule<{
|
|
2
|
+
export declare const css: import("@flint.fyi/core").Plugin<import("@flint.fyi/core").RuleAbout<string>, "all", [import("@flint.fyi/core").Rule<import("@flint.fyi/core").PluginRuleAbout<string> & {
|
|
3
3
|
readonly description: "Reports hex colors with invalid values.";
|
|
4
4
|
readonly id: "hexColorValidity";
|
|
5
5
|
readonly presets: readonly ["logical"];
|
|
6
|
-
} & {
|
|
7
|
-
readonly pluginId: string;
|
|
8
|
-
readonly url: string;
|
|
9
6
|
}, "invalid", undefined>]>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { css };
|
|
7
|
+
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -9,32 +9,33 @@ const ruleCreator = new RuleCreator({
|
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/rules/hexColorValidity.ts
|
|
11
11
|
const validityTester = /^(?:[0-9a-f]{3,4}){1,2}$/i;
|
|
12
|
+
var hexColorValidity_default = ruleCreator.createRule(cssLanguage, {
|
|
13
|
+
about: {
|
|
14
|
+
description: "Reports hex colors with invalid values.",
|
|
15
|
+
id: "hexColorValidity",
|
|
16
|
+
presets: ["logical"]
|
|
17
|
+
},
|
|
18
|
+
messages: { invalid: {
|
|
19
|
+
primary: "The hex value `{{ value }}` is invalid.",
|
|
20
|
+
secondary: ["Valid CSS hex colors must have 3, 4, 6, or 8 digits or letters in `a-f` after the `#`.", "This value does not match that criteria."],
|
|
21
|
+
suggestions: ["Fix the value to be a valid CSS hex color."]
|
|
22
|
+
} },
|
|
23
|
+
setup(context) {
|
|
24
|
+
return { visitors: { Hash: (node) => {
|
|
25
|
+
if (!validityTester.test(node.value)) context.report({
|
|
26
|
+
data: { value: node.value },
|
|
27
|
+
message: "invalid",
|
|
28
|
+
range: getCssNodeRange(node)
|
|
29
|
+
});
|
|
30
|
+
} } };
|
|
31
|
+
}
|
|
32
|
+
});
|
|
12
33
|
//#endregion
|
|
13
34
|
//#region src/plugin.ts
|
|
14
35
|
const css = createPlugin({
|
|
15
36
|
files: { all: ["**/*.css"] },
|
|
16
37
|
name: "CSS",
|
|
17
|
-
rules: [
|
|
18
|
-
about: {
|
|
19
|
-
description: "Reports hex colors with invalid values.",
|
|
20
|
-
id: "hexColorValidity",
|
|
21
|
-
presets: ["logical"]
|
|
22
|
-
},
|
|
23
|
-
messages: { invalid: {
|
|
24
|
-
primary: "The hex value `{{ value }}` is invalid.",
|
|
25
|
-
secondary: ["Valid CSS hex colors must have 3, 4, 6, or 8 digits or letters in `a-f` after the `#`.", "This value does not match that criteria."],
|
|
26
|
-
suggestions: ["Fix the value to be a valid CSS hex color."]
|
|
27
|
-
} },
|
|
28
|
-
setup(context) {
|
|
29
|
-
return { visitors: { Hash: (node) => {
|
|
30
|
-
if (!validityTester.test(node.value)) context.report({
|
|
31
|
-
data: { value: node.value },
|
|
32
|
-
message: "invalid",
|
|
33
|
-
range: getCssNodeRange(node)
|
|
34
|
-
});
|
|
35
|
-
} } };
|
|
36
|
-
}
|
|
37
|
-
})]
|
|
38
|
+
rules: [hexColorValidity_default]
|
|
38
39
|
});
|
|
39
40
|
//#endregion
|
|
40
41
|
export { css };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flint.fyi/css",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "[Experimental] A Flint plugin for CSS code.",
|
|
5
5
|
"homepage": "https://flint.fyi/rules/css",
|
|
6
6
|
"repository": {
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"dist/"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"
|
|
26
|
-
"@flint.fyi/
|
|
27
|
-
"
|
|
25
|
+
"@flint.fyi/core": "^0.27.0",
|
|
26
|
+
"@flint.fyi/css-language": "^0.3.0",
|
|
27
|
+
"typescript": "^6.0.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"tsdown": "0.22.3",
|
|
31
|
-
"vitest": "4.1.0",
|
|
32
30
|
"@flint.fyi/build": "^0.1.0",
|
|
33
|
-
"@flint.fyi/rule-tester": "^0.
|
|
31
|
+
"@flint.fyi/rule-tester": "^0.20.0",
|
|
32
|
+
"tsdown": "0.23.0",
|
|
33
|
+
"vitest": "5.0.1"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=26.1.0"
|