@atomicsmash/coding-standards 17.0.3-beta.0 → 18.0.0-beta.10
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/CHANGELOG.md +106 -0
- package/dist/cspell/index.d.ts +15 -0
- package/dist/cspell/index.d.ts.map +1 -0
- package/dist/cspell/index.js +133 -0
- package/dist/eslint/index.d.ts +4 -0
- package/dist/eslint/index.d.ts.map +1 -0
- package/dist/eslint/index.js +199 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/prettier/index.d.ts +13 -0
- package/dist/prettier/index.d.ts.map +1 -0
- package/dist/prettier/index.js +32 -0
- package/dist/stylelint/base.d.ts +69 -0
- package/dist/stylelint/base.d.ts.map +1 -0
- package/dist/stylelint/base.js +86 -0
- package/dist/stylelint/classic.d.ts +69 -0
- package/dist/stylelint/classic.d.ts.map +1 -0
- package/dist/stylelint/classic.js +2 -0
- package/dist/stylelint/index.d.ts +161 -0
- package/dist/stylelint/index.d.ts.map +1 -0
- package/dist/stylelint/index.js +4 -0
- package/dist/stylelint/tailwind.d.ts +21 -0
- package/dist/stylelint/tailwind.d.ts.map +1 -0
- package/dist/stylelint/tailwind.js +38 -0
- package/dist/stylelint/theme-json.d.ts +73 -0
- package/dist/stylelint/theme-json.d.ts.map +1 -0
- package/dist/stylelint/theme-json.js +169 -0
- package/package.json +55 -7
- package/typescript/base.json +6 -3
- package/typescript/cypress.json +1 -1
- package/.eslintrc.cjs +0 -8
- package/beta/README.md +0 -3
- package/cspell/index.cjs +0 -142
- package/cspell/index.js +0 -1
- package/cspell/index.mjs +0 -142
- package/index.d.ts +0 -7
- package/index.js +0 -5
- package/index.mjs +0 -4
- package/prettier/index.cjs +0 -35
- package/prettier/index.js +0 -1
- package/prettier/index.mjs +0 -35
- package/stylelint/base.cjs +0 -91
- package/stylelint/base.js +0 -1
- package/stylelint/base.mjs +0 -91
- package/stylelint/classic.cjs +0 -3
- package/stylelint/classic.js +0 -1
- package/stylelint/classic.mjs +0 -2
- package/stylelint/index.cjs +0 -5
- package/stylelint/index.mjs +0 -4
- package/stylelint/tailwind.cjs +0 -38
- package/stylelint/tailwind.js +0 -1
- package/stylelint/tailwind.mjs +0 -38
- package/stylelint/theme-json.cjs +0 -189
- package/stylelint/theme-json.js +0 -1
- package/stylelint/theme-json.mjs +0 -189
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const commonRules = {
|
|
2
|
+
"custom-property-pattern": null,
|
|
3
|
+
"function-url-quotes": ["always"],
|
|
4
|
+
"rule-empty-line-before": [
|
|
5
|
+
"always",
|
|
6
|
+
{
|
|
7
|
+
except: ["first-nested"],
|
|
8
|
+
ignore: ["after-comment"],
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
"comment-empty-line-before": [
|
|
12
|
+
"always",
|
|
13
|
+
{
|
|
14
|
+
except: ["first-nested"],
|
|
15
|
+
ignore: ["stylelint-commands"],
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
"order/order": [
|
|
19
|
+
{
|
|
20
|
+
type: "at-rule",
|
|
21
|
+
hasBlock: false,
|
|
22
|
+
},
|
|
23
|
+
"custom-properties",
|
|
24
|
+
"dollar-variables",
|
|
25
|
+
"declarations",
|
|
26
|
+
{
|
|
27
|
+
type: "at-rule",
|
|
28
|
+
hasBlock: true,
|
|
29
|
+
},
|
|
30
|
+
"rules",
|
|
31
|
+
],
|
|
32
|
+
"plugin/no-restricted-syntax": [
|
|
33
|
+
[
|
|
34
|
+
{
|
|
35
|
+
selector: "rule :matches(atrule[name=media], atrule[name=container]) rule",
|
|
36
|
+
message: "Don't nest rules inside of media/container blocks. Instead, nest the rule and use the at rule within that.",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
],
|
|
40
|
+
"selector-class-pattern": [
|
|
41
|
+
"^([a-z][a-z0-9]*)([_-]+[a-z0-9]+)*$",
|
|
42
|
+
{
|
|
43
|
+
message: "Selector should use lowercase and separate words with hyphens or underscores (selector-class-pattern)",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
"at-rule-empty-line-before": [
|
|
47
|
+
"always",
|
|
48
|
+
{
|
|
49
|
+
ignore: ["blockless-after-blockless", "first-nested", "after-comment"],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
export default {
|
|
54
|
+
reportDescriptionlessDisables: true,
|
|
55
|
+
reportInvalidScopeDisables: true,
|
|
56
|
+
reportNeedlessDisables: true,
|
|
57
|
+
plugins: ["stylelint-order", "stylelint-no-restricted-syntax"],
|
|
58
|
+
rules: commonRules,
|
|
59
|
+
overrides: [
|
|
60
|
+
{
|
|
61
|
+
files: ["*.css", "**/*.css"],
|
|
62
|
+
extends: ["stylelint-config-standard", "@wordpress/stylelint-config"],
|
|
63
|
+
rules: {
|
|
64
|
+
"at-rule-no-unknown": [true, { ignoreAtRules: "context" }],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
files: ["*.scss", "**/*.scss"],
|
|
69
|
+
extends: [
|
|
70
|
+
"stylelint-config-standard-scss",
|
|
71
|
+
"@wordpress/stylelint-config/scss",
|
|
72
|
+
],
|
|
73
|
+
rules: {
|
|
74
|
+
"scss/operator-no-newline-after": null,
|
|
75
|
+
"no-descending-specificity": null,
|
|
76
|
+
"scss/at-rule-no-unknown": [true, { ignoreAtRules: "context" }],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
files: ["**/editor-style?(s).?(s)css"],
|
|
81
|
+
rules: {
|
|
82
|
+
"declaration-property-value-allowed-list": null,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
reportDescriptionlessDisables: true;
|
|
3
|
+
reportInvalidScopeDisables: true;
|
|
4
|
+
reportNeedlessDisables: true;
|
|
5
|
+
plugins: string[];
|
|
6
|
+
rules: {
|
|
7
|
+
"custom-property-pattern": null;
|
|
8
|
+
"function-url-quotes": string[];
|
|
9
|
+
"rule-empty-line-before": (string | {
|
|
10
|
+
except: string[];
|
|
11
|
+
ignore: string[];
|
|
12
|
+
})[];
|
|
13
|
+
"comment-empty-line-before": (string | {
|
|
14
|
+
except: string[];
|
|
15
|
+
ignore: string[];
|
|
16
|
+
})[];
|
|
17
|
+
"order/order": (string | {
|
|
18
|
+
type: string;
|
|
19
|
+
hasBlock: boolean;
|
|
20
|
+
})[];
|
|
21
|
+
"plugin/no-restricted-syntax": {
|
|
22
|
+
selector: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}[][];
|
|
25
|
+
"selector-class-pattern": (string | {
|
|
26
|
+
message: string;
|
|
27
|
+
})[];
|
|
28
|
+
"at-rule-empty-line-before": (string | {
|
|
29
|
+
ignore: string[];
|
|
30
|
+
})[];
|
|
31
|
+
};
|
|
32
|
+
overrides: ({
|
|
33
|
+
files: string[];
|
|
34
|
+
extends: string[];
|
|
35
|
+
rules: {
|
|
36
|
+
"at-rule-no-unknown": (boolean | {
|
|
37
|
+
ignoreAtRules: string;
|
|
38
|
+
})[];
|
|
39
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
40
|
+
"no-descending-specificity"?: undefined;
|
|
41
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
42
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
files: string[];
|
|
46
|
+
extends: string[];
|
|
47
|
+
rules: {
|
|
48
|
+
"scss/operator-no-newline-after": null;
|
|
49
|
+
"no-descending-specificity": null;
|
|
50
|
+
"scss/at-rule-no-unknown": (boolean | {
|
|
51
|
+
ignoreAtRules: string;
|
|
52
|
+
})[];
|
|
53
|
+
"at-rule-no-unknown"?: undefined;
|
|
54
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
55
|
+
};
|
|
56
|
+
} | {
|
|
57
|
+
files: string[];
|
|
58
|
+
rules: {
|
|
59
|
+
"declaration-property-value-allowed-list": null;
|
|
60
|
+
"at-rule-no-unknown"?: undefined;
|
|
61
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
62
|
+
"no-descending-specificity"?: undefined;
|
|
63
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
64
|
+
};
|
|
65
|
+
extends?: undefined;
|
|
66
|
+
})[];
|
|
67
|
+
};
|
|
68
|
+
export default _default;
|
|
69
|
+
//# sourceMappingURL=classic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classic.d.ts","sourceRoot":"","sources":["../../src/stylelint/classic.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAAuC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
classic: {
|
|
3
|
+
reportDescriptionlessDisables: true;
|
|
4
|
+
reportInvalidScopeDisables: true;
|
|
5
|
+
reportNeedlessDisables: true;
|
|
6
|
+
plugins: string[];
|
|
7
|
+
rules: {
|
|
8
|
+
"custom-property-pattern": null;
|
|
9
|
+
"function-url-quotes": string[];
|
|
10
|
+
"rule-empty-line-before": (string | {
|
|
11
|
+
except: string[];
|
|
12
|
+
ignore: string[];
|
|
13
|
+
})[];
|
|
14
|
+
"comment-empty-line-before": (string | {
|
|
15
|
+
except: string[];
|
|
16
|
+
ignore: string[];
|
|
17
|
+
})[];
|
|
18
|
+
"order/order": (string | {
|
|
19
|
+
type: string;
|
|
20
|
+
hasBlock: boolean;
|
|
21
|
+
})[];
|
|
22
|
+
"plugin/no-restricted-syntax": {
|
|
23
|
+
selector: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}[][];
|
|
26
|
+
"selector-class-pattern": (string | {
|
|
27
|
+
message: string;
|
|
28
|
+
})[];
|
|
29
|
+
"at-rule-empty-line-before": (string | {
|
|
30
|
+
ignore: string[];
|
|
31
|
+
})[];
|
|
32
|
+
};
|
|
33
|
+
overrides: ({
|
|
34
|
+
files: string[];
|
|
35
|
+
extends: string[];
|
|
36
|
+
rules: {
|
|
37
|
+
"at-rule-no-unknown": (boolean | {
|
|
38
|
+
ignoreAtRules: string;
|
|
39
|
+
})[];
|
|
40
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
41
|
+
"no-descending-specificity"?: undefined;
|
|
42
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
43
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
files: string[];
|
|
47
|
+
extends: string[];
|
|
48
|
+
rules: {
|
|
49
|
+
"scss/operator-no-newline-after": null;
|
|
50
|
+
"no-descending-specificity": null;
|
|
51
|
+
"scss/at-rule-no-unknown": (boolean | {
|
|
52
|
+
ignoreAtRules: string;
|
|
53
|
+
})[];
|
|
54
|
+
"at-rule-no-unknown"?: undefined;
|
|
55
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
56
|
+
};
|
|
57
|
+
} | {
|
|
58
|
+
files: string[];
|
|
59
|
+
rules: {
|
|
60
|
+
"declaration-property-value-allowed-list": null;
|
|
61
|
+
"at-rule-no-unknown"?: undefined;
|
|
62
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
63
|
+
"no-descending-specificity"?: undefined;
|
|
64
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
65
|
+
};
|
|
66
|
+
extends?: undefined;
|
|
67
|
+
})[];
|
|
68
|
+
};
|
|
69
|
+
themeJson: {
|
|
70
|
+
rules: {
|
|
71
|
+
"declaration-property-value-allowed-list": (Record<string, string[]> | {
|
|
72
|
+
severity: string;
|
|
73
|
+
message: (property: string, value: string) => string;
|
|
74
|
+
})[];
|
|
75
|
+
"custom-property-pattern": null;
|
|
76
|
+
"function-url-quotes": string[];
|
|
77
|
+
"rule-empty-line-before": (string | {
|
|
78
|
+
except: string[];
|
|
79
|
+
ignore: string[];
|
|
80
|
+
})[];
|
|
81
|
+
"comment-empty-line-before": (string | {
|
|
82
|
+
except: string[];
|
|
83
|
+
ignore: string[];
|
|
84
|
+
})[];
|
|
85
|
+
"order/order": (string | {
|
|
86
|
+
type: string;
|
|
87
|
+
hasBlock: boolean;
|
|
88
|
+
})[];
|
|
89
|
+
"plugin/no-restricted-syntax": {
|
|
90
|
+
selector: string;
|
|
91
|
+
message: string;
|
|
92
|
+
}[][];
|
|
93
|
+
"selector-class-pattern": (string | {
|
|
94
|
+
message: string;
|
|
95
|
+
})[];
|
|
96
|
+
"at-rule-empty-line-before": (string | {
|
|
97
|
+
ignore: string[];
|
|
98
|
+
})[];
|
|
99
|
+
};
|
|
100
|
+
reportDescriptionlessDisables: true;
|
|
101
|
+
reportInvalidScopeDisables: true;
|
|
102
|
+
reportNeedlessDisables: true;
|
|
103
|
+
plugins: string[];
|
|
104
|
+
overrides: ({
|
|
105
|
+
files: string[];
|
|
106
|
+
extends: string[];
|
|
107
|
+
rules: {
|
|
108
|
+
"at-rule-no-unknown": (boolean | {
|
|
109
|
+
ignoreAtRules: string;
|
|
110
|
+
})[];
|
|
111
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
112
|
+
"no-descending-specificity"?: undefined;
|
|
113
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
114
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
115
|
+
};
|
|
116
|
+
} | {
|
|
117
|
+
files: string[];
|
|
118
|
+
extends: string[];
|
|
119
|
+
rules: {
|
|
120
|
+
"scss/operator-no-newline-after": null;
|
|
121
|
+
"no-descending-specificity": null;
|
|
122
|
+
"scss/at-rule-no-unknown": (boolean | {
|
|
123
|
+
ignoreAtRules: string;
|
|
124
|
+
})[];
|
|
125
|
+
"at-rule-no-unknown"?: undefined;
|
|
126
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
127
|
+
};
|
|
128
|
+
} | {
|
|
129
|
+
files: string[];
|
|
130
|
+
rules: {
|
|
131
|
+
"declaration-property-value-allowed-list": null;
|
|
132
|
+
"at-rule-no-unknown"?: undefined;
|
|
133
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
134
|
+
"no-descending-specificity"?: undefined;
|
|
135
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
136
|
+
};
|
|
137
|
+
extends?: undefined;
|
|
138
|
+
})[];
|
|
139
|
+
};
|
|
140
|
+
tailwind: {
|
|
141
|
+
overrides: ({
|
|
142
|
+
files: string[];
|
|
143
|
+
rules: {
|
|
144
|
+
"at-rule-no-unknown": (boolean | {
|
|
145
|
+
ignoreAtRules: string[];
|
|
146
|
+
})[];
|
|
147
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
148
|
+
};
|
|
149
|
+
} | {
|
|
150
|
+
files: string[];
|
|
151
|
+
rules: {
|
|
152
|
+
"scss/at-rule-no-unknown": (boolean | {
|
|
153
|
+
ignoreAtRules: string[];
|
|
154
|
+
})[];
|
|
155
|
+
"at-rule-no-unknown"?: undefined;
|
|
156
|
+
};
|
|
157
|
+
})[];
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
export default _default;
|
|
161
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stylelint/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAAgD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
overrides: ({
|
|
3
|
+
files: string[];
|
|
4
|
+
rules: {
|
|
5
|
+
"at-rule-no-unknown": (boolean | {
|
|
6
|
+
ignoreAtRules: string[];
|
|
7
|
+
})[];
|
|
8
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
9
|
+
};
|
|
10
|
+
} | {
|
|
11
|
+
files: string[];
|
|
12
|
+
rules: {
|
|
13
|
+
"scss/at-rule-no-unknown": (boolean | {
|
|
14
|
+
ignoreAtRules: string[];
|
|
15
|
+
})[];
|
|
16
|
+
"at-rule-no-unknown"?: undefined;
|
|
17
|
+
};
|
|
18
|
+
})[];
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
21
|
+
//# sourceMappingURL=tailwind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.d.ts","sourceRoot":"","sources":["../../src/stylelint/tailwind.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,wBAqCmB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
overrides: [
|
|
3
|
+
{
|
|
4
|
+
files: ["*.css", "**/*.css"],
|
|
5
|
+
rules: {
|
|
6
|
+
"at-rule-no-unknown": [
|
|
7
|
+
true,
|
|
8
|
+
{
|
|
9
|
+
ignoreAtRules: [
|
|
10
|
+
"tailwind",
|
|
11
|
+
"apply",
|
|
12
|
+
"variants",
|
|
13
|
+
"responsive",
|
|
14
|
+
"screen",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
files: ["*.scss", "**/*.scss"],
|
|
22
|
+
rules: {
|
|
23
|
+
"scss/at-rule-no-unknown": [
|
|
24
|
+
true,
|
|
25
|
+
{
|
|
26
|
+
ignoreAtRules: [
|
|
27
|
+
"tailwind",
|
|
28
|
+
"apply",
|
|
29
|
+
"variants",
|
|
30
|
+
"responsive",
|
|
31
|
+
"screen",
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
rules: {
|
|
3
|
+
"declaration-property-value-allowed-list": (Record<string, string[]> | {
|
|
4
|
+
severity: string;
|
|
5
|
+
message: (property: string, value: string) => string;
|
|
6
|
+
})[];
|
|
7
|
+
"custom-property-pattern": null;
|
|
8
|
+
"function-url-quotes": string[];
|
|
9
|
+
"rule-empty-line-before": (string | {
|
|
10
|
+
except: string[];
|
|
11
|
+
ignore: string[];
|
|
12
|
+
})[];
|
|
13
|
+
"comment-empty-line-before": (string | {
|
|
14
|
+
except: string[];
|
|
15
|
+
ignore: string[];
|
|
16
|
+
})[];
|
|
17
|
+
"order/order": (string | {
|
|
18
|
+
type: string;
|
|
19
|
+
hasBlock: boolean;
|
|
20
|
+
})[];
|
|
21
|
+
"plugin/no-restricted-syntax": {
|
|
22
|
+
selector: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}[][];
|
|
25
|
+
"selector-class-pattern": (string | {
|
|
26
|
+
message: string;
|
|
27
|
+
})[];
|
|
28
|
+
"at-rule-empty-line-before": (string | {
|
|
29
|
+
ignore: string[];
|
|
30
|
+
})[];
|
|
31
|
+
};
|
|
32
|
+
reportDescriptionlessDisables: true;
|
|
33
|
+
reportInvalidScopeDisables: true;
|
|
34
|
+
reportNeedlessDisables: true;
|
|
35
|
+
plugins: string[];
|
|
36
|
+
overrides: ({
|
|
37
|
+
files: string[];
|
|
38
|
+
extends: string[];
|
|
39
|
+
rules: {
|
|
40
|
+
"at-rule-no-unknown": (boolean | {
|
|
41
|
+
ignoreAtRules: string;
|
|
42
|
+
})[];
|
|
43
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
44
|
+
"no-descending-specificity"?: undefined;
|
|
45
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
46
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
files: string[];
|
|
50
|
+
extends: string[];
|
|
51
|
+
rules: {
|
|
52
|
+
"scss/operator-no-newline-after": null;
|
|
53
|
+
"no-descending-specificity": null;
|
|
54
|
+
"scss/at-rule-no-unknown": (boolean | {
|
|
55
|
+
ignoreAtRules: string;
|
|
56
|
+
})[];
|
|
57
|
+
"at-rule-no-unknown"?: undefined;
|
|
58
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
59
|
+
};
|
|
60
|
+
} | {
|
|
61
|
+
files: string[];
|
|
62
|
+
rules: {
|
|
63
|
+
"declaration-property-value-allowed-list": null;
|
|
64
|
+
"at-rule-no-unknown"?: undefined;
|
|
65
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
66
|
+
"no-descending-specificity"?: undefined;
|
|
67
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
68
|
+
};
|
|
69
|
+
extends?: undefined;
|
|
70
|
+
})[];
|
|
71
|
+
};
|
|
72
|
+
export default _default;
|
|
73
|
+
//# sourceMappingURL=theme-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-json.d.ts","sourceRoot":"","sources":["../../src/stylelint/theme-json.ts"],"names":[],"mappings":";;;;gCAqIuB,MAAM,SAAS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgD5C,wBAMmB"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import baseConfig from "./base.js";
|
|
2
|
+
function createAllowedPropertyList(values) {
|
|
3
|
+
const allowedPropertyList = {};
|
|
4
|
+
for (const { property, varInfo, shorthand = 1, additionalAllowedValues = [], } of values) {
|
|
5
|
+
const isRegexProperty = property instanceof RegExp;
|
|
6
|
+
const possibleValues = [];
|
|
7
|
+
const possibleVars = [
|
|
8
|
+
...additionalAllowedValues.map((value) => value instanceof RegExp ? value.toString() : value),
|
|
9
|
+
`(var\\([\\s]*--wp--${varInfo.type}--${varInfo.slug}--([a-z-0-9]+[\\s]*)\\))`,
|
|
10
|
+
];
|
|
11
|
+
if (isRegexProperty) {
|
|
12
|
+
possibleVars.push(`(var\\([\\s]*--[a-z-0-9]*${property.toString().slice(1, -1)}[a-z-0-9]*[\\s]*\\))`);
|
|
13
|
+
}
|
|
14
|
+
else if (property) {
|
|
15
|
+
possibleVars.push(`(var\\([\\s]*--[a-z-0-9]*${property}[a-z-0-9]*[\\s]*\\))`);
|
|
16
|
+
}
|
|
17
|
+
possibleValues.push(
|
|
18
|
+
// For each shorthand value, allow one of the possible values followed by a space, or allow it to be blank
|
|
19
|
+
`/^${shorthand > 1 ? `((${possibleVars.join("|")})[\\s]*){0,${(shorthand - 1).toString()}}` : ""}(${possibleVars.join("|")})$/`);
|
|
20
|
+
allowedPropertyList[property.toString()] = possibleValues;
|
|
21
|
+
if (!isRegexProperty) {
|
|
22
|
+
allowedPropertyList[`/--[a-z-0-9]*${property}[a-z-0-9]*/`] =
|
|
23
|
+
possibleValues;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return allowedPropertyList;
|
|
27
|
+
}
|
|
28
|
+
const rules = {
|
|
29
|
+
"declaration-property-value-allowed-list": [
|
|
30
|
+
createAllowedPropertyList([
|
|
31
|
+
{
|
|
32
|
+
property: /border((-top|-bottom)(-left|-right))?-radius/,
|
|
33
|
+
varInfo: {
|
|
34
|
+
type: "custom",
|
|
35
|
+
slug: "radius",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
property: "border-radius",
|
|
40
|
+
varInfo: {
|
|
41
|
+
type: "custom",
|
|
42
|
+
slug: "radius",
|
|
43
|
+
},
|
|
44
|
+
shorthand: 4,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
property: "box-shadow",
|
|
48
|
+
varInfo: {
|
|
49
|
+
type: "preset",
|
|
50
|
+
slug: "shadow",
|
|
51
|
+
},
|
|
52
|
+
additionalAllowedValues: ["none", "unset"],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
property: /color/,
|
|
56
|
+
varInfo: {
|
|
57
|
+
type: "preset",
|
|
58
|
+
slug: "color",
|
|
59
|
+
},
|
|
60
|
+
additionalAllowedValues: ["inherit", "currentcolor"],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
property: "background-color",
|
|
64
|
+
varInfo: {
|
|
65
|
+
type: "preset",
|
|
66
|
+
slug: "color",
|
|
67
|
+
},
|
|
68
|
+
additionalAllowedValues: ["transparent"],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
property: "font-family",
|
|
72
|
+
varInfo: {
|
|
73
|
+
type: "preset",
|
|
74
|
+
slug: "font-family",
|
|
75
|
+
},
|
|
76
|
+
additionalAllowedValues: ["inherit"],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
property: "font-size",
|
|
80
|
+
varInfo: {
|
|
81
|
+
type: "preset",
|
|
82
|
+
slug: "font-size",
|
|
83
|
+
},
|
|
84
|
+
additionalAllowedValues: ["inherit"],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
property: /(?<!scroll-)margin/,
|
|
88
|
+
varInfo: {
|
|
89
|
+
type: "preset",
|
|
90
|
+
slug: "spacing",
|
|
91
|
+
},
|
|
92
|
+
shorthand: 4,
|
|
93
|
+
additionalAllowedValues: ["auto", "var\\(--wp--style--block-gap\\)"],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
property: /padding/,
|
|
97
|
+
varInfo: {
|
|
98
|
+
type: "preset",
|
|
99
|
+
slug: "spacing",
|
|
100
|
+
},
|
|
101
|
+
shorthand: 4,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
property: "z-index",
|
|
105
|
+
varInfo: {
|
|
106
|
+
type: "custom",
|
|
107
|
+
slug: "z-index",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
]),
|
|
111
|
+
{
|
|
112
|
+
severity: "warning",
|
|
113
|
+
message: (property, value) => {
|
|
114
|
+
// Until updated, property and value will always return undefined.
|
|
115
|
+
return `Most values for this type of property should be defined in theme.json. (declaration-property-value-allowed-list)`;
|
|
116
|
+
// The following code is not complete, it has been left to show how this function could provide more helpful error
|
|
117
|
+
// messages once an update to stylelint is possible.
|
|
118
|
+
let message = `Invalid property provided for ${property}.`;
|
|
119
|
+
let ruleKey;
|
|
120
|
+
if (property.includes("color")) {
|
|
121
|
+
ruleKey = "/color/";
|
|
122
|
+
}
|
|
123
|
+
else if (property.includes("margin")) {
|
|
124
|
+
ruleKey = "/margin/";
|
|
125
|
+
}
|
|
126
|
+
else if (property.includes("padding")) {
|
|
127
|
+
ruleKey = "/padding/";
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
ruleKey = property;
|
|
131
|
+
}
|
|
132
|
+
switch (ruleKey) {
|
|
133
|
+
case "z-index": {
|
|
134
|
+
message = `z-index must use one of the values specified in the theme.json file under \`settings.custom.z-index\`.`;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case "/color/": {
|
|
138
|
+
message = `Colour values must use one of the values specified in the theme.json file under \`settings.color.palette\`.`;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "/margin/": {
|
|
142
|
+
message = `Margin values must use one of the values specified in the theme.json file under \`settings.spacing.spacingSizes\`.`;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
case "/padding/": {
|
|
146
|
+
message = `Padding values must use one of the values specified in the theme.json file under \`settings.spacing.spacingSizes\`.`;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case "font-size": {
|
|
150
|
+
message = `Font size values must use one of the values specified in the theme.json file under \`settings.typography.fontSizes\`.`;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case "font-family": {
|
|
154
|
+
message = `Font family values must use one of the values specified in the theme.json file under \`settings.typography.fontFamilies\`.`;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return `${message} Value provided: ${value} (declaration-property-value-allowed-list)`;
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
};
|
|
163
|
+
export default {
|
|
164
|
+
...baseConfig,
|
|
165
|
+
rules: {
|
|
166
|
+
...baseConfig.rules,
|
|
167
|
+
...rules,
|
|
168
|
+
},
|
|
169
|
+
};
|