From e18817c1ec4c0224d7b88af8ee2fbef09b5869c7 Mon Sep 17 00:00:00 2001 From: Ryan Wilson-Perkin Date: Tue, 2 Apr 2024 15:05:58 -0400 Subject: [PATCH 1/6] Fix lint formatting --- .changeset/silver-rocks-own.md | 8 ++++++++ polaris-for-vscode/src/server.ts | 2 +- polaris-icons/tests/validate-svg-content.test.js | 1 - polaris-react/postcss-mixins/no-focus-ring.css | 2 +- polaris-react/src/components/Avatar/Avatar.stories.tsx | 2 +- .../src/components/ThemeProvider/ThemeProvider.tsx | 2 +- .../utilities/tests/use-index-resource-state.test.tsx | 10 +++++----- polaris-tokens/src/themes/base/breakpoints.ts | 2 +- polaris-tokens/src/themes/types.ts | 2 +- 9 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 .changeset/silver-rocks-own.md diff --git a/.changeset/silver-rocks-own.md b/.changeset/silver-rocks-own.md new file mode 100644 index 00000000000..c43e666a41f --- /dev/null +++ b/.changeset/silver-rocks-own.md @@ -0,0 +1,8 @@ +--- +'polaris-for-vscode': patch +'@shopify/polaris-icons': patch +'@shopify/polaris': patch +'@shopify/polaris-tokens': patch +--- + +Lint fixes diff --git a/polaris-for-vscode/src/server.ts b/polaris-for-vscode/src/server.ts index 5009c9a1f82..ca1f36ac751 100644 --- a/polaris-for-vscode/src/server.ts +++ b/polaris-for-vscode/src/server.ts @@ -20,7 +20,7 @@ import {TextDocument} from 'vscode-languageserver-textdocument'; const excludedTokenGroupNames = [] as const; -type ExcludedTokenGroupName = typeof excludedTokenGroupNames[number]; +type ExcludedTokenGroupName = (typeof excludedTokenGroupNames)[number]; type TokenGroupName = Exclude; diff --git a/polaris-icons/tests/validate-svg-content.test.js b/polaris-icons/tests/validate-svg-content.test.js index e6311d09a7f..442103661ac 100644 --- a/polaris-icons/tests/validate-svg-content.test.js +++ b/polaris-icons/tests/validate-svg-content.test.js @@ -1,7 +1,6 @@ const fs = require('fs'); const path = require('path'); -// eslint-disable-next-line import/no-extraneous-dependencies const svgo = require('svgo'); const globby = require('globby'); const unified = require('unified'); diff --git a/polaris-react/postcss-mixins/no-focus-ring.css b/polaris-react/postcss-mixins/no-focus-ring.css index aed4070fe38..2e4fdb944b3 100644 --- a/polaris-react/postcss-mixins/no-focus-ring.css +++ b/polaris-react/postcss-mixins/no-focus-ring.css @@ -2,4 +2,4 @@ &::after { content: none; } -} ; +} diff --git a/polaris-react/src/components/Avatar/Avatar.stories.tsx b/polaris-react/src/components/Avatar/Avatar.stories.tsx index 9061a501e2b..d2d3b255fcc 100644 --- a/polaris-react/src/components/Avatar/Avatar.stories.tsx +++ b/polaris-react/src/components/Avatar/Avatar.stories.tsx @@ -28,7 +28,7 @@ const sizes: NonNullable[] = [ 'xs', ]; -type Style = typeof STYLE_CLASSES[number]; +type Style = (typeof STYLE_CLASSES)[number]; const styleInitialsDefault: { [S in Style]: string; diff --git a/polaris-react/src/components/ThemeProvider/ThemeProvider.tsx b/polaris-react/src/components/ThemeProvider/ThemeProvider.tsx index 2284b403942..ddfc0bb3cc5 100644 --- a/polaris-react/src/components/ThemeProvider/ThemeProvider.tsx +++ b/polaris-react/src/components/ThemeProvider/ThemeProvider.tsx @@ -16,7 +16,7 @@ import styles from './ThemeProvider.module.css'; */ export const themeNamesLocal = ['light', 'dark-experimental'] as const; -type ThemeNameLocal = typeof themeNamesLocal[number]; +type ThemeNameLocal = (typeof themeNamesLocal)[number]; export const isThemeNameLocal = (name: string): name is ThemeNameLocal => themeNamesLocal.includes(name as any); diff --git a/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx b/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx index fd25d7847c1..bbfdaba3993 100644 --- a/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx +++ b/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx @@ -187,7 +187,7 @@ describe('useIndexResourceState', () => { it('accepts a custom resource filter', () => { const selectedID = '1'; const resources = [{id: selectedID}, {id: '2'}]; - const customResoureFilter = (item: typeof resources[0]) => { + const customResoureFilter = (item: (typeof resources)[0]) => { return item.id === selectedID; }; const mockComponent = mountWithApp( @@ -293,7 +293,7 @@ describe('useIndexResourceState', () => { const idOne = '1'; const idTwo = '2'; const resources = [{id: idOne}, {id: idTwo}]; - const customResoureFilter = (item: typeof resources[0]) => { + const customResoureFilter = (item: (typeof resources)[0]) => { return item.id === idOne; }; const mockComponent = mountWithApp( @@ -357,7 +357,7 @@ describe('useIndexResourceState', () => { const idOne = '1'; const idTwo = '2'; const resources = [{id: idOne}, {id: idTwo}]; - const customResoureFilter = (item: typeof resources[0]) => { + const customResoureFilter = (item: (typeof resources)[0]) => { return item.id === idOne; }; const mockComponent = mountWithApp( @@ -422,7 +422,7 @@ describe('useIndexResourceState', () => { const idTwo = '2'; const idThree = '3'; const resources = [{id: idOne}, {id: idTwo}, {id: idThree}]; - const customResoureFilter = (item: typeof resources[0]) => { + const customResoureFilter = (item: (typeof resources)[0]) => { return item.id === idOne; }; const mockComponent = mountWithApp( @@ -504,7 +504,7 @@ describe('useIndexResourceState', () => { const idTwo = '2'; const idThree = '3'; const resources = [{id: idOne}, {id: idTwo}, {id: idThree}]; - const customResoureFilter = (item: typeof resources[0]) => { + const customResoureFilter = (item: (typeof resources)[0]) => { return item.id !== idOne; }; const mockComponent = mountWithApp( diff --git a/polaris-tokens/src/themes/base/breakpoints.ts b/polaris-tokens/src/themes/base/breakpoints.ts index 4dd3b2d96d8..7974796a920 100644 --- a/polaris-tokens/src/themes/base/breakpoints.ts +++ b/polaris-tokens/src/themes/base/breakpoints.ts @@ -5,7 +5,7 @@ import type {MetaTokenProperties} from '../types'; export const breakpointsAliases = ['xs', 'sm', 'md', 'lg', 'xl'] as const; // Convert the Tuple to a union -export type BreakpointsAlias = typeof breakpointsAliases[number]; +export type BreakpointsAlias = (typeof breakpointsAliases)[number]; export type BreakpointsTokenName = `breakpoints-${BreakpointsAlias}`; diff --git a/polaris-tokens/src/themes/types.ts b/polaris-tokens/src/themes/types.ts index 1a96ca1b823..08bb81d5847 100644 --- a/polaris-tokens/src/themes/types.ts +++ b/polaris-tokens/src/themes/types.ts @@ -4,7 +4,7 @@ import type {themeNames} from './constants'; export type MetaThemeBase = typeof metaThemeBase; export type MetaTheme = MetaThemeBase; -export type ThemeName = typeof themeNames[number]; +export type ThemeName = (typeof themeNames)[number]; export type ThemeBase = ExtractMetaThemeValues; export type Theme = ExtractMetaThemeValues; From 78872b4e0bcb5b56c29efc118d78a51caeed074d Mon Sep 17 00:00:00 2001 From: Aaron Casanova Date: Mon, 8 Apr 2024 12:04:09 -0700 Subject: [PATCH 2/6] Revert polaris-for-vscode formatting updates --- polaris-for-vscode/src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polaris-for-vscode/src/server.ts b/polaris-for-vscode/src/server.ts index ca1f36ac751..5009c9a1f82 100644 --- a/polaris-for-vscode/src/server.ts +++ b/polaris-for-vscode/src/server.ts @@ -20,7 +20,7 @@ import {TextDocument} from 'vscode-languageserver-textdocument'; const excludedTokenGroupNames = [] as const; -type ExcludedTokenGroupName = (typeof excludedTokenGroupNames)[number]; +type ExcludedTokenGroupName = typeof excludedTokenGroupNames[number]; type TokenGroupName = Exclude; From bcbbcdb88ac870a7b3101588e7833ddb6051638a Mon Sep 17 00:00:00 2001 From: Aaron Casanova Date: Mon, 8 Apr 2024 12:05:15 -0700 Subject: [PATCH 3/6] Re-add svgo devDependency removed in #11328 --- polaris-icons/package.json | 1 + yarn.lock | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/polaris-icons/package.json b/polaris-icons/package.json index d62a58a2970..8f7b6e1c009 100644 --- a/polaris-icons/package.json +++ b/polaris-icons/package.json @@ -62,6 +62,7 @@ "hast-util-select": "^3.0.0", "js-yaml": "^4.0.0", "rehype-parse": "^7.0.1", + "svgo": "^2.8.0", "unified": "^9.2.1" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index de6576e9c68..172ead825c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20775,7 +20775,7 @@ svg-tags@^1.0.0: resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764" integrity sha1-WPcc7jvVGbWdSyqEO2x95krAR2Q= -svgo@^2.7.0: +svgo@^2.7.0, svgo@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/svgo/-/svgo-2.8.0.tgz#4ff80cce6710dc2795f0c7c74101e6764cfccd24" integrity sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg== From 6881a50ad00eaa884497c48407271c6876b64a1e Mon Sep 17 00:00:00 2001 From: Aaron Casanova Date: Mon, 8 Apr 2024 12:08:45 -0700 Subject: [PATCH 4/6] Revert polaris-tokens formatting updates --- polaris-tokens/src/themes/base/breakpoints.ts | 2 +- polaris-tokens/src/themes/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/polaris-tokens/src/themes/base/breakpoints.ts b/polaris-tokens/src/themes/base/breakpoints.ts index 7974796a920..4dd3b2d96d8 100644 --- a/polaris-tokens/src/themes/base/breakpoints.ts +++ b/polaris-tokens/src/themes/base/breakpoints.ts @@ -5,7 +5,7 @@ import type {MetaTokenProperties} from '../types'; export const breakpointsAliases = ['xs', 'sm', 'md', 'lg', 'xl'] as const; // Convert the Tuple to a union -export type BreakpointsAlias = (typeof breakpointsAliases)[number]; +export type BreakpointsAlias = typeof breakpointsAliases[number]; export type BreakpointsTokenName = `breakpoints-${BreakpointsAlias}`; diff --git a/polaris-tokens/src/themes/types.ts b/polaris-tokens/src/themes/types.ts index 08bb81d5847..1a96ca1b823 100644 --- a/polaris-tokens/src/themes/types.ts +++ b/polaris-tokens/src/themes/types.ts @@ -4,7 +4,7 @@ import type {themeNames} from './constants'; export type MetaThemeBase = typeof metaThemeBase; export type MetaTheme = MetaThemeBase; -export type ThemeName = (typeof themeNames)[number]; +export type ThemeName = typeof themeNames[number]; export type ThemeBase = ExtractMetaThemeValues; export type Theme = ExtractMetaThemeValues; From b36465568694eada249abcf4d30ae6b2455e4e62 Mon Sep 17 00:00:00 2001 From: Aaron Casanova Date: Mon, 8 Apr 2024 12:13:29 -0700 Subject: [PATCH 5/6] Revert polaris-react formatting updates --- polaris-react/src/components/Avatar/Avatar.stories.tsx | 2 +- .../src/components/ThemeProvider/ThemeProvider.tsx | 2 +- .../utilities/tests/use-index-resource-state.test.tsx | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/polaris-react/src/components/Avatar/Avatar.stories.tsx b/polaris-react/src/components/Avatar/Avatar.stories.tsx index d2d3b255fcc..9061a501e2b 100644 --- a/polaris-react/src/components/Avatar/Avatar.stories.tsx +++ b/polaris-react/src/components/Avatar/Avatar.stories.tsx @@ -28,7 +28,7 @@ const sizes: NonNullable[] = [ 'xs', ]; -type Style = (typeof STYLE_CLASSES)[number]; +type Style = typeof STYLE_CLASSES[number]; const styleInitialsDefault: { [S in Style]: string; diff --git a/polaris-react/src/components/ThemeProvider/ThemeProvider.tsx b/polaris-react/src/components/ThemeProvider/ThemeProvider.tsx index ddfc0bb3cc5..2284b403942 100644 --- a/polaris-react/src/components/ThemeProvider/ThemeProvider.tsx +++ b/polaris-react/src/components/ThemeProvider/ThemeProvider.tsx @@ -16,7 +16,7 @@ import styles from './ThemeProvider.module.css'; */ export const themeNamesLocal = ['light', 'dark-experimental'] as const; -type ThemeNameLocal = (typeof themeNamesLocal)[number]; +type ThemeNameLocal = typeof themeNamesLocal[number]; export const isThemeNameLocal = (name: string): name is ThemeNameLocal => themeNamesLocal.includes(name as any); diff --git a/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx b/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx index bbfdaba3993..fd25d7847c1 100644 --- a/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx +++ b/polaris-react/src/utilities/tests/use-index-resource-state.test.tsx @@ -187,7 +187,7 @@ describe('useIndexResourceState', () => { it('accepts a custom resource filter', () => { const selectedID = '1'; const resources = [{id: selectedID}, {id: '2'}]; - const customResoureFilter = (item: (typeof resources)[0]) => { + const customResoureFilter = (item: typeof resources[0]) => { return item.id === selectedID; }; const mockComponent = mountWithApp( @@ -293,7 +293,7 @@ describe('useIndexResourceState', () => { const idOne = '1'; const idTwo = '2'; const resources = [{id: idOne}, {id: idTwo}]; - const customResoureFilter = (item: (typeof resources)[0]) => { + const customResoureFilter = (item: typeof resources[0]) => { return item.id === idOne; }; const mockComponent = mountWithApp( @@ -357,7 +357,7 @@ describe('useIndexResourceState', () => { const idOne = '1'; const idTwo = '2'; const resources = [{id: idOne}, {id: idTwo}]; - const customResoureFilter = (item: (typeof resources)[0]) => { + const customResoureFilter = (item: typeof resources[0]) => { return item.id === idOne; }; const mockComponent = mountWithApp( @@ -422,7 +422,7 @@ describe('useIndexResourceState', () => { const idTwo = '2'; const idThree = '3'; const resources = [{id: idOne}, {id: idTwo}, {id: idThree}]; - const customResoureFilter = (item: (typeof resources)[0]) => { + const customResoureFilter = (item: typeof resources[0]) => { return item.id === idOne; }; const mockComponent = mountWithApp( @@ -504,7 +504,7 @@ describe('useIndexResourceState', () => { const idTwo = '2'; const idThree = '3'; const resources = [{id: idOne}, {id: idTwo}, {id: idThree}]; - const customResoureFilter = (item: (typeof resources)[0]) => { + const customResoureFilter = (item: typeof resources[0]) => { return item.id !== idOne; }; const mockComponent = mountWithApp( From ce983d86a88f438d0a31abb0e23b7fcbbce5b5de Mon Sep 17 00:00:00 2001 From: Aaron Casanova Date: Mon, 8 Apr 2024 17:47:20 -0700 Subject: [PATCH 6/6] Update changeset entries --- .changeset/neat-bulldogs-love.md | 5 +++++ .changeset/silver-rocks-own.md | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .changeset/neat-bulldogs-love.md diff --git a/.changeset/neat-bulldogs-love.md b/.changeset/neat-bulldogs-love.md new file mode 100644 index 00000000000..af8befd2720 --- /dev/null +++ b/.changeset/neat-bulldogs-love.md @@ -0,0 +1,5 @@ +--- +'@shopify/polaris-icons': patch +--- + +Added missing `svgo` dev dependency diff --git a/.changeset/silver-rocks-own.md b/.changeset/silver-rocks-own.md index c43e666a41f..10396c572b4 100644 --- a/.changeset/silver-rocks-own.md +++ b/.changeset/silver-rocks-own.md @@ -1,8 +1,5 @@ --- -'polaris-for-vscode': patch -'@shopify/polaris-icons': patch '@shopify/polaris': patch -'@shopify/polaris-tokens': patch --- Lint fixes