@flint.fyi/css 0.3.0 → 0.3.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/index.mjs +22 -21
- package/package.json +7 -7
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.1",
|
|
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.26.0",
|
|
26
|
+
"@flint.fyi/css-language": "^0.2.1",
|
|
27
|
+
"typescript": "^6.0.0"
|
|
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.19.1",
|
|
32
|
+
"tsdown": "0.22.14",
|
|
33
|
+
"vitest": "4.1.11"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=26.1.0"
|