@alexlit/config-stylelint 64.1.3 → 64.2.0
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/index.js +1 -1
- package/package.json +3 -3
- package/plugins/color-format.js +5 -18
- package/plugins/order.js +19 -19
package/index.js
CHANGED
|
@@ -76,7 +76,7 @@ const BASE_RULES = {
|
|
|
76
76
|
},
|
|
77
77
|
],
|
|
78
78
|
'font-family-name-quotes': 'always-unless-keyword',
|
|
79
|
-
'function-no-unknown': null, //
|
|
79
|
+
'function-no-unknown': null, // делегируем правилу scss/function-no-unknown
|
|
80
80
|
'function-url-quotes': 'always',
|
|
81
81
|
'function-url-scheme-disallowed-list': ['/^data/', 'ftp', '/^http/'],
|
|
82
82
|
'hue-degree-notation': 'angle',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexlit/config-stylelint",
|
|
3
|
-
"version": "64.
|
|
3
|
+
"version": "64.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Stylelint config",
|
|
6
6
|
"keywords": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"stylelint-config-standard": "^40.0.0",
|
|
51
51
|
"stylelint-config-standard-scss": "^17.0.0",
|
|
52
52
|
"stylelint-declaration-block-no-ignored-properties": "^3.0.0",
|
|
53
|
-
"stylelint-gamut": "^2.0.
|
|
53
|
+
"stylelint-gamut": "^2.0.2",
|
|
54
54
|
"stylelint-high-performance-animation": "^2.0.0",
|
|
55
55
|
"stylelint-media-use-custom-media": "^4.1.0",
|
|
56
56
|
"stylelint-no-indistinguishable-colors": "^2.3.1",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"stylelint-no-unsupported-browser-features": "^8.1.2",
|
|
60
60
|
"stylelint-order": "^8.1.3",
|
|
61
61
|
"stylelint-plugin-logical-css": "^2.1.0",
|
|
62
|
-
"stylelint-prettier": "^5.0
|
|
62
|
+
"stylelint-prettier": "^5.1.0",
|
|
63
63
|
"stylelint-scss": "^7.4.0",
|
|
64
64
|
"stylelint-selector-no-empty": "^1.0.9",
|
|
65
65
|
"stylelint-use-nesting": "^6.0.2"
|
package/plugins/color-format.js
CHANGED
|
@@ -103,7 +103,7 @@ const messages = ruleMessages(ruleName, {
|
|
|
103
103
|
rejected: (hex) => `Unexpected hex color "${hex}"`,
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
-
const rule = function (actual
|
|
106
|
+
const rule = function (actual) {
|
|
107
107
|
return (root, result) => {
|
|
108
108
|
const validOptions = validateOptions(result, ruleName, {
|
|
109
109
|
actual,
|
|
@@ -116,7 +116,6 @@ const rule = function (actual, options, context) {
|
|
|
116
116
|
|
|
117
117
|
root.walkDecls((decl) => {
|
|
118
118
|
const declString = decl.toString();
|
|
119
|
-
const fixPositions = [];
|
|
120
119
|
|
|
121
120
|
styleSearch(declString, '#', (match) => {
|
|
122
121
|
if (!/[:,\s]/.test(declString[match.startIndex - 1])) {
|
|
@@ -133,16 +132,6 @@ const rule = function (actual, options, context) {
|
|
|
133
132
|
|
|
134
133
|
const hexValue = hexMatch[0];
|
|
135
134
|
|
|
136
|
-
if (context && context.fix) {
|
|
137
|
-
fixPositions.unshift({
|
|
138
|
-
fixTo: actual.format,
|
|
139
|
-
hexValue,
|
|
140
|
-
startIndex: match.startIndex,
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
135
|
const message =
|
|
147
136
|
actual && actual.message
|
|
148
137
|
? messages.custom(actual.message)
|
|
@@ -150,6 +139,9 @@ const rule = function (actual, options, context) {
|
|
|
150
139
|
|
|
151
140
|
report({
|
|
152
141
|
endIndex: match.endIndex,
|
|
142
|
+
fix: () => {
|
|
143
|
+
decl.value = replaceHexes(decl.value, actual.format);
|
|
144
|
+
},
|
|
153
145
|
index: match.startIndex,
|
|
154
146
|
message,
|
|
155
147
|
node: decl,
|
|
@@ -157,18 +149,13 @@ const rule = function (actual, options, context) {
|
|
|
157
149
|
ruleName,
|
|
158
150
|
});
|
|
159
151
|
});
|
|
160
|
-
|
|
161
|
-
if (fixPositions.length > 0) {
|
|
162
|
-
fixPositions.forEach((fixPosition) => {
|
|
163
|
-
decl.value = replaceHexes(decl.value, fixPosition.fixTo);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
152
|
});
|
|
167
153
|
};
|
|
168
154
|
};
|
|
169
155
|
|
|
170
156
|
rule.ruleName = ruleName;
|
|
171
157
|
rule.messages = messages;
|
|
158
|
+
rule.meta = { fixable: true };
|
|
172
159
|
|
|
173
160
|
const DEFAULTS = {
|
|
174
161
|
plugins: [createPlugin(ruleName, rule)],
|
package/plugins/order.js
CHANGED
|
@@ -122,57 +122,57 @@ const DEFAULTS = {
|
|
|
122
122
|
rules: {
|
|
123
123
|
'order/custom-properties-alphabetical-order': true,
|
|
124
124
|
'order/order': [
|
|
125
|
-
// SASS
|
|
125
|
+
// Переменные SASS
|
|
126
126
|
'dollar-variables',
|
|
127
127
|
|
|
128
|
-
// LESS
|
|
128
|
+
// Переменные LESS
|
|
129
129
|
'at-variables',
|
|
130
130
|
|
|
131
|
-
// SASS
|
|
131
|
+
// SASS-расширения (extend)
|
|
132
132
|
{ name: 'extend', type: 'at-rule' },
|
|
133
133
|
|
|
134
|
-
// SASS
|
|
134
|
+
// SASS-директивы include
|
|
135
135
|
{ hasBlock: false, name: 'include', type: 'at-rule' },
|
|
136
136
|
|
|
137
|
-
// Tailwind
|
|
137
|
+
// Директивы @apply Tailwind
|
|
138
138
|
{ name: 'apply', type: 'at-rule' },
|
|
139
139
|
|
|
140
|
-
// CSS
|
|
140
|
+
// CSS-кастомные свойства
|
|
141
141
|
'custom-properties',
|
|
142
142
|
|
|
143
|
-
//
|
|
143
|
+
// Объявления
|
|
144
144
|
'declarations',
|
|
145
145
|
|
|
146
|
-
//
|
|
146
|
+
// Медиавыражения
|
|
147
147
|
...buildMediaFeatureRules(),
|
|
148
148
|
|
|
149
|
-
// At
|
|
149
|
+
// At-правила
|
|
150
150
|
...AT_RULES.map((name) => ({ name, type: 'at-rule' })),
|
|
151
151
|
'at-rules',
|
|
152
152
|
|
|
153
|
-
//
|
|
153
|
+
// Псевдоэлементы
|
|
154
154
|
...buildPseudoElementRules(),
|
|
155
155
|
|
|
156
|
-
//
|
|
156
|
+
// Псевдоклассы
|
|
157
157
|
...buildPseudoClassRules(),
|
|
158
158
|
|
|
159
|
-
// BEM
|
|
159
|
+
// BEM в функциях псевдоклассов (:deep, :global, :slotted)
|
|
160
160
|
...buildPseudoClassBemRules('--'),
|
|
161
161
|
...buildPseudoClassBemRules('__'),
|
|
162
162
|
|
|
163
|
-
// ID
|
|
163
|
+
// Селектор по ID
|
|
164
164
|
{ selector: /#/, type: 'rule' },
|
|
165
165
|
|
|
166
|
-
//
|
|
166
|
+
// Список селекторов
|
|
167
167
|
{ selector: ',', type: 'rule' },
|
|
168
168
|
|
|
169
|
-
//
|
|
169
|
+
// Селекторы классов
|
|
170
170
|
...buildLetterRules(String.raw`\.`),
|
|
171
171
|
|
|
172
|
-
//
|
|
172
|
+
// Селекторы атрибутов
|
|
173
173
|
...buildAttributeRules(),
|
|
174
174
|
|
|
175
|
-
//
|
|
175
|
+
// Комбинаторы
|
|
176
176
|
{ selector: /\*/, type: 'rule' },
|
|
177
177
|
{ selector: /\+/, type: 'rule' },
|
|
178
178
|
{ selector: />/, type: 'rule' },
|
|
@@ -180,10 +180,10 @@ const DEFAULTS = {
|
|
|
180
180
|
{ selector: /~/, type: 'rule' },
|
|
181
181
|
'rules',
|
|
182
182
|
|
|
183
|
-
// BEM
|
|
183
|
+
// BEM-модификатор
|
|
184
184
|
...buildLetterRules('--'),
|
|
185
185
|
|
|
186
|
-
// BEM
|
|
186
|
+
// BEM-элемент
|
|
187
187
|
...buildLetterRules('__'),
|
|
188
188
|
],
|
|
189
189
|
'order/properties-alphabetical-order': true,
|