From 8b1facca5ae1665e0f78484cb77369ef37ee36ef Mon Sep 17 00:00:00 2001 From: adamviktora Date: Wed, 25 Sep 2024 18:04:25 +0200 Subject: [PATCH] refactor: change tTokens name to tokensToPrefixWithT --- .../v6/tokensPrefixWithT/tokens-prefix-with-t.ts | 13 ++++++++----- .../src/tokenLists/index.ts | 2 +- .../{tTokens.ts => tokensToPrefixWithT.ts} | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) rename packages/eslint-plugin-pf-codemods/src/tokenLists/{tTokens.ts => tokensToPrefixWithT.ts} (99%) diff --git a/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensPrefixWithT/tokens-prefix-with-t.ts b/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensPrefixWithT/tokens-prefix-with-t.ts index 54f2e403..c3ff688b 100644 --- a/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensPrefixWithT/tokens-prefix-with-t.ts +++ b/packages/eslint-plugin-pf-codemods/src/rules/v6/tokensPrefixWithT/tokens-prefix-with-t.ts @@ -8,7 +8,7 @@ import { getImportPath, } from "../../helpers"; import { Identifier, ImportSpecifier } from "estree-jsx"; -import { tTokens } from "../../../tokenLists"; +import { tokensToPrefixWithT } from "../../../tokenLists"; module.exports = { meta: { fixable: "code" }, @@ -78,7 +78,7 @@ module.exports = { ImportSpecifier(node: ImportSpecifier) { if (tokenSpecifiers.includes(node)) { const token = node.imported.name; - if (tTokens.includes(token)) { + if (tokensToPrefixWithT.includes(token)) { replaceToken(node, token); } } @@ -94,7 +94,7 @@ module.exports = { const { token } = specifierWithToken; - if (tTokens.includes(token)) { + if (tokensToPrefixWithT.includes(token)) { replaceToken(node, token); } }, @@ -114,7 +114,7 @@ module.exports = { if (specifierWithToken) { const { token } = specifierWithToken; - if (tTokens.includes(token)) { + if (tokensToPrefixWithT.includes(token)) { replaceToken(node, token); } } @@ -125,7 +125,10 @@ module.exports = { node.name === specifier.local.name ); - if (unaliasedTokenSpecifier && tTokens.includes(node.name)) { + if ( + unaliasedTokenSpecifier && + tokensToPrefixWithT.includes(node.name) + ) { replaceToken(node, node.name); } }, diff --git a/packages/eslint-plugin-pf-codemods/src/tokenLists/index.ts b/packages/eslint-plugin-pf-codemods/src/tokenLists/index.ts index ab75d6b6..48c8b845 100644 --- a/packages/eslint-plugin-pf-codemods/src/tokenLists/index.ts +++ b/packages/eslint-plugin-pf-codemods/src/tokenLists/index.ts @@ -2,4 +2,4 @@ export * from "./oldCssVarNamesV5"; export * from "./oldGlobalCssVarNames"; export * from "./oldGlobalTokens"; export * from "./oldTokens"; -export * from "./tTokens"; +export * from "./tokensToPrefixWithT"; diff --git a/packages/eslint-plugin-pf-codemods/src/tokenLists/tTokens.ts b/packages/eslint-plugin-pf-codemods/src/tokenLists/tokensToPrefixWithT.ts similarity index 99% rename from packages/eslint-plugin-pf-codemods/src/tokenLists/tTokens.ts rename to packages/eslint-plugin-pf-codemods/src/tokenLists/tokensToPrefixWithT.ts index 2740cbb2..5094e972 100644 --- a/packages/eslint-plugin-pf-codemods/src/tokenLists/tTokens.ts +++ b/packages/eslint-plugin-pf-codemods/src/tokenLists/tokensToPrefixWithT.ts @@ -1,6 +1,6 @@ // all React tokens in V6, whose value is a Patternfly token variable (has prefix --pf-t) // their naming was updated to be prefixed with 't_' -export const tTokens = [ +export const tokensToPrefixWithT = [ "chart_global_fill_color_100", "chart_theme_colorscales_blue_colorscale_100", "chart_theme_colorscales_blue_colorscale_200",