@d-zero/stylelint-rules 5.0.0-alpha.51 → 5.0.0-alpha.53
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.
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import stylelint from 'stylelint';
|
|
2
2
|
import { NAMESPACE, REPOSITORY_URL } from '../const.js';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param setting
|
|
6
|
+
*/
|
|
4
7
|
export function createRule(setting) {
|
|
5
8
|
const name = setting.name;
|
|
6
9
|
const ruleName = `${NAMESPACE}/${name}`;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import CSSTree from '@d-zero/csstree-scss-syntax';
|
|
2
2
|
import postcssValueParser from 'postcss-value-parser';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param decl
|
|
6
|
+
*/
|
|
3
7
|
export function getValueType(decl) {
|
|
4
8
|
if (decl.prop.startsWith('$')) {
|
|
5
9
|
return null;
|
|
@@ -17,6 +21,11 @@ export function getValueType(decl) {
|
|
|
17
21
|
throw error;
|
|
18
22
|
}
|
|
19
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param prop
|
|
27
|
+
* @param value
|
|
28
|
+
*/
|
|
20
29
|
function _getValueType(prop, value) {
|
|
21
30
|
const valueAst = postcssValueParser(value);
|
|
22
31
|
const valueAstFromCssTree = CSSTree.parse(value, { context: 'value' });
|
|
@@ -47,6 +56,10 @@ function _getValueType(prop, value) {
|
|
|
47
56
|
};
|
|
48
57
|
});
|
|
49
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param node
|
|
62
|
+
*/
|
|
50
63
|
function getValueNode(node) {
|
|
51
64
|
if (isProperty(node) || isType(node)) {
|
|
52
65
|
if (node.match[0].syntax === null) {
|
|
@@ -59,9 +72,17 @@ function getValueNode(node) {
|
|
|
59
72
|
}
|
|
60
73
|
return [node];
|
|
61
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @param node
|
|
78
|
+
*/
|
|
62
79
|
function isProperty(node) {
|
|
63
80
|
return node.syntax?.type === 'Property';
|
|
64
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param node
|
|
85
|
+
*/
|
|
65
86
|
function isType(node) {
|
|
66
87
|
return node.syntax?.type === 'Type';
|
|
67
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/stylelint-rules",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.53",
|
|
4
4
|
"description": "Rules of Stylelint for D-ZERO",
|
|
5
5
|
"repository": "https://github.com/d-zero-dev/linters.git",
|
|
6
6
|
"author": "D-ZERO Co., Ltd.",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"build": "tsc"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@d-zero/csstree-scss-syntax": "5.0.0-alpha.
|
|
27
|
-
"css-tree": "3.0
|
|
26
|
+
"@d-zero/csstree-scss-syntax": "5.0.0-alpha.53",
|
|
27
|
+
"css-tree": "3.1.0",
|
|
28
28
|
"postcss-selector-parser": "7.0.0",
|
|
29
29
|
"postcss-value-parser": "4.2.0",
|
|
30
|
-
"stylelint": "16.
|
|
30
|
+
"stylelint": "16.11.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"postcss": "8.4.49"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "6e32319be4b8a0fd9a09c9f82df89cf4f4fb46c5"
|
|
36
36
|
}
|