@bamboocss/eslint-plugin 1.30.1 → 1.32.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/dist/index.cjs +9 -16
- package/dist/index.mjs +9 -16
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ require("@typescript-eslint/utils/ts-eslint");
|
|
|
8
8
|
let _bamboocss_shared = require("@bamboocss/shared");
|
|
9
9
|
//#region package.json
|
|
10
10
|
var name = "@bamboocss/eslint-plugin";
|
|
11
|
-
var version = "1.
|
|
11
|
+
var version = "1.32.0";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/utils/index.ts
|
|
14
14
|
const createRule = _typescript_eslint_utils.ESLintUtils.RuleCreator((name) => `https://github.com/gajus/bamboocss/blob/main/packages/eslint-plugin/docs/rules/${name}.md`);
|
|
@@ -237,16 +237,11 @@ const isColorToken = (value, context) => {
|
|
|
237
237
|
return syncAction("isColorToken", getSyncOptions(context), value);
|
|
238
238
|
};
|
|
239
239
|
const extractTokens = (value) => {
|
|
240
|
-
const regex = /token\(([^"'(),]+)
|
|
240
|
+
const regex = /token\(([^"'(),]+)\)/g;
|
|
241
241
|
const matches = [];
|
|
242
242
|
let match;
|
|
243
|
-
while ((match = regex.exec(value)) !== null)
|
|
244
|
-
|
|
245
|
-
const tokensFromSecondSyntax = match[4] && match[4].match(/(\w+\.\w+(\.\w+)?)/g);
|
|
246
|
-
if (tokenFromFirstSyntax) matches.push(tokenFromFirstSyntax);
|
|
247
|
-
if (tokensFromSecondSyntax) matches.push(...tokensFromSecondSyntax);
|
|
248
|
-
}
|
|
249
|
-
return matches.filter(Boolean);
|
|
243
|
+
while ((match = regex.exec(value)) !== null) if (match[1]) matches.push(match[1]);
|
|
244
|
+
return matches;
|
|
250
245
|
};
|
|
251
246
|
const invalidTokensCache = /* @__PURE__ */ new Map();
|
|
252
247
|
const getInvalidTokens = (value, context) => {
|
|
@@ -338,15 +333,13 @@ const CONFIG_FUNCTIONS = new Set([
|
|
|
338
333
|
"defineConfig",
|
|
339
334
|
"defineGlobalStyles",
|
|
340
335
|
"defineKeyframes",
|
|
341
|
-
"
|
|
342
|
-
"defineParts",
|
|
336
|
+
"defineMixins",
|
|
343
337
|
"definePattern",
|
|
344
338
|
"definePreset",
|
|
345
339
|
"defineRecipe",
|
|
346
340
|
"defineSemanticTokens",
|
|
347
341
|
"defineSlotRecipe",
|
|
348
342
|
"defineStyles",
|
|
349
|
-
"defineTextStyles",
|
|
350
343
|
"defineTokens",
|
|
351
344
|
"defineUtility"
|
|
352
345
|
]);
|
|
@@ -1512,7 +1505,7 @@ const rule$7 = createRule({
|
|
|
1512
1505
|
*
|
|
1513
1506
|
* A bare `token(…)` counts even with no import to bind it, because the build counts it: its
|
|
1514
1507
|
* accounting keys on the name, so a local helper of that name declines there too. Staying
|
|
1515
|
-
* quiet about it would mean `
|
|
1508
|
+
* quiet about it would mean `prune.tokens: 'accounted'` failing a build the editor called clean.
|
|
1516
1509
|
*/
|
|
1517
1510
|
const isTokenCall = (node) => {
|
|
1518
1511
|
const callee = node.type === "CallExpression" ? node.callee : node.tag;
|
|
@@ -1561,11 +1554,11 @@ const rule$7 = createRule({
|
|
|
1561
1554
|
},
|
|
1562
1555
|
defaultOptions: [],
|
|
1563
1556
|
meta: {
|
|
1564
|
-
docs: { description: "Require a token path the build can resolve, so `
|
|
1557
|
+
docs: { description: "Require a token path the build can resolve, so `prune.tokens` can drop the declarations nothing asks for." },
|
|
1565
1558
|
messages: {
|
|
1566
1559
|
/**
|
|
1567
1560
|
* The build keeps every token declaration for this, because the path could name any of
|
|
1568
|
-
* them. Under `
|
|
1561
|
+
* them. Under `prune: { unresolved: 'error' }` it is an error rather than a size cost.
|
|
1569
1562
|
*/
|
|
1570
1563
|
opaqueTokenPath: "Token path cannot be resolved at build time, so every token declaration is kept. Spell the path at the call, or give a template a static prefix.",
|
|
1571
1564
|
/**
|
|
@@ -1664,7 +1657,7 @@ const rule$5 = createRule({
|
|
|
1664
1657
|
const tokenWrap = (value) => value ? `token(${value})` : "";
|
|
1665
1658
|
const isCompositeValue = (input) => {
|
|
1666
1659
|
if (!input) return false;
|
|
1667
|
-
return !/^
|
|
1660
|
+
return !/^token\([^)]*\)$/.test(input);
|
|
1668
1661
|
};
|
|
1669
1662
|
const sendReport = (node, value) => {
|
|
1670
1663
|
const tkImports = extractTokens(value);
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import "@typescript-eslint/utils/ts-eslint";
|
|
|
8
8
|
import { getArbitraryValue, parseFallbackValue } from "@bamboocss/shared";
|
|
9
9
|
//#region package.json
|
|
10
10
|
var name = "@bamboocss/eslint-plugin";
|
|
11
|
-
var version = "1.
|
|
11
|
+
var version = "1.32.0";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/utils/index.ts
|
|
14
14
|
const createRule = ESLintUtils.RuleCreator((name) => `https://github.com/gajus/bamboocss/blob/main/packages/eslint-plugin/docs/rules/${name}.md`);
|
|
@@ -237,16 +237,11 @@ const isColorToken = (value, context) => {
|
|
|
237
237
|
return syncAction("isColorToken", getSyncOptions(context), value);
|
|
238
238
|
};
|
|
239
239
|
const extractTokens = (value) => {
|
|
240
|
-
const regex = /token\(([^"'(),]+)
|
|
240
|
+
const regex = /token\(([^"'(),]+)\)/g;
|
|
241
241
|
const matches = [];
|
|
242
242
|
let match;
|
|
243
|
-
while ((match = regex.exec(value)) !== null)
|
|
244
|
-
|
|
245
|
-
const tokensFromSecondSyntax = match[4] && match[4].match(/(\w+\.\w+(\.\w+)?)/g);
|
|
246
|
-
if (tokenFromFirstSyntax) matches.push(tokenFromFirstSyntax);
|
|
247
|
-
if (tokensFromSecondSyntax) matches.push(...tokensFromSecondSyntax);
|
|
248
|
-
}
|
|
249
|
-
return matches.filter(Boolean);
|
|
243
|
+
while ((match = regex.exec(value)) !== null) if (match[1]) matches.push(match[1]);
|
|
244
|
+
return matches;
|
|
250
245
|
};
|
|
251
246
|
const invalidTokensCache = /* @__PURE__ */ new Map();
|
|
252
247
|
const getInvalidTokens = (value, context) => {
|
|
@@ -338,15 +333,13 @@ const CONFIG_FUNCTIONS = new Set([
|
|
|
338
333
|
"defineConfig",
|
|
339
334
|
"defineGlobalStyles",
|
|
340
335
|
"defineKeyframes",
|
|
341
|
-
"
|
|
342
|
-
"defineParts",
|
|
336
|
+
"defineMixins",
|
|
343
337
|
"definePattern",
|
|
344
338
|
"definePreset",
|
|
345
339
|
"defineRecipe",
|
|
346
340
|
"defineSemanticTokens",
|
|
347
341
|
"defineSlotRecipe",
|
|
348
342
|
"defineStyles",
|
|
349
|
-
"defineTextStyles",
|
|
350
343
|
"defineTokens",
|
|
351
344
|
"defineUtility"
|
|
352
345
|
]);
|
|
@@ -1512,7 +1505,7 @@ const rule$7 = createRule({
|
|
|
1512
1505
|
*
|
|
1513
1506
|
* A bare `token(…)` counts even with no import to bind it, because the build counts it: its
|
|
1514
1507
|
* accounting keys on the name, so a local helper of that name declines there too. Staying
|
|
1515
|
-
* quiet about it would mean `
|
|
1508
|
+
* quiet about it would mean `prune.tokens: 'accounted'` failing a build the editor called clean.
|
|
1516
1509
|
*/
|
|
1517
1510
|
const isTokenCall = (node) => {
|
|
1518
1511
|
const callee = node.type === "CallExpression" ? node.callee : node.tag;
|
|
@@ -1561,11 +1554,11 @@ const rule$7 = createRule({
|
|
|
1561
1554
|
},
|
|
1562
1555
|
defaultOptions: [],
|
|
1563
1556
|
meta: {
|
|
1564
|
-
docs: { description: "Require a token path the build can resolve, so `
|
|
1557
|
+
docs: { description: "Require a token path the build can resolve, so `prune.tokens` can drop the declarations nothing asks for." },
|
|
1565
1558
|
messages: {
|
|
1566
1559
|
/**
|
|
1567
1560
|
* The build keeps every token declaration for this, because the path could name any of
|
|
1568
|
-
* them. Under `
|
|
1561
|
+
* them. Under `prune: { unresolved: 'error' }` it is an error rather than a size cost.
|
|
1569
1562
|
*/
|
|
1570
1563
|
opaqueTokenPath: "Token path cannot be resolved at build time, so every token declaration is kept. Spell the path at the call, or give a template a static prefix.",
|
|
1571
1564
|
/**
|
|
@@ -1664,7 +1657,7 @@ const rule$5 = createRule({
|
|
|
1664
1657
|
const tokenWrap = (value) => value ? `token(${value})` : "";
|
|
1665
1658
|
const isCompositeValue = (input) => {
|
|
1666
1659
|
if (!input) return false;
|
|
1667
|
-
return !/^
|
|
1660
|
+
return !/^token\([^)]*\)$/.test(input);
|
|
1668
1661
|
};
|
|
1669
1662
|
const sendReport = (node, value) => {
|
|
1670
1663
|
const tkImports = extractTokens(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/eslint-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "ESLint plugin for Bamboo CSS",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"@typescript-eslint/utils": "^8.21.0",
|
|
37
37
|
"micromatch": "^4.0.8",
|
|
38
38
|
"synckit": "^0.9.0",
|
|
39
|
-
"@bamboocss/config": "1.
|
|
40
|
-
"@bamboocss/generator": "1.
|
|
41
|
-
"@bamboocss/shared": "1.
|
|
39
|
+
"@bamboocss/config": "1.32.0",
|
|
40
|
+
"@bamboocss/generator": "1.32.0",
|
|
41
|
+
"@bamboocss/shared": "1.32.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/micromatch": "^4.0.10",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"eslint": "^9.35.0",
|
|
47
47
|
"multiline-ts": "^4.0.1",
|
|
48
48
|
"typescript": "^5.7.2",
|
|
49
|
-
"@bamboocss/
|
|
50
|
-
"@bamboocss/
|
|
51
|
-
"@bamboocss/
|
|
52
|
-
"@bamboocss/
|
|
49
|
+
"@bamboocss/preset-bamboo": "1.32.0",
|
|
50
|
+
"@bamboocss/dev": "1.32.0",
|
|
51
|
+
"@bamboocss/types": "1.32.0",
|
|
52
|
+
"@bamboocss/preset-base": "1.32.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"eslint": "*"
|