@plumeria/eslint-plugin 19.0.0 → 19.1.1

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 CHANGED
@@ -151,7 +151,7 @@ Validates CSS pseudo-classes and pseudo-elements inside `css.create()`. It check
151
151
 
152
152
  ### validate-at-rules
153
153
 
154
- Validates at-rules inside `css.create()`. It accepts `@media`, `@container`, `@supports`, `@layer`, and `@scope`, and supports validation of computed keys when TypeScript is available.
154
+ Validates at-rules inside `css.create()`. It accepts `@media`, `@container`, `@supports`, `@layer`, and `@scope`, each with a prelude, whether or not a space separates it from the keyword, and supports validation of computed keys when TypeScript is available.
155
155
 
156
156
  ## Optional rules
157
157
 
@@ -5,14 +5,21 @@ exports.isValidAtRule = isValidAtRule;
5
5
  const utils_1 = require("@typescript-eslint/utils");
6
6
  const styleObject_1 = require("../util/styleObject");
7
7
  const VALID_AT_RULES = [
8
- '@media ',
9
- '@container ',
10
- '@supports ',
11
- '@layer ',
12
- '@scope ',
8
+ '@media',
9
+ '@container',
10
+ '@supports',
11
+ '@layer',
12
+ '@scope',
13
13
  ];
14
14
  function isValidAtRule(rule) {
15
- return VALID_AT_RULES.some((prefix) => rule.startsWith(prefix) && rule.length > prefix.length);
15
+ return VALID_AT_RULES.some((keyword) => {
16
+ if (!rule.startsWith(keyword))
17
+ return false;
18
+ const prelude = rule.slice(keyword.length);
19
+ if (!prelude.startsWith(' ') && !prelude.startsWith('('))
20
+ return false;
21
+ return prelude.replace(/[()\s]/g, '').length > 0;
22
+ });
16
23
  }
17
24
  exports.validateAtRules = {
18
25
  meta: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/eslint-plugin",
3
- "version": "19.0.0",
3
+ "version": "19.1.1",
4
4
  "description": "Plumeria ESLint plugin",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",