Skip to content

Commit

Permalink
fix for eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Jan 23, 2025
1 parent 747b9c9 commit f19507b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default tseslint.config([
...eslintPluginReactHooks.configs.recommended.rules,
...eslintPluginReact.configs['jsx-runtime'].rules,
...eslintPluginGithub.getFlatConfigs().rules,
'eslint-comments/no-use': 'off',
},
},
eslintPluginPrettierRecommended,
Expand Down Expand Up @@ -159,6 +160,7 @@ export default tseslint.config([
{
files: ['**/*.test.{ts,tsx,js,jsx}'],
rules: {
'eslint-comments/no-use': 'off',
'i18n-text/no-en': 0,
},
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
"console-table-printer": "^2.12.1",
"eslint": "9.16",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "7.37",
"eslint-import-resolver-typescript": "3.6",
"eslint-plugin-github": "^5.1.3",
"eslint-plugin-jsx-a11y": "6.10",
"eslint-plugin-react": "7.37",
"eslint-plugin-react-hooks": "^5.0.0",
"json5": "^2.2.1",
"markdown-table-ts": "^1.0.3",
Expand Down
30 changes: 14 additions & 16 deletions src/formats/utilities/createPropertyFormatterWithRef.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable eslintComments/no-use */
/* eslint-disable camelcase */
/*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
Expand Down Expand Up @@ -37,12 +35,12 @@ const defaultFormatting = {
/**
* Split a string comment by newlines and
* convert to multi-line comment if necessary
* @param {string} to_ret_token
* @param {string} toRetToken
* @param {string} comment
* @param {Formatting} options
* @returns {string}
*/
export function addComment(to_ret_token: string, comment: string, options: FormattingOptions) {
export function addComment(toRetToken: string, comment: string, options: FormattingOptions) {
const {commentStyle, indentation} = options
let {commentPosition} = options

Expand Down Expand Up @@ -77,12 +75,12 @@ export function addComment(to_ret_token: string, comment: string, options: Forma

if (commentPosition === 'above') {
// put the comment above the token if it's multi-line or if commentStyle ended with -above
to_ret_token = `${processedComment}\n${to_ret_token}`
toRetToken = `${processedComment}\n${toRetToken}`
} else {
to_ret_token = `${to_ret_token} ${processedComment}`
toRetToken = `${toRetToken} ${processedComment}`
}

return to_ret_token
return toRetToken
}

/**
Expand Down Expand Up @@ -153,7 +151,7 @@ export default function createPropertyFormatterWithRef({
const {prefix, commentStyle, indentation, separator, suffix} = mergedOptions
const {tokens, unfilteredTokens} = dictionary
return function (token: TransformedToken) {
let to_ret_token = `${indentation}${prefix}${token.name}${separator} `
let toRetToken = `${indentation}${prefix}${token.name}${separator} `
let value = usesDtcg ? token.$value : token.value
const originalValue = usesDtcg ? token.original.$value : token.original.value
const shouldOutputRef =
Expand Down Expand Up @@ -233,20 +231,20 @@ export default function createPropertyFormatterWithRef({
})
}

to_ret_token += value
toRetToken += value

const themeable_token = typeof token.themeable === 'boolean' ? token.themeable : themeable
if (format === 'sass' && themeable_token) {
to_ret_token += ' !default'
const themeableToken = typeof token.themeable === 'boolean' ? token.themeable : themeable
if (format === 'sass' && themeableToken) {
toRetToken += ' !default'
}

to_ret_token += suffix
toRetToken += suffix

const comment = token.$description ?? token.comment
if (comment && commentStyle !== 'none') {
to_ret_token = addComment(to_ret_token, comment, mergedOptions as FormattingOptions)
toRetToken = addComment(toRetToken, comment, mergedOptions as FormattingOptions)
}
// console.log('to_ret_token', to_ret_token)
return to_ret_token
// console.log('toRetToken', toRetToken)
return toRetToken
}
}
16 changes: 8 additions & 8 deletions src/platforms/utilities/outputReferencesTransformedWithObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export function outputReferencesTransformedWithObject(
}
if (typeof originalValue === 'object') {
const values = Object.values(originalValue).filter(val => typeof val === 'string')
return values.every(val =>
values.includes(
resolveReferences(val, dictionary.unfilteredTokens ?? dictionary.tokens, {
usesDtcg,
warnImmediately: false,
}),
),
)
return values.every(val => {
const resolvedValue = resolveReferences(val, dictionary.unfilteredTokens ?? dictionary.tokens, {
usesDtcg,
warnImmediately: false,
})

return typeof resolvedValue === 'string' ? values.includes(resolvedValue) : true
})
}
return false
}

0 comments on commit f19507b

Please sign in to comment.