@drskillissue/ganko 0.3.0 → 0.3.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/dist/{chunk-2VRVUMIE.js → chunk-AXFVBCJD.js} +18 -2
- package/dist/chunk-AXFVBCJD.js.map +1 -0
- package/dist/eslint-plugin.cjs +17 -1
- package/dist/eslint-plugin.cjs.map +1 -1
- package/dist/eslint-plugin.js +1 -1
- package/dist/index.cjs +99 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +83 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2VRVUMIE.js.map +0 -1
package/dist/eslint-plugin.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3201,6 +3201,7 @@ var TypeResolver = class {
|
|
|
3201
3201
|
checkPropertyOnType(tsType, propertyName) {
|
|
3202
3202
|
const property = tsType.getProperty(propertyName);
|
|
3203
3203
|
if (property !== void 0) return true;
|
|
3204
|
+
if (this.checker.getIndexTypeOfType(tsType, import_typescript2.default.IndexKind.String) !== void 0) return true;
|
|
3204
3205
|
if (tsType.isUnion()) {
|
|
3205
3206
|
for (const constituent of tsType.types) {
|
|
3206
3207
|
const flags = constituent.flags;
|
|
@@ -9593,7 +9594,22 @@ function isObjectLiteralTarget(graph, pa) {
|
|
|
9593
9594
|
const variable = getVariableByNameInScope(graph, obj.text, pa.scope);
|
|
9594
9595
|
if (!variable) return false;
|
|
9595
9596
|
const init = variable.initializer;
|
|
9596
|
-
|
|
9597
|
+
if (init === null || !import_typescript34.default.isObjectLiteralExpression(init)) return false;
|
|
9598
|
+
if (propertyExistsInLiteral(init, pa)) return false;
|
|
9599
|
+
return true;
|
|
9600
|
+
}
|
|
9601
|
+
function propertyExistsInLiteral(literal, pa) {
|
|
9602
|
+
let propName = null;
|
|
9603
|
+
if (!pa.computed && import_typescript34.default.isIdentifier(pa.property)) propName = pa.property.text;
|
|
9604
|
+
else if (import_typescript34.default.isStringLiteral(pa.property)) propName = pa.property.text;
|
|
9605
|
+
if (propName === null) return false;
|
|
9606
|
+
for (let i = 0; i < literal.properties.length; i++) {
|
|
9607
|
+
const prop = literal.properties[i];
|
|
9608
|
+
if (!prop) continue;
|
|
9609
|
+
if (import_typescript34.default.isPropertyAssignment(prop) && import_typescript34.default.isIdentifier(prop.name) && prop.name.text === propName) return true;
|
|
9610
|
+
if (import_typescript34.default.isShorthandPropertyAssignment(prop) && prop.name.text === propName) return true;
|
|
9611
|
+
}
|
|
9612
|
+
return false;
|
|
9597
9613
|
}
|
|
9598
9614
|
function getMemberAccessesOnIdentifier(fn, identifierName) {
|
|
9599
9615
|
const cache = fn._memberAccessesByIdentifier;
|
|
@@ -27907,24 +27923,26 @@ function buildTailwindValidatorFromEval(utilities, variants, logger) {
|
|
|
27907
27923
|
has(className) {
|
|
27908
27924
|
if (staticValidator.has(className)) return true;
|
|
27909
27925
|
const cached = batchCache.get(className);
|
|
27910
|
-
if (cached !== void 0) return cached;
|
|
27926
|
+
if (cached !== void 0) return cached !== null;
|
|
27911
27927
|
return false;
|
|
27912
27928
|
},
|
|
27913
|
-
resolve() {
|
|
27929
|
+
resolve(className) {
|
|
27930
|
+
const cached = batchCache.get(className);
|
|
27931
|
+
if (cached !== void 0) return cached;
|
|
27914
27932
|
return null;
|
|
27915
27933
|
},
|
|
27916
27934
|
preloadBatch(classNames, results) {
|
|
27917
27935
|
for (let i = 0; i < classNames.length; i++) {
|
|
27918
27936
|
const name = classNames[i];
|
|
27919
|
-
const
|
|
27920
|
-
if (name !== void 0 &&
|
|
27921
|
-
batchCache.set(name,
|
|
27937
|
+
const css = results[i];
|
|
27938
|
+
if (name !== void 0 && css !== void 0) {
|
|
27939
|
+
batchCache.set(name, css);
|
|
27922
27940
|
}
|
|
27923
27941
|
}
|
|
27924
27942
|
if (logger?.isLevelEnabled(Level.Debug)) {
|
|
27925
27943
|
let validCount = 0;
|
|
27926
27944
|
for (let i = 0; i < results.length; i++) {
|
|
27927
|
-
if (results[i]) validCount++;
|
|
27945
|
+
if (results[i] !== null) validCount++;
|
|
27928
27946
|
}
|
|
27929
27947
|
logger.debug(`tailwind: preloaded ${classNames.length} candidates (${validCount} valid)`);
|
|
27930
27948
|
}
|
|
@@ -28120,7 +28138,7 @@ function getActivePolicy() {
|
|
|
28120
28138
|
}
|
|
28121
28139
|
|
|
28122
28140
|
// src/compilation/symbols/class-name.ts
|
|
28123
|
-
function createClassNameSymbol(name, selectors, filePaths) {
|
|
28141
|
+
function createClassNameSymbol(name, selectors, filePaths, tailwindResolvedCSS) {
|
|
28124
28142
|
return {
|
|
28125
28143
|
symbolKind: "className",
|
|
28126
28144
|
name,
|
|
@@ -28129,7 +28147,8 @@ function createClassNameSymbol(name, selectors, filePaths) {
|
|
|
28129
28147
|
kind: "css",
|
|
28130
28148
|
selectors,
|
|
28131
28149
|
filePaths
|
|
28132
|
-
}
|
|
28150
|
+
},
|
|
28151
|
+
tailwindResolvedCSS: tailwindResolvedCSS ?? null
|
|
28133
28152
|
};
|
|
28134
28153
|
}
|
|
28135
28154
|
|
|
@@ -28600,7 +28619,7 @@ function pushToMapArray2(map, key, value2) {
|
|
|
28600
28619
|
if (arr !== void 0) arr.push(value2);
|
|
28601
28620
|
else map.set(key, [value2]);
|
|
28602
28621
|
}
|
|
28603
|
-
function buildSymbolTable(trees, tailwindValidator) {
|
|
28622
|
+
function buildSymbolTable(trees, tailwindValidator, solidClassTokens) {
|
|
28604
28623
|
const classNamesMap = /* @__PURE__ */ new Map();
|
|
28605
28624
|
const selectorsMap = /* @__PURE__ */ new Map();
|
|
28606
28625
|
const customPropertiesMap = /* @__PURE__ */ new Map();
|
|
@@ -28627,6 +28646,7 @@ function buildSymbolTable(trees, tailwindValidator) {
|
|
|
28627
28646
|
const allSelectors = [];
|
|
28628
28647
|
const allDeclarations = [];
|
|
28629
28648
|
const allVariables = [];
|
|
28649
|
+
const referencedCustomPropertyNamesSet = /* @__PURE__ */ new Set();
|
|
28630
28650
|
const allAtRules = [];
|
|
28631
28651
|
const allKeyframeAtRules = [];
|
|
28632
28652
|
const allFontFaceAtRules = [];
|
|
@@ -28737,6 +28757,11 @@ function buildSymbolTable(trees, tailwindValidator) {
|
|
|
28737
28757
|
customPropertiesMap.set(entity.name, createCustomPropertySymbol(entity, filePath));
|
|
28738
28758
|
}
|
|
28739
28759
|
}
|
|
28760
|
+
const treeVariableRefs = tree.variableRefs;
|
|
28761
|
+
for (let i = 0; i < treeVariableRefs.length; i++) {
|
|
28762
|
+
const ref = treeVariableRefs[i];
|
|
28763
|
+
if (ref) referencedCustomPropertyNamesSet.add(ref.name);
|
|
28764
|
+
}
|
|
28740
28765
|
const treeAtRules = tree.atRules;
|
|
28741
28766
|
for (let i = 0; i < treeAtRules.length; i++) {
|
|
28742
28767
|
const entity = treeAtRules[i];
|
|
@@ -28790,11 +28815,32 @@ function buildSymbolTable(trees, tailwindValidator) {
|
|
|
28790
28815
|
if (!placeholdersByNameMap.has(ph.name)) placeholdersByNameMap.set(ph.name, ph);
|
|
28791
28816
|
}
|
|
28792
28817
|
}
|
|
28818
|
+
const twValidator = tailwindValidator ?? null;
|
|
28793
28819
|
const classNameSymbols = /* @__PURE__ */ new Map();
|
|
28794
28820
|
for (const [name, entry] of classNamesMap) {
|
|
28795
|
-
|
|
28821
|
+
const twCSS = twValidator !== null && twValidator.has(name) ? twValidator.resolve(name) : null;
|
|
28822
|
+
classNameSymbols.set(name, createClassNameSymbol(name, entry.selectors, [...entry.filePaths], twCSS));
|
|
28823
|
+
}
|
|
28824
|
+
if (twValidator !== null && solidClassTokens !== null && solidClassTokens !== void 0) {
|
|
28825
|
+
for (const name of solidClassTokens) {
|
|
28826
|
+
if (classNameSymbols.has(name)) continue;
|
|
28827
|
+
if (!twValidator.has(name)) continue;
|
|
28828
|
+
const resolvedCSS = twValidator.resolve(name);
|
|
28829
|
+
classNameSymbols.set(name, {
|
|
28830
|
+
symbolKind: "className",
|
|
28831
|
+
name,
|
|
28832
|
+
filePath: null,
|
|
28833
|
+
source: {
|
|
28834
|
+
kind: "tailwind",
|
|
28835
|
+
candidate: { raw: name, variants: [], utility: name, value: null, modifier: null, important: false, negative: false },
|
|
28836
|
+
resolvedCSS,
|
|
28837
|
+
declarations: [],
|
|
28838
|
+
diagnostics: []
|
|
28839
|
+
},
|
|
28840
|
+
tailwindResolvedCSS: resolvedCSS
|
|
28841
|
+
});
|
|
28842
|
+
}
|
|
28796
28843
|
}
|
|
28797
|
-
const twValidator = tailwindValidator ?? null;
|
|
28798
28844
|
const knownKeyframeNames = /* @__PURE__ */ new Set();
|
|
28799
28845
|
for (let i = 0; i < allKeyframeAtRules.length; i++) {
|
|
28800
28846
|
const kf = allKeyframeAtRules[i];
|
|
@@ -29151,8 +29197,9 @@ function buildSymbolTable(trees, tailwindValidator) {
|
|
|
29151
29197
|
unusedFunctions: unusedFunctionsArr,
|
|
29152
29198
|
unusedPlaceholders: unusedPlaceholdersArr,
|
|
29153
29199
|
tokenCategories: [...tokensByCategoryMap.keys()],
|
|
29200
|
+
referencedCustomPropertyNames: referencedCustomPropertyNamesSet,
|
|
29154
29201
|
hasClassName(name) {
|
|
29155
|
-
return classNameSymbols.has(name)
|
|
29202
|
+
return classNameSymbols.has(name);
|
|
29156
29203
|
},
|
|
29157
29204
|
getClassName(name) {
|
|
29158
29205
|
return classNameSymbols.get(name) ?? null;
|
|
@@ -32250,8 +32297,6 @@ function matchesRequiredAttributes(required, actual) {
|
|
|
32250
32297
|
if (constraint === void 0) continue;
|
|
32251
32298
|
if (!actual.has(constraint.name)) return 1 /* NoMatch */;
|
|
32252
32299
|
if (constraint.operator === "exists") {
|
|
32253
|
-
const existsValue = actual.get(constraint.name);
|
|
32254
|
-
if (existsValue === null) hasConditional = true;
|
|
32255
32300
|
continue;
|
|
32256
32301
|
}
|
|
32257
32302
|
const actualValue = actual.get(constraint.name);
|
|
@@ -32461,10 +32506,9 @@ function augmentCascadeWithTailwindFromSymbolTable(cascade, element, symbolTable
|
|
|
32461
32506
|
for (let i = 0; i < classTokens.length; i++) {
|
|
32462
32507
|
const token = classTokens[i];
|
|
32463
32508
|
if (token === void 0) continue;
|
|
32464
|
-
const classSymbol = symbolTable.
|
|
32465
|
-
if (
|
|
32466
|
-
|
|
32467
|
-
const resolvedCSS = classSymbol.source.resolvedCSS;
|
|
32509
|
+
const classSymbol = symbolTable.getClassName(token);
|
|
32510
|
+
if (classSymbol === null) continue;
|
|
32511
|
+
const resolvedCSS = classSymbol.tailwindResolvedCSS;
|
|
32468
32512
|
if (resolvedCSS === null) continue;
|
|
32469
32513
|
const declarations = parseTailwindCssDeclarations(resolvedCSS);
|
|
32470
32514
|
for (let j = 0; j < declarations.length; j++) {
|
|
@@ -34152,13 +34196,13 @@ function buildConsistencyEvidence(input) {
|
|
|
34152
34196
|
const lineHeight = normalizeDeviation(input.subjectLineHeightDeviation, input.cohortProfile.lineHeightDispersionPx, input.cohortProfile.medianLineHeightPx);
|
|
34153
34197
|
const baselinesIrrelevant = input.context.baselineRelevance === "irrelevant";
|
|
34154
34198
|
const blockAxisIsMainAxis = !input.context.crossAxisIsBlockAxis;
|
|
34155
|
-
const suppressAll = blockAxisIsMainAxis;
|
|
34199
|
+
const suppressAll = blockAxisIsMainAxis || baselinesIrrelevant;
|
|
34156
34200
|
const offset = suppressAll ? ZERO_STRENGTH : offsetRaw;
|
|
34157
34201
|
const declaredOffset = suppressAll ? ZERO_STRENGTH : declaredOffsetRaw;
|
|
34158
|
-
const baselineStrength =
|
|
34159
|
-
const contextStrength =
|
|
34160
|
-
const replacedStrength =
|
|
34161
|
-
const compositionResult =
|
|
34202
|
+
const baselineStrength = suppressAll ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
|
|
34203
|
+
const contextStrength = suppressAll ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
|
|
34204
|
+
const replacedStrength = suppressAll ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
|
|
34205
|
+
const compositionResult = suppressAll ? null : resolveContentCompositionStrength(input);
|
|
34162
34206
|
const compositionStrength = compositionResult ? compositionResult.evidence : ZERO_STRENGTH;
|
|
34163
34207
|
const contextCertaintyPenalty = resolveContextCertaintyPenalty(input);
|
|
34164
34208
|
const provenance = input.cohortProvenance;
|
|
@@ -35221,7 +35265,26 @@ function makeCompilation(solidTrees, cssTrees, tailwindConfig, packageManifest,
|
|
|
35221
35265
|
if (cachedSymbolTable === null) {
|
|
35222
35266
|
const allCssTrees = [];
|
|
35223
35267
|
for (const tree of cssTrees.values()) allCssTrees.push(tree);
|
|
35224
|
-
|
|
35268
|
+
let solidClassTokens = null;
|
|
35269
|
+
if (tailwindConfig?.validator !== null && tailwindConfig?.validator !== void 0) {
|
|
35270
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
35271
|
+
for (const st of solidTrees.values()) {
|
|
35272
|
+
for (const [, idx] of st.staticClassTokensByElementId) {
|
|
35273
|
+
for (let i = 0; i < idx.tokens.length; i++) {
|
|
35274
|
+
const t = idx.tokens[i];
|
|
35275
|
+
if (t) tokens.add(t);
|
|
35276
|
+
}
|
|
35277
|
+
}
|
|
35278
|
+
for (const [, idx] of st.staticClassListKeysByElementId) {
|
|
35279
|
+
for (let i = 0; i < idx.keys.length; i++) {
|
|
35280
|
+
const t = idx.keys[i];
|
|
35281
|
+
if (t) tokens.add(t);
|
|
35282
|
+
}
|
|
35283
|
+
}
|
|
35284
|
+
}
|
|
35285
|
+
solidClassTokens = tokens;
|
|
35286
|
+
}
|
|
35287
|
+
cachedSymbolTable = buildSymbolTable(allCssTrees, tailwindConfig?.validator ?? null, solidClassTokens);
|
|
35225
35288
|
}
|
|
35226
35289
|
return cachedSymbolTable;
|
|
35227
35290
|
},
|
|
@@ -36840,10 +36903,7 @@ var jsxStyleNoUnusedCustomProp = defineAnalysisRule({
|
|
|
36840
36903
|
requirement: { tier: 1 /* CrossSyntax */ },
|
|
36841
36904
|
register(registry) {
|
|
36842
36905
|
registry.registerCrossSyntaxAction((solidTree, symbolTable, emit) => {
|
|
36843
|
-
const usedVarNames =
|
|
36844
|
-
for (const [name] of symbolTable.customProperties) {
|
|
36845
|
-
usedVarNames.add(name);
|
|
36846
|
-
}
|
|
36906
|
+
const usedVarNames = symbolTable.referencedCustomPropertyNames;
|
|
36847
36907
|
if (solidTree.jsxClassListAttributes.length > 0) return;
|
|
36848
36908
|
let hasNonStaticClass = false;
|
|
36849
36909
|
for (const [, idx] of solidTree.staticClassTokensByElementId) {
|
|
@@ -37803,7 +37863,7 @@ function normalizeStylePropertyKey(key) {
|
|
|
37803
37863
|
if (key.includes("-")) return key.toLowerCase();
|
|
37804
37864
|
return toKebabCase(key);
|
|
37805
37865
|
}
|
|
37806
|
-
function isExemptFromCLS(element, flowFact, property,
|
|
37866
|
+
function isExemptFromCLS(element, flowFact, property, semanticModel) {
|
|
37807
37867
|
if (!flowFact.inFlow) return true;
|
|
37808
37868
|
if (POSITIONED_OFFSET_PROPERTIES.has(property) && flowFact.position !== null && flowFact.position !== "static") {
|
|
37809
37869
|
return true;
|
|
@@ -37811,8 +37871,17 @@ function isExemptFromCLS(element, flowFact, property, _semanticModel) {
|
|
|
37811
37871
|
if (hasLayoutContainment(element) || element.parentElementNode !== null && hasLayoutContainment(element.parentElementNode)) {
|
|
37812
37872
|
return true;
|
|
37813
37873
|
}
|
|
37874
|
+
if (element.parentElementNode !== null && parentClipsOverflow(element.parentElementNode, semanticModel)) {
|
|
37875
|
+
return true;
|
|
37876
|
+
}
|
|
37814
37877
|
return false;
|
|
37815
37878
|
}
|
|
37879
|
+
var CLIPPING_OVERFLOW_VALUES = /* @__PURE__ */ new Set(["hidden", "clip"]);
|
|
37880
|
+
function parentClipsOverflow(parent, semanticModel) {
|
|
37881
|
+
const snapshot = semanticModel.getSignalSnapshot(parent.elementId);
|
|
37882
|
+
const signal = snapshot.signals.get("overflow");
|
|
37883
|
+
return signal !== void 0 && signal.kind === 0 /* Known */ && CLIPPING_OVERFLOW_VALUES.has(signal.normalized);
|
|
37884
|
+
}
|
|
37816
37885
|
function hasLayoutContainment(node) {
|
|
37817
37886
|
const contain = node.inlineStyleValues.get("contain");
|
|
37818
37887
|
if (contain === void 0) return false;
|