Skip to content

Commit

Permalink
Merge pull request #6862 from Sage/update-prettier-to-latest
Browse files Browse the repository at this point in the history
chore: update prettier to v3.3.3 - FE-6295
  • Loading branch information
DipperTheDan authored Oct 31, 2024
2 parents 67af2c8 + 225aa9a commit b1725e3
Show file tree
Hide file tree
Showing 614 changed files with 13,357 additions and 13,296 deletions.
15 changes: 9 additions & 6 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 @@ -162,7 +162,7 @@
"mockdate": "^2.0.5",
"nock": "^13.3.8",
"node-fetch": "^3.3.2",
"prettier": "~2.2.0",
"prettier": "~3.3.3",
"raf": "^3.4.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion playwright/components/draggable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DRAGGABLE_ITEM, DRAG_ICON } from "./locators";

export const draggableItem = (page: Page, text: string) =>
page.locator(
`${DRAGGABLE_ITEM}:has-text("Draggable Label ${text}") ${DRAG_ICON}`
`${DRAGGABLE_ITEM}:has-text("Draggable Label ${text}") ${DRAG_ICON}`,
);

export const draggableItemByPosition = (page: Page, index: number) =>
Expand Down
2 changes: 1 addition & 1 deletion playwright/components/flat-table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const flatTableDraggableItemByPosition = (page: Page, index: number) =>
export const flatTableCheckboxAsProp = (
page: Page,
index: number,
asVal: FlatTableCheckboxProps["as"]
asVal: FlatTableCheckboxProps["as"],
) =>
page
.locator(FLAT_TABLE_ROW)
Expand Down
8 changes: 4 additions & 4 deletions playwright/components/pager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ export const currentPageInput = (page: Page) =>
export const previousArrow = (page: Page) =>
getDataElementByValue(
page,
`${COMMON_PART_OF_PAGER_LINK}${PAGER_PREVIOUS_ARROW}`
`${COMMON_PART_OF_PAGER_LINK}${PAGER_PREVIOUS_ARROW}`,
);
export const nextArrow = (page: Page) =>
getDataElementByValue(
page,
`${COMMON_PART_OF_PAGER_LINK}${PAGER_NEXT_ARROW}`
`${COMMON_PART_OF_PAGER_LINK}${PAGER_NEXT_ARROW}`,
);
export const firstArrow = (page: Page) =>
getDataElementByValue(
page,
`${COMMON_PART_OF_PAGER_LINK}${PAGER_FIRST_ARROW}`
`${COMMON_PART_OF_PAGER_LINK}${PAGER_FIRST_ARROW}`,
);
export const lastArrow = (page: Page) =>
getDataElementByValue(
page,
`${COMMON_PART_OF_PAGER_LINK}${PAGER_LAST_ARROW}`
`${COMMON_PART_OF_PAGER_LINK}${PAGER_LAST_ARROW}`,
);
export const showLabelBefore = (page: Page) =>
page
Expand Down
2 changes: 1 addition & 1 deletion playwright/components/progress-tracker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const progressTrackerMaxVal = (page: Page) =>

export const progressTrackerCustomValuePreposition = (page: Page) =>
progressTrackerComponent(page).locator(
PROGRESS_TRACKER_CUSTOM_VALUE_PREPOSITION
PROGRESS_TRACKER_CUSTOM_VALUE_PREPOSITION,
);

export const progressTrackerDescription = (page: Page) =>
Expand Down
2 changes: 1 addition & 1 deletion playwright/components/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const multiColumnsSelectListRow = (page: Page) =>

export const multiColumnsSelectListNoResultsMessage = (
page: Page,
text: string
text: string,
) =>
selectList(page)
.locator("tbody > tr > td")
Expand Down
40 changes: 19 additions & 21 deletions playwright/support/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ const CLOSED_MODAL = '[data-state="closed"]';
export const getStyle = async (
locator: Locator,
cssProp: string,
pseudoElement?: string
pseudoElement?: string,
): Promise<string> => {
return locator.evaluate(
(el, [property, pseudo]) =>
window.getComputedStyle(el, pseudo).getPropertyValue(property as string),
[cssProp, pseudoElement]
[cssProp, pseudoElement],
);
};

export const waitForAnimationEnd = (locator: Locator) =>
locator.evaluate((element) =>
Promise.all(element.getAnimations().map((animation) => animation.finished))
Promise.all(element.getAnimations().map((animation) => animation.finished)),
);

/**
Expand Down Expand Up @@ -88,7 +88,7 @@ export const checkCSSOutline = async (
outlinePixelWidth = "2px",
cssProp: OutlineType = "outline",
style = "solid",
color = ""
color = "",
) => {
const outlineWidth = await getStyle(element, `${cssProp}-width`);
const outlineColor = await getStyle(element, `${cssProp}-color`);
Expand All @@ -109,14 +109,14 @@ export const checkCSSOutline = async (
export const checkGoldenOutline = async (
element: Locator,
outlinePixelWidth = "3px",
outline: OutlineType = "outline"
outline: OutlineType = "outline",
) => {
await checkCSSOutline(
element,
outlinePixelWidth,
outline,
"solid",
"rgb(255, 188, 25)"
"rgb(255, 188, 25)",
);
};

Expand All @@ -126,7 +126,7 @@ export const checkElementIsInDOM = async (page: Page, locatorStr: string) => {

export const checkElementIsNotInDOM = async (
page: Page,
locatorStr: string
locatorStr: string,
) => {
expect(await page.$$(locatorStr)).toHaveLength(0);
};
Expand All @@ -149,7 +149,7 @@ export const checkDialogIsNotInDOM = async (page: Page) => {
*/
export const expectEventWasCalledOnce = async (
callbackData: string[],
eventName: string
eventName: string,
) => {
const count = JSON.stringify(callbackData.length);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down Expand Up @@ -181,11 +181,11 @@ export const expectEventWasNotCalled = async (callbackData: string[]) => {
*/
export const containsClass = async (
locatorFunc: Locator,
className: string
className: string,
) => {
const escapedClassName = className.replace(
/[-[\]{}()*+?.,\\^$|#\s]/g,
"\\$&"
"\\$&",
);

const classNameRegEx = new RegExp(escapedClassName);
Expand Down Expand Up @@ -231,7 +231,7 @@ export function getRotationAngle(cssTransformString: string) {
export const assertCssValueIsApproximately = async (
element: Locator,
cssProp: string,
value: number
value: number,
) => {
const val = await getStyle(element, cssProp);
expect(parseInt(val)).toBeGreaterThanOrEqual(value - 2);
Expand All @@ -255,9 +255,7 @@ const keys = {
pageup: { key: "PageUp", keyCode: 33, which: 33 },
};

export function keyCode(
type: keyof typeof keys
): {
export function keyCode(type: keyof typeof keys): {
key: string;
keyCode: number;
which: number;
Expand All @@ -271,14 +269,14 @@ const verifyRequiredAsterisk = async (locator: Locator) => {
// use getComputedStyle to read the pseudo selector
// and read the value of the `content` CSS property
const contentValue = await locator.evaluate((el) =>
window.getComputedStyle(el, "after").getPropertyValue("content")
window.getComputedStyle(el, "after").getPropertyValue("content"),
);
await expect(contentValue).toBe('"*"');
};

export const verifyRequiredAsteriskForLabel = (
page: Page,
locator?: Locator
locator?: Locator,
) => {
if (locator) {
return verifyRequiredAsterisk(locator);
Expand All @@ -293,7 +291,7 @@ export const verifyRequiredAsteriskForLegend = (page: Page) =>
* Verifies whether an object exists while not visible to the user. */
export const isInViewport = async (page: Page, locator: Locator) => {
const rect = await locator.evaluate((element) =>
element.getBoundingClientRect()
element.getBoundingClientRect(),
);
const bottom = await page.evaluate(async () => {
const { documentElement } = window.document;
Expand All @@ -306,7 +304,7 @@ export const isInViewport = async (page: Page, locator: Locator) => {
export const getDesignTokensByCssProperty = async (
page: Page,
locator: Locator,
cssProperty: string
cssProperty: string,
) => {
const element = await locator.elementHandle();
const tokens: string[] = await page.evaluate(
Expand Down Expand Up @@ -341,7 +339,7 @@ export const getDesignTokensByCssProperty = async (
}
return tokenNames;
},
[element, cssProperty]
[element, cssProperty],
);
if (tokens.length === 0) {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -373,7 +371,7 @@ export const continuePressingSHIFTTAB = async (page: Page, count: number) => {
export const checkElementBorderColours = async (
page: Page,
element: Locator,
color: string
color: string,
) => {
await expect(element).toHaveCSS("border-bottom-color", color);
await expect(element).toHaveCSS("border-left-color", color);
Expand All @@ -390,6 +388,6 @@ export const waitForElementFocus = async (page: Page, locator: Locator) => {
const focusedElement = await locator.elementHandle();
await page.waitForFunction(
(element) => document.activeElement === element,
focusedElement
focusedElement,
);
};
10 changes: 5 additions & 5 deletions src/__internal__/character-count/character-count.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const CharacterCount = ({
id={visuallyHiddenHintId}
>
{l.characterCount.visuallyHiddenHint(
getFormatNumber(limit, l.locale())
getFormatNumber(limit, l.locale()),
)}
</VisuallyHiddenHint>
<StyledCharacterCount
Expand All @@ -56,11 +56,11 @@ const CharacterCount = ({
{!isOverLimit
? l.characterCount.charactersLeft(
limitMinusValue,
getFormatNumber(limitMinusValue, l.locale())
getFormatNumber(limitMinusValue, l.locale()),
)
: l.characterCount.tooManyCharacters(
valueMinusLimit,
getFormatNumber(valueMinusLimit, l.locale())
getFormatNumber(valueMinusLimit, l.locale()),
)}
</StyledCharacterCount>
<VisuallyHiddenCharacterCount
Expand All @@ -71,11 +71,11 @@ const CharacterCount = ({
{!isDebouncedOverLimit
? l.characterCount.charactersLeft(
debouncedLimitMinusValue,
getFormatNumber(debouncedLimitMinusValue, l.locale())
getFormatNumber(debouncedLimitMinusValue, l.locale()),
)
: l.characterCount.tooManyCharacters(
debouncedValueMinusLimit,
getFormatNumber(debouncedValueMinusLimit, l.locale())
getFormatNumber(debouncedValueMinusLimit, l.locale()),
)}
</VisuallyHiddenCharacterCount>
</StyledCharacterCountWrapper>
Expand Down
16 changes: 8 additions & 8 deletions src/__internal__/character-count/character-count.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test("visually hidden character counter is visually hidden", () => {
render(<CharacterCount value={5} limit={10} isOverLimit={false} />);

const visuallyHiddenCharacterCount = screen.getByTestId(
"visually-hidden-character-count"
"visually-hidden-character-count",
);
expect(visuallyHiddenCharacterCount).toHaveStyle({
border: "0",
Expand All @@ -52,7 +52,7 @@ test("visually hidden character count renders with the 'aria-live' attribute set
render(<CharacterCount value={5} limit={10} isOverLimit={false} />);

const visuallyHiddenCharacterCount = screen.getByTestId(
"visually-hidden-character-count"
"visually-hidden-character-count",
);
expect(visuallyHiddenCharacterCount).toHaveAttribute("aria-live", "off");
});
Expand All @@ -64,11 +64,11 @@ test("visually hidden character count renders with the 'aria-live' attribute set
limit={10}
isOverLimit={false}
ariaLive="polite"
/>
/>,
);

const visuallyHiddenCharacterCount = screen.getByTestId(
"visually-hidden-character-count"
"visually-hidden-character-count",
);
expect(visuallyHiddenCharacterCount).toHaveAttribute("aria-live", "polite");
});
Expand All @@ -77,7 +77,7 @@ test("visually hidden character count renders with '{count} character(s) left' t
render(<CharacterCount value={5} limit={10} isOverLimit={false} />);

const visuallyHiddenCharacterCount = screen.getByTestId(
"visually-hidden-character-count"
"visually-hidden-character-count",
);
expect(visuallyHiddenCharacterCount).toHaveTextContent("5 characters left");
});
Expand All @@ -89,11 +89,11 @@ test("visually hidden character count renders with '{count} character(s) too man
limit={5}
isOverLimit={false}
isDebouncedOverLimit
/>
/>,
);

const visuallyHiddenHint = screen.getByTestId(
"visually-hidden-character-count"
"visually-hidden-character-count",
);
expect(visuallyHiddenHint).toHaveTextContent("5 characters too many");
});
Expand All @@ -119,6 +119,6 @@ test("visually hidden hint renders with 'you can enter up to {count} character(s

const visuallyHiddenHint = screen.getByTestId("visually-hidden-hint");
expect(visuallyHiddenHint).toHaveTextContent(
"You can enter up to 10 characters"
"You can enter up to 10 characters",
);
});
Loading

0 comments on commit b1725e3

Please sign in to comment.