@plumeria/eslint-plugin 18.3.17 → 18.4.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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.expandBorderShorthands = void 0;
4
4
  const borderShorthand_1 = require("../util/borderShorthand");
5
- const logicalPhysical_1 = require("../util/logicalPhysical");
5
+ const zss_engine_1 = require("zss-engine");
6
6
  const styleObject_1 = require("../util/styleObject");
7
7
  const BUNDLES = new Set(borderShorthand_1.BORDER_BUNDLES);
8
8
  exports.expandBorderShorthands = {
@@ -96,7 +96,7 @@ exports.expandBorderShorthands = {
96
96
  typeof prop.key.value === 'string') {
97
97
  name = prop.key.value;
98
98
  }
99
- const kebab = (0, logicalPhysical_1.toKebabCase)(name);
99
+ const kebab = (0, zss_engine_1.camelToKebabCase)(name);
100
100
  if (!BUNDLES.has(kebab))
101
101
  return;
102
102
  let literal = null;
@@ -142,7 +142,7 @@ exports.expandBorderShorthands = {
142
142
  };
143
143
  const indent = ' '.repeat(prop.loc.start.column);
144
144
  const declarations = ['width', 'style', 'color']
145
- .map((part) => `${(0, logicalPhysical_1.toCamelCase)(`${kebab}-${part}`)}: ${render(parts[part])}`)
145
+ .map((part) => `${(0, zss_engine_1.kebabToCamelCase)(`${kebab}-${part}`)}: ${render(parts[part])}`)
146
146
  .join(`,\n${indent}`);
147
147
  context.report({
148
148
  node: prop.key,
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.noOrderDependentOverlap = void 0;
4
4
  const zss_engine_1 = require("zss-engine");
5
- const logicalPhysical_1 = require("../util/logicalPhysical");
6
5
  const selector_1 = require("../util/selector");
7
6
  const styleObject_1 = require("../util/styleObject");
8
7
  const DIRECT_SHORTHANDS = {};
@@ -34,12 +33,12 @@ const coverageOf = (property) => {
34
33
  const longhands = zss_engine_1.DIRECT_LONGHANDS[property];
35
34
  const coverage = longhands
36
35
  ? new Set(longhands.flatMap((longhand) => [...coverageOf(longhand)]))
37
- : new Set([(0, logicalPhysical_1.canonicalProperty)(property)]);
36
+ : new Set([(0, zss_engine_1.canonicalProperty)(property)]);
38
37
  coverages.set(property, coverage);
39
38
  return coverage;
40
39
  };
41
40
  const overlapOf = (first, second) => {
42
- if ((0, logicalPhysical_1.canonicalProperty)(first) === (0, logicalPhysical_1.canonicalProperty)(second))
41
+ if ((0, zss_engine_1.canonicalProperty)(first) === (0, zss_engine_1.canonicalProperty)(second))
43
42
  return 'alias';
44
43
  const left = coverageOf(first);
45
44
  const right = coverageOf(second);
@@ -157,9 +156,10 @@ exports.noOrderDependentOverlap = {
157
156
  if (first.startsWith('--') || second.startsWith('--')) {
158
157
  return first === second;
159
158
  }
160
- return ((0, logicalPhysical_1.canonicalProperty)((0, logicalPhysical_1.toKebabCase)(first)) ===
161
- (0, logicalPhysical_1.canonicalProperty)((0, logicalPhysical_1.toKebabCase)(second)) ||
162
- overlapOf((0, logicalPhysical_1.toKebabCase)(first), (0, logicalPhysical_1.toKebabCase)(second)) === 'crossing');
159
+ return ((0, zss_engine_1.canonicalProperty)((0, zss_engine_1.camelToKebabCase)(first)) ===
160
+ (0, zss_engine_1.canonicalProperty)((0, zss_engine_1.camelToKebabCase)(second)) ||
161
+ overlapOf((0, zss_engine_1.camelToKebabCase)(first), (0, zss_engine_1.camelToKebabCase)(second)) ===
162
+ 'crossing');
163
163
  }
164
164
  function swapProperties(fixer, first, second) {
165
165
  return [
@@ -212,7 +212,7 @@ exports.noOrderDependentOverlap = {
212
212
  name.startsWith('--')) {
213
213
  return;
214
214
  }
215
- declarations.push({ prop, name, kebab: (0, logicalPhysical_1.toKebabCase)(name) });
215
+ declarations.push({ prop, name, kebab: (0, zss_engine_1.camelToKebabCase)(name) });
216
216
  });
217
217
  for (let i = 0; i < conditions.length; i++) {
218
218
  for (let j = i + 1; j < conditions.length; j++) {
@@ -2,17 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.noUnknownCssProperties = void 0;
4
4
  const known_css_properties_1 = require("known-css-properties");
5
+ const zss_engine_1 = require("zss-engine");
5
6
  const styleObject_1 = require("../util/styleObject");
6
7
  const knownProperties = new Set(known_css_properties_1.all);
7
- const kebabCache = new Map();
8
- function toKebabCase(str) {
9
- if (kebabCache.has(str)) {
10
- return kebabCache.get(str);
11
- }
12
- const result = str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
13
- kebabCache.set(str, result);
14
- return result;
15
- }
16
8
  exports.noUnknownCssProperties = {
17
9
  meta: {
18
10
  type: 'problem',
@@ -107,7 +99,7 @@ exports.noUnknownCssProperties = {
107
99
  !keyName.startsWith('[') &&
108
100
  !keyName.startsWith('@') &&
109
101
  !keyName.startsWith('--')) {
110
- const kebabName = toKebabCase(keyName);
102
+ const kebabName = (0, zss_engine_1.camelToKebabCase)(keyName);
111
103
  if (!knownProperties.has(kebabName)) {
112
104
  context.report({
113
105
  node: prop.key,
@@ -1,3 +1,3 @@
1
- import type { PropertySpelling } from './logicalPhysical';
1
+ import type { PropertySpelling } from 'zss-engine';
2
2
  import type { Rule } from 'eslint';
3
3
  export declare const createSpellingRule: (reject: PropertySpelling) => Rule.RuleModule;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createSpellingRule = void 0;
4
- const logicalPhysical_1 = require("./logicalPhysical");
4
+ const zss_engine_1 = require("zss-engine");
5
5
  const styleObject_1 = require("./styleObject");
6
6
  const DESCRIPTIONS = {
7
7
  physical: 'Disallow the physical name of a property that also has a logical name',
@@ -110,10 +110,10 @@ const createSpellingRule = (reject) => ({
110
110
  }
111
111
  if (!name)
112
112
  return;
113
- const kebab = (0, logicalPhysical_1.toKebabCase)(name);
114
- if ((0, logicalPhysical_1.spellingOf)(kebab, includeAxes) !== reject)
113
+ const kebab = (0, zss_engine_1.camelToKebabCase)(name);
114
+ if ((0, zss_engine_1.spellingOf)(kebab, includeAxes) !== reject)
115
115
  return;
116
- report(prop, name, (0, logicalPhysical_1.toCamelCase)((0, logicalPhysical_1.counterpartOf)(kebab)));
116
+ report(prop, name, (0, zss_engine_1.kebabToCamelCase)((0, zss_engine_1.counterpartOf)(kebab)));
117
117
  });
118
118
  }
119
119
  function report(prop, name, counterpart) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/eslint-plugin",
3
- "version": "18.3.17",
3
+ "version": "18.4.0",
4
4
  "description": "Plumeria ESLint plugin",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@typescript-eslint/utils": "^8.60.0",
56
56
  "known-css-properties": "^0.37.0",
57
- "zss-engine": "2.7.0"
57
+ "zss-engine": "2.8.0"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "rimraf dist && pnpm cjs",
@@ -1,9 +0,0 @@
1
- export declare const LOGICAL_PHYSICAL_EDGES: [string, string][];
2
- export declare const LOGICAL_PHYSICAL_AXES: [string, string][];
3
- export declare const LOGICAL_PHYSICAL_PAIRS: [string, string][];
4
- export type PropertySpelling = 'logical' | 'physical';
5
- export declare const canonicalProperty: (property: string) => string;
6
- export declare const counterpartOf: (property: string) => string | undefined;
7
- export declare const spellingOf: (property: string, includeAxes: boolean) => PropertySpelling | undefined;
8
- export declare const toKebabCase: (name: string) => string;
9
- export declare const toCamelCase: (name: string) => string;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCamelCase = exports.toKebabCase = exports.spellingOf = exports.counterpartOf = exports.canonicalProperty = exports.LOGICAL_PHYSICAL_PAIRS = exports.LOGICAL_PHYSICAL_AXES = exports.LOGICAL_PHYSICAL_EDGES = void 0;
4
- exports.LOGICAL_PHYSICAL_EDGES = [
5
- ['margin-block-start', 'margin-top'],
6
- ['margin-block-end', 'margin-bottom'],
7
- ['margin-inline-start', 'margin-left'],
8
- ['margin-inline-end', 'margin-right'],
9
- ['padding-block-start', 'padding-top'],
10
- ['padding-block-end', 'padding-bottom'],
11
- ['padding-inline-start', 'padding-left'],
12
- ['padding-inline-end', 'padding-right'],
13
- ['scroll-margin-block-start', 'scroll-margin-top'],
14
- ['scroll-margin-block-end', 'scroll-margin-bottom'],
15
- ['scroll-margin-inline-start', 'scroll-margin-left'],
16
- ['scroll-margin-inline-end', 'scroll-margin-right'],
17
- ['scroll-padding-block-start', 'scroll-padding-top'],
18
- ['scroll-padding-block-end', 'scroll-padding-bottom'],
19
- ['scroll-padding-inline-start', 'scroll-padding-left'],
20
- ['scroll-padding-inline-end', 'scroll-padding-right'],
21
- ['inset-block-start', 'top'],
22
- ['inset-block-end', 'bottom'],
23
- ['inset-inline-start', 'left'],
24
- ['inset-inline-end', 'right'],
25
- ['border-block-start', 'border-top'],
26
- ['border-block-end', 'border-bottom'],
27
- ['border-inline-start', 'border-left'],
28
- ['border-inline-end', 'border-right'],
29
- ['border-block-start-width', 'border-top-width'],
30
- ['border-block-start-style', 'border-top-style'],
31
- ['border-block-start-color', 'border-top-color'],
32
- ['border-block-end-width', 'border-bottom-width'],
33
- ['border-block-end-style', 'border-bottom-style'],
34
- ['border-block-end-color', 'border-bottom-color'],
35
- ['border-inline-start-width', 'border-left-width'],
36
- ['border-inline-start-style', 'border-left-style'],
37
- ['border-inline-start-color', 'border-left-color'],
38
- ['border-inline-end-width', 'border-right-width'],
39
- ['border-inline-end-style', 'border-right-style'],
40
- ['border-inline-end-color', 'border-right-color'],
41
- ['border-start-start-radius', 'border-top-left-radius'],
42
- ['border-start-end-radius', 'border-top-right-radius'],
43
- ['border-end-start-radius', 'border-bottom-left-radius'],
44
- ['border-end-end-radius', 'border-bottom-right-radius'],
45
- ['corner-start-start-shape', 'corner-top-left-shape'],
46
- ['corner-start-end-shape', 'corner-top-right-shape'],
47
- ['corner-end-start-shape', 'corner-bottom-left-shape'],
48
- ['corner-end-end-shape', 'corner-bottom-right-shape'],
49
- ];
50
- exports.LOGICAL_PHYSICAL_AXES = [
51
- ['block-size', 'height'],
52
- ['inline-size', 'width'],
53
- ['min-block-size', 'min-height'],
54
- ['min-inline-size', 'min-width'],
55
- ['max-block-size', 'max-height'],
56
- ['max-inline-size', 'max-width'],
57
- ['overflow-block', 'overflow-y'],
58
- ['overflow-inline', 'overflow-x'],
59
- ['overscroll-behavior-block', 'overscroll-behavior-y'],
60
- ['overscroll-behavior-inline', 'overscroll-behavior-x'],
61
- ['contain-intrinsic-block-size', 'contain-intrinsic-height'],
62
- ['contain-intrinsic-inline-size', 'contain-intrinsic-width'],
63
- ];
64
- exports.LOGICAL_PHYSICAL_PAIRS = [
65
- ...exports.LOGICAL_PHYSICAL_EDGES,
66
- ...exports.LOGICAL_PHYSICAL_AXES,
67
- ];
68
- const PHYSICAL_OF_LOGICAL = new Map(exports.LOGICAL_PHYSICAL_PAIRS);
69
- const LOGICAL_OF_PHYSICAL = new Map(exports.LOGICAL_PHYSICAL_PAIRS.map(([logical, physical]) => [physical, logical]));
70
- const canonicalProperty = (property) => PHYSICAL_OF_LOGICAL.get(property) ?? property;
71
- exports.canonicalProperty = canonicalProperty;
72
- const counterpartOf = (property) => PHYSICAL_OF_LOGICAL.get(property) ?? LOGICAL_OF_PHYSICAL.get(property);
73
- exports.counterpartOf = counterpartOf;
74
- const spellingOf = (property, includeAxes) => {
75
- const table = includeAxes ? exports.LOGICAL_PHYSICAL_PAIRS : exports.LOGICAL_PHYSICAL_EDGES;
76
- for (const [logical, physical] of table) {
77
- if (property === logical)
78
- return 'logical';
79
- if (property === physical)
80
- return 'physical';
81
- }
82
- return undefined;
83
- };
84
- exports.spellingOf = spellingOf;
85
- const kebabCache = new Map();
86
- const toKebabCase = (name) => {
87
- const cached = kebabCache.get(name);
88
- if (cached !== undefined)
89
- return cached;
90
- const kebab = name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
91
- kebabCache.set(name, kebab);
92
- return kebab;
93
- };
94
- exports.toKebabCase = toKebabCase;
95
- const toCamelCase = (name) => name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
96
- exports.toCamelCase = toCamelCase;