@bamboocss/eslint-plugin 1.30.1 → 1.31.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 +8 -13
- package/dist/index.mjs +8 -13
- 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.31.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) => {
|
|
@@ -1512,7 +1507,7 @@ const rule$7 = createRule({
|
|
|
1512
1507
|
*
|
|
1513
1508
|
* A bare `token(…)` counts even with no import to bind it, because the build counts it: its
|
|
1514
1509
|
* accounting keys on the name, so a local helper of that name declines there too. Staying
|
|
1515
|
-
* quiet about it would mean `
|
|
1510
|
+
* quiet about it would mean `prune.tokens: 'accounted'` failing a build the editor called clean.
|
|
1516
1511
|
*/
|
|
1517
1512
|
const isTokenCall = (node) => {
|
|
1518
1513
|
const callee = node.type === "CallExpression" ? node.callee : node.tag;
|
|
@@ -1561,11 +1556,11 @@ const rule$7 = createRule({
|
|
|
1561
1556
|
},
|
|
1562
1557
|
defaultOptions: [],
|
|
1563
1558
|
meta: {
|
|
1564
|
-
docs: { description: "Require a token path the build can resolve, so `
|
|
1559
|
+
docs: { description: "Require a token path the build can resolve, so `prune.tokens` can drop the declarations nothing asks for." },
|
|
1565
1560
|
messages: {
|
|
1566
1561
|
/**
|
|
1567
1562
|
* The build keeps every token declaration for this, because the path could name any of
|
|
1568
|
-
* them. Under `
|
|
1563
|
+
* them. Under `prune: { unresolved: 'error' }` it is an error rather than a size cost.
|
|
1569
1564
|
*/
|
|
1570
1565
|
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
1566
|
/**
|
|
@@ -1664,7 +1659,7 @@ const rule$5 = createRule({
|
|
|
1664
1659
|
const tokenWrap = (value) => value ? `token(${value})` : "";
|
|
1665
1660
|
const isCompositeValue = (input) => {
|
|
1666
1661
|
if (!input) return false;
|
|
1667
|
-
return !/^
|
|
1662
|
+
return !/^token\([^)]*\)$/.test(input);
|
|
1668
1663
|
};
|
|
1669
1664
|
const sendReport = (node, value) => {
|
|
1670
1665
|
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.31.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) => {
|
|
@@ -1512,7 +1507,7 @@ const rule$7 = createRule({
|
|
|
1512
1507
|
*
|
|
1513
1508
|
* A bare `token(…)` counts even with no import to bind it, because the build counts it: its
|
|
1514
1509
|
* accounting keys on the name, so a local helper of that name declines there too. Staying
|
|
1515
|
-
* quiet about it would mean `
|
|
1510
|
+
* quiet about it would mean `prune.tokens: 'accounted'` failing a build the editor called clean.
|
|
1516
1511
|
*/
|
|
1517
1512
|
const isTokenCall = (node) => {
|
|
1518
1513
|
const callee = node.type === "CallExpression" ? node.callee : node.tag;
|
|
@@ -1561,11 +1556,11 @@ const rule$7 = createRule({
|
|
|
1561
1556
|
},
|
|
1562
1557
|
defaultOptions: [],
|
|
1563
1558
|
meta: {
|
|
1564
|
-
docs: { description: "Require a token path the build can resolve, so `
|
|
1559
|
+
docs: { description: "Require a token path the build can resolve, so `prune.tokens` can drop the declarations nothing asks for." },
|
|
1565
1560
|
messages: {
|
|
1566
1561
|
/**
|
|
1567
1562
|
* The build keeps every token declaration for this, because the path could name any of
|
|
1568
|
-
* them. Under `
|
|
1563
|
+
* them. Under `prune: { unresolved: 'error' }` it is an error rather than a size cost.
|
|
1569
1564
|
*/
|
|
1570
1565
|
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
1566
|
/**
|
|
@@ -1664,7 +1659,7 @@ const rule$5 = createRule({
|
|
|
1664
1659
|
const tokenWrap = (value) => value ? `token(${value})` : "";
|
|
1665
1660
|
const isCompositeValue = (input) => {
|
|
1666
1661
|
if (!input) return false;
|
|
1667
|
-
return !/^
|
|
1662
|
+
return !/^token\([^)]*\)$/.test(input);
|
|
1668
1663
|
};
|
|
1669
1664
|
const sendReport = (node, value) => {
|
|
1670
1665
|
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.31.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.31.0",
|
|
40
|
+
"@bamboocss/generator": "1.31.0",
|
|
41
|
+
"@bamboocss/shared": "1.31.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/dev": "1.
|
|
50
|
-
"@bamboocss/preset-bamboo": "1.
|
|
51
|
-
"@bamboocss/preset-base": "1.
|
|
52
|
-
"@bamboocss/types": "1.
|
|
49
|
+
"@bamboocss/dev": "1.31.0",
|
|
50
|
+
"@bamboocss/preset-bamboo": "1.31.0",
|
|
51
|
+
"@bamboocss/preset-base": "1.31.0",
|
|
52
|
+
"@bamboocss/types": "1.31.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"eslint": "*"
|