diff --git a/eslint.config.mjs b/eslint.config.mjs index 76258ccfd..df55b0cdb 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -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, @@ -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, }, }, diff --git a/package-lock.json b/package-lock.json index baa55f467..779d64dd6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@primer/primitives", - "version": "10.3.3", + "version": "10.3.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@primer/primitives", - "version": "10.3.3", + "version": "10.3.4", "license": "MIT", "devDependencies": { "@actions/core": "^1.11.1", diff --git a/package.json b/package.json index 09554f16b..45d21d129 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/formats/utilities/createPropertyFormatterWithRef.ts b/src/formats/utilities/createPropertyFormatterWithRef.ts index 2a8fff48c..120c35827 100644 --- a/src/formats/utilities/createPropertyFormatterWithRef.ts +++ b/src/formats/utilities/createPropertyFormatterWithRef.ts @@ -1,5 +1,3 @@ -/* eslint-disable eslintComments/no-use */ -/* eslint-disable camelcase */ /* * Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * @@ -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 @@ -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 } /** @@ -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 = @@ -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 } } diff --git a/src/platforms/utilities/outputReferencesTransformedWithObject.ts b/src/platforms/utilities/outputReferencesTransformedWithObject.ts index fc415d09e..96d3cdfe5 100644 --- a/src/platforms/utilities/outputReferencesTransformedWithObject.ts +++ b/src/platforms/utilities/outputReferencesTransformedWithObject.ts @@ -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 }