Skip to content

Commit

Permalink
refactor: change tTokens name to tokensToPrefixWithT
Browse files Browse the repository at this point in the history
  • Loading branch information
adamviktora committed Sep 25, 2024
1 parent acc5f13 commit 8b1facc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -94,7 +94,7 @@ module.exports = {

const { token } = specifierWithToken;

if (tTokens.includes(token)) {
if (tokensToPrefixWithT.includes(token)) {
replaceToken(node, token);
}
},
Expand All @@ -114,7 +114,7 @@ module.exports = {

if (specifierWithToken) {
const { token } = specifierWithToken;
if (tTokens.includes(token)) {
if (tokensToPrefixWithT.includes(token)) {
replaceToken(node, token);
}
}
Expand All @@ -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);
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-pf-codemods/src/tokenLists/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export * from "./oldCssVarNamesV5";
export * from "./oldGlobalCssVarNames";
export * from "./oldGlobalTokens";
export * from "./oldTokens";
export * from "./tTokens";
export * from "./tokensToPrefixWithT";
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 8b1facc

Please sign in to comment.