@plumeria/eslint-plugin 19.7.0 → 19.8.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/README.md +1 -1
- package/dist/rules/no-invalid-selector.js +17 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -102,7 +102,7 @@ Disallow calling APIs inside functions.
|
|
|
102
102
|
|
|
103
103
|
Disallow invalid selector inside `css.create()` and `css.keyframes()` and `css.viewTransition()`.
|
|
104
104
|
`create()` example: (Pseudo -> Query, Query -> Query)
|
|
105
|
-
Also reports a functional pseudo-class nested inside one of the same name, such as `:where(:where(.a), .b)`, and flattens it with a fix when the nested call is a whole argument. `:not()`
|
|
105
|
+
Also reports a functional pseudo-class nested inside one of the same name, such as `:where(:where(.a), .b)`, and flattens it with a fix when the nested call is a whole argument. `:not()` may nest inside `:not()`. Reports a key nested deeper than 16 levels or holding a stray quote.
|
|
106
106
|
|
|
107
107
|
### no-mixed-styling-props
|
|
108
108
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.noInvalidSelector = void 0;
|
|
4
|
+
const zss_engine_1 = require("zss-engine");
|
|
4
5
|
const styleObject_1 = require("../util/styleObject");
|
|
5
6
|
const staticValue_1 = require("../util/staticValue");
|
|
6
7
|
const flattenablePseudos = new Set([
|
|
@@ -147,7 +148,7 @@ function findSameNameNesting(text, ancestors) {
|
|
|
147
148
|
return null;
|
|
148
149
|
for (const call of calls) {
|
|
149
150
|
const key = call.prefix + call.name;
|
|
150
|
-
if (ancestors.includes(key))
|
|
151
|
+
if (key !== ':not' && ancestors.includes(key))
|
|
151
152
|
return call;
|
|
152
153
|
const nested = findSameNameNesting(call.args, [...ancestors, key]);
|
|
153
154
|
if (nested)
|
|
@@ -210,6 +211,8 @@ exports.noInvalidSelector = {
|
|
|
210
211
|
noPseudoInsidePseudo: 'Pseudo-selectors cannot be nested inside other pseudo-selectors.',
|
|
211
212
|
flattenSameNamePseudo: 'Flatten nested "{{name}}()" into a single "{{name}}()".',
|
|
212
213
|
noSameNamePseudoNesting: '"{{name}}()" cannot be nested inside another "{{name}}()"; rewrite it without nesting.',
|
|
214
|
+
tooDeepSelector: 'A selector key cannot nest parentheses deeper than {{max}} levels.',
|
|
215
|
+
strayQuote: 'A quote must open and close a string inside brackets or parentheses.',
|
|
213
216
|
invalidKeyframesKey: 'Keyframes keys must be "from", "to", or a percentage value (e.g. "0%", "50%", "100%").',
|
|
214
217
|
invalidViewTransitionKey: 'ViewTransition keys must be one of: "group", "imagePair", "new", "old".',
|
|
215
218
|
},
|
|
@@ -249,6 +252,19 @@ exports.noInvalidSelector = {
|
|
|
249
252
|
: staticValue(node);
|
|
250
253
|
if (typeof selector !== 'string' || !/^[:[]/.test(selector))
|
|
251
254
|
return;
|
|
255
|
+
const invalid = (0, zss_engine_1.findInvalidSelector)((0, zss_engine_1.stripSelectorComments)(selector));
|
|
256
|
+
if (invalid?.kind === 'too-deep') {
|
|
257
|
+
context.report({
|
|
258
|
+
node,
|
|
259
|
+
messageId: 'tooDeepSelector',
|
|
260
|
+
data: { max: String(zss_engine_1.MAX_SELECTOR_NESTING) },
|
|
261
|
+
});
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (invalid?.kind === 'stray-quote') {
|
|
265
|
+
context.report({ node, messageId: 'strayQuote' });
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
252
268
|
const nested = findSameNameNesting(selector, []);
|
|
253
269
|
if (!nested)
|
|
254
270
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/eslint-plugin",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.8.0",
|
|
4
4
|
"description": "Plumeria ESLint plugin",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"known-css-properties": "^0.37.0",
|
|
57
|
-
"zss-engine": "2.
|
|
58
|
-
"@plumeria/compiler": "19.
|
|
57
|
+
"zss-engine": "2.9.0",
|
|
58
|
+
"@plumeria/compiler": "19.8.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "rimraf dist && pnpm cjs",
|