You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are hundreds of rules in stylelint, which can be divided into three categories:
18
+
19
+
-`Rules for proofreading style` (mainly for spaces (such as spaces near colons), line breaks, indentation, etc.)
20
+
-`Rules for judging the maintainability of the cod`e (judging whether a certain ID is used in the CSS selector, or whether the !important keyword is applied in a statement)
21
+
-`Rules for judging code errors` (check whether the wrong HEX color writing or whether a certain abbreviated attribute will cover other declaration statements)
The rule attribute is an object, the key is the name of the rule, and the value is the rule configuration. Each rule configuration conforms to one of the following formats:
19
24
20
-
规则属性是一个对象,键是规则的名称,值是规则配置。每个规则配置符合下列格式之一:
21
-
- 单个值(primary option)
22
-
- 一个有两个值的数组([primary option,secondary option])
23
-
- null (关闭规则)
25
+
-`Single value` (primary option)
26
+
-`An array with two values` ([primary option,secondary option])
27
+
-`null` (close rule)
24
28
25
-
## 增加规则
29
+
## Add rules
26
30
27
-
修改.stylelintrc.js文件,添加选项,比如:
31
+
Modify the `.stylelintrc.js` file and add options:
28
32
29
33
```javascript
30
34
31
35
module.exports= {
32
36
"extends":"stylelint-config-recommended",
33
37
"rules":{
34
38
"unit-no-unknown":false,
35
-
"indentation":"tab", //缩进
36
-
"unit-no-unknown":true,//禁止未知单位
39
+
"indentation":"tab",
40
+
"unit-no-unknown":true,
37
41
"color-hex-case": [
38
42
"lower", {
39
43
"message":"Lowercase letters are easier to distinguish from numbers"
0 commit comments