Skip to content

Commit 1118d08

Browse files
committed
fix: remove hardcoded babel parser from prettier so prettier can determine which parse to use from eslint rules
1 parent 260277b commit 1118d08

File tree

7 files changed

+82
-75
lines changed

7 files changed

+82
-75
lines changed

.prettierrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"insertPragma": false,
66
"jsxBracketSameLine": false,
77
"jsxSingleQuote": false,
8-
"parser": "babel",
98
"printWidth": 80,
109
"proseWrap": "never",
1110
"requirePragma": false,

client/common/Button.tsx

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,88 +5,87 @@ import { remSize, prop } from '../theme';
55

66
const kinds = {
77
primary: 'primary',
8-
secondary:'secondary'
9-
// eslint-disable-next-line prettier/prettier
8+
secondary: 'secondary'
109
} as const;
1110

12-
type Kind = keyof typeof kinds
11+
type Kind = keyof typeof kinds;
1312

1413
const displays = {
1514
block: 'block',
1615
inline: 'inline'
1716
} as const;
1817

19-
type Display = keyof typeof displays
18+
type Display = keyof typeof displays;
2019

2120
type StyledButtonProps = {
22-
kind: Kind,
23-
display: Display
24-
}
21+
kind: Kind;
22+
display: Display;
23+
};
2524

2625
const buttonTypes = {
2726
button: 'button',
2827
submit: 'submit'
2928
} as const;
3029

31-
type ButtonType = keyof typeof buttonTypes
30+
type ButtonType = keyof typeof buttonTypes;
3231

3332
type SharedButtonProps = {
34-
/**
33+
/**
3534
* The visible part of the button, telling the user what
3635
* the action is
3736
*/
38-
children?: React.ReactNode,
39-
/**
37+
children?: React.ReactNode;
38+
/**
4039
If the button can be activated or not
4140
*/
42-
disabled?: boolean,
43-
/**
44-
* The display type of the button—inline or block
45-
*/
46-
display?: Display,
47-
/**
48-
* SVG icon to place after child content
49-
*/
50-
iconAfter?: React.ReactNode,
51-
/**
52-
* SVG icon to place before child content
53-
*/
54-
iconBefore?: React.ReactNode,
55-
/**
56-
* If the button content is only an SVG icon
57-
*/
58-
iconOnly?: boolean,
59-
/**
60-
* The kind of button - determines how it appears visually
61-
*/
62-
kind?: Kind,
63-
/**
64-
* Specifying an href will use an <a> to link to the URL
65-
*/
66-
href?: string | null,
67-
/**
68-
* An ARIA Label used for accessibility
69-
*/
70-
'aria-label'?: string | null,
71-
/**
72-
* Specifying a to URL will use a react-router Link
73-
*/
74-
to?: string | null,
75-
/**
76-
* If using a button, then type is defines the type of button
77-
*/
78-
type?: ButtonType,
79-
/**
80-
* Allows for IconButton to pass `focusable="false"` as a prop for SVGs.
81-
* See @types/react > interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T>
82-
*/
83-
focusable?: boolean | 'true' | 'false'
84-
}
41+
disabled?: boolean;
42+
/**
43+
* The display type of the button—inline or block
44+
*/
45+
display?: Display;
46+
/**
47+
* SVG icon to place after child content
48+
*/
49+
iconAfter?: React.ReactNode;
50+
/**
51+
* SVG icon to place before child content
52+
*/
53+
iconBefore?: React.ReactNode;
54+
/**
55+
* If the button content is only an SVG icon
56+
*/
57+
iconOnly?: boolean;
58+
/**
59+
* The kind of button - determines how it appears visually
60+
*/
61+
kind?: Kind;
62+
/**
63+
* Specifying an href will use an <a> to link to the URL
64+
*/
65+
href?: string | null;
66+
/**
67+
* An ARIA Label used for accessibility
68+
*/
69+
'aria-label'?: string | null;
70+
/**
71+
* Specifying a to URL will use a react-router Link
72+
*/
73+
to?: string | null;
74+
/**
75+
* If using a button, then type is defines the type of button
76+
*/
77+
type?: ButtonType;
78+
/**
79+
* Allows for IconButton to pass `focusable="false"` as a prop for SVGs.
80+
* See @types/react > interface SVGAttributes<T> extends AriaAttributes, DOMAttributes<T>
81+
*/
82+
focusable?: boolean | 'true' | 'false';
83+
};
8584

8685
export type ButtonProps = SharedButtonProps &
87-
React.ButtonHTMLAttributes<HTMLButtonElement> &
88-
React.AnchorHTMLAttributes<HTMLAnchorElement> &
89-
Partial<LinkProps>;
86+
React.ButtonHTMLAttributes<HTMLButtonElement> &
87+
React.AnchorHTMLAttributes<HTMLAnchorElement> &
88+
Partial<LinkProps>;
9089

9190
// The '&&&' will increase the specificity of the
9291
// component's CSS so that it overrides the more
@@ -205,7 +204,9 @@ const Button = ({
205204
{iconAfter}
206205
</>
207206
);
208-
const StyledComponent: React.ElementType = iconOnly ? StyledInlineButton : StyledButton;
207+
const StyledComponent: React.ElementType = iconOnly
208+
? StyledInlineButton
209+
: StyledButton;
209210

210211
if (href) {
211212
return (

client/common/ButtonOrLink.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { Link } from 'react-router-dom';
33

4-
54
/**
65
* Accepts all the props of an HTML <a> or <button> tag.
76
*/
@@ -12,27 +11,37 @@ export type ButtonOrLinkProps = {
1211
* Internal links will use react-router.
1312
* External links should start with 'http' or 'https' and will open in a new window.
1413
*/
15-
href?: string,
16-
isDisabled?: boolean,
14+
href?: string;
15+
isDisabled?: boolean;
1716
/**
1817
* Content of the button/link.
1918
* Can be either a string or a complex element.
2019
*/
21-
children: React.ReactNode,
22-
onClick?: (e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
20+
children: React.ReactNode;
21+
onClick?: (
22+
e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>
23+
) => void;
2324
};
2425

25-
export type Ref = HTMLAnchorElement | HTMLButtonElement
26+
export type Ref = HTMLAnchorElement | HTMLButtonElement;
2627

2728
/**
2829
* Helper for switching between <button>, <a>, and <Link>
2930
*/
3031
const ButtonOrLink = React.forwardRef(
3132
(
32-
{ href, children, isDisabled = false, onClick, ...props }: ButtonOrLinkProps,
33+
{
34+
href,
35+
children,
36+
isDisabled = false,
37+
onClick,
38+
...props
39+
}: ButtonOrLinkProps,
3340
ref: React.Ref<Ref>
3441
) => {
35-
const handleClick = (e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {
42+
const handleClick = (
43+
e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>
44+
) => {
3645
if (isDisabled) {
3746
e.preventDefault();
3847
e.stopPropagation();
@@ -47,7 +56,6 @@ const ButtonOrLink = React.forwardRef(
4756
if (href.startsWith('http')) {
4857
return (
4958
<a
50-
// eslint-disable-next-line prettier/prettier -- not able to parse 'as' for some reason
5159
ref={ref as React.Ref<HTMLAnchorElement>}
5260
href={href}
5361
target="_blank"

client/common/IconButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ const ButtonWrapper = styled(Button)`
1212
`;
1313

1414
export type IconProps = {
15-
'aria-label'?: string
15+
'aria-label'?: string;
1616
};
1717

1818
export type IconButtonProps = Omit<
1919
ButtonProps,
2020
'iconBefore' | 'display' | 'focusable'
2121
> & {
22-
icon?: ComponentType<IconProps> | null
22+
icon?: ComponentType<IconProps> | null;
2323
};
2424

2525
const IconButton = ({ icon: Icon, ...otherProps }: IconButtonProps) => (

client/common/RouterTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React, { ReactNode } from 'react';
22
import { NavLink } from 'react-router-dom';
33

44
export type TabProps = {
5-
children: ReactNode,
6-
to: string
5+
children: ReactNode;
6+
to: string;
77
};
88
/**
99
* Wraps the react-router `NavLink` with dashboard-header__tab styling.

client/common/usePrevious.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { useEffect, useRef } from 'react';
77
* @returns The previous value before the current render, or undefined if none.
88
*/
99
export default function usePrevious(value: number): number | undefined {
10-
// eslint-disable-next-line prettier/prettier
1110
const ref = useRef<number>();
1211

1312
useEffect(() => {

client/components/SkipLink.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import classNames from 'classnames';
33
import { useTranslation } from 'react-i18next';
44

55
type SkipLinkProps = {
6-
targetId: string,
7-
text: string
6+
targetId: string;
7+
text: string;
88
};
99

1010
const SkipLink = ({ targetId, text }: SkipLinkProps) => {

0 commit comments

Comments
 (0)