Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/modify e slint rule #1328

Merged
merged 2 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"rules": {
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"react/jsx-props-no-spreading": "warn",
"react/jsx-props-no-spreading": "off",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the clean up!

"react/require-default-props": "off",
"import/prefer-default-export": "off",
"react/prop-types": "warn",
Expand Down
1 change: 0 additions & 1 deletion src/assets/icons/BxCopy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
export const BxCopy = (props: React.SVGProps<SVGSVGElement>): JSX.Element => {
return (
<svg
Expand Down
1 change: 0 additions & 1 deletion src/assets/icons/BxLifeBuoy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
export const BxLifeBuoy = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
Expand Down
1 change: 0 additions & 1 deletion src/assets/icons/BxsClearRocket.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
export const BxsClearRocket = (
props: React.SVGProps<SVGSVGElement>
): JSX.Element => {
Expand Down
1 change: 0 additions & 1 deletion src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import {
Box,
BoxProps,
Expand Down
1 change: 0 additions & 1 deletion src/components/DisplayCard/DisplayCard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import {
Box,
Divider,
Expand Down
1 change: 0 additions & 1 deletion src/components/MediaSettingsModal/MediaSettingsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export const MediaSettingsModal = ({
<FormTitle>File name</FormTitle>
<FormField
placeholder="File name"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("name")}
id="name"
/>
Expand Down
3 changes: 0 additions & 3 deletions src/components/PageSettingsModal/PageSettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ export const PageSettingsModal = ({
<Input
placeholder="Page title"
id="title"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("title", { required: true })}
/>
<FormErrorMessage>{errors.title?.message}</FormErrorMessage>
Expand All @@ -173,7 +172,6 @@ export const PageSettingsModal = ({
</FormLabel.Description>
</Box>
<Input
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("permalink", { required: true })}
id="permalink"
placeholder="Page URL"
Expand All @@ -196,7 +194,6 @@ export const PageSettingsModal = ({
<Input
placeholder="Meta Description (Optional)"
id="description"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("description")}
/>
<FormErrorMessage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ export const ResourcePageSettingsModal = ({
<FormLabel mb={0}>Resource Type</FormLabel>
</Box>
<Select
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("layout", { required: true })}
id="layout"
value={watch("layout")}
Expand All @@ -268,7 +267,6 @@ export const ResourcePageSettingsModal = ({
<Input
placeholder="Page title"
id="title"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("title", { required: true })}
/>
<FormErrorMessage>{errors.title?.message}</FormErrorMessage>
Expand All @@ -289,7 +287,6 @@ export const ResourcePageSettingsModal = ({
</FormLabel.Description>
</Box>
<Input
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("permalink", { required: true })}
id="permalink"
placeholder="Page URL"
Expand All @@ -310,7 +307,6 @@ export const ResourcePageSettingsModal = ({
</FormLabel.Description>
</Box>
<Input
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("date", { required: true })}
id="date"
placeholder="Date (YYYY-MM-DD)"
Expand Down Expand Up @@ -362,7 +358,6 @@ export const ResourcePageSettingsModal = ({
<Input
placeholder="Meta Description (Optional)"
id="description"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("description")}
/>
<FormErrorMessage>
Expand Down
1 change: 0 additions & 1 deletion src/components/contact-us/Section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const EditorSection = ({
<>
<Droppable droppableId={sectionId} type={sectionId}>
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
3 changes: 0 additions & 3 deletions src/components/folders/ReorderingModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ const ReorderingModal = ({ params, dirData, onProceed, onClose }) => {
<div
className={`${contentStyles.contentContainerFolderColumn} mb-5`}
ref={droppableProvided.innerRef}
// eslint-disable-next-line react/jsx-props-no-spreading
{...droppableProvided.droppableProps}
>
{dirOrder.map((folderContentItem, folderContentIndex) => (
Expand All @@ -102,9 +101,7 @@ const ReorderingModal = ({ params, dirData, onProceed, onClose }) => {
>
{(draggableProvided) => (
<div
// eslint-disable-next-line react/jsx-props-no-spreading
{...draggableProvided.draggableProps}
// eslint-disable-next-line react/jsx-props-no-spreading
{...draggableProvided.dragHandleProps}
ref={draggableProvided.innerRef}
>
Expand Down
1 change: 0 additions & 1 deletion src/components/homepage/HeroDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ const HeroDropdown = ({
</FormContext>
<Droppable droppableId="dropdownelem" type="dropdownelem">
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
1 change: 0 additions & 1 deletion src/components/homepage/HeroSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ const EditorHeroSection = ({
/>
<Droppable droppableId="highlight" type="highlight">
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
1 change: 0 additions & 1 deletion src/components/media/MediaAltText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export const MediaAltText = ({ onProceed, onClose, type }) => {
*/}
<FormField
placeholder={formTitle}
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("altText")}
id="altText"
/>
Expand Down
1 change: 0 additions & 1 deletion src/components/navbar/NavSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ const NavSection = ({
<>
<Droppable droppableId="link" type="link">
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
1 change: 0 additions & 1 deletion src/components/navbar/NavSublinkSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const NavSublinkSection = ({
}) => (
<Droppable droppableId={`sublink-${linkIndex}`} type="sublink">
{(droppableProvided) => (
/* eslint-disable react/jsx-props-no-spreading */
<div
className={styles.card}
ref={droppableProvided.innerRef}
Expand Down
1 change: 0 additions & 1 deletion src/layouts/EditContactUs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import { validateContactType, validateLocationType } from "utils/validators"

import { DEFAULT_RETRY_MSG, isEmpty } from "utils"

/* eslint-disable react/jsx-props-no-spreading */
/* eslint-disable react/no-array-index-key */

// Constants
Expand Down
1 change: 0 additions & 1 deletion src/layouts/EditHomepage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {

import { DEFAULT_RETRY_MSG } from "utils"

/* eslint-disable react/jsx-props-no-spreading */
/* eslint-disable react/no-array-index-key */

// Constants
Expand Down
2 changes: 0 additions & 2 deletions src/layouts/ResourceRoom/ResourceRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ const EmptyResourceRoom = () => {
<Input
marginTop={5}
placeholder="Resource room name"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("newDirectoryName", {
required: "Please enter resource room name",
})}
Expand Down Expand Up @@ -362,7 +361,6 @@ const ResourceRoomContent = ({
<FormLabel>Resource room title</FormLabel>
<Input
placeholder="New resource room name"
// eslint-disable-next-line react/jsx-props-no-spreading
{...register("newDirectoryName", {
required:
"Please ensure that you have entered a resource room name!",
Expand Down
1 change: 0 additions & 1 deletion src/layouts/SiteLaunchPad/SiteLaunchPad.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import {
Modal,
ModalOverlay,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import {
Box,
Center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import { Box, Button, Icon, Text, RadioGroup } from "@chakra-ui/react"
import { Input, Radio } from "@opengovsg/design-system-react"
import { useState } from "react"
Expand Down
1 change: 0 additions & 1 deletion src/layouts/components/CreateButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const CreateButton = forwardRef<ButtonProps, "button">(
return (
<Button
variant="outline"
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...props}
ref={ref}
iconSpacing="0.5rem"
Expand Down
1 change: 0 additions & 1 deletion src/layouts/components/Section/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-props-no-spreading */
import { VStack, StackProps } from "@chakra-ui/react"

// eslint-disable-next-line import/prefer-default-export
Expand Down
1 change: 0 additions & 1 deletion src/layouts/components/Section/SectionCaption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const SectionCaption = ({
<Text textStyle="subhead-3" as="span">
{label}
</Text>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<Text textStyle="body-2" as="span" {...rest} />
</Text>
</HStack>
Expand Down
2 changes: 0 additions & 2 deletions src/layouts/layouts/SiteEditLayout/SiteEditLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const GRID_LAYOUT: Pick<
export const SiteEditLayout = ({ children }: StackProps): JSX.Element => {
return (
<>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<Grid {...GRID_LAYOUT}>
<GridItem
area="header"
Expand Down Expand Up @@ -67,7 +66,6 @@ export const SiteEditContent = ({
w="100%"
h="100%"
divider={<StackDivider borderColor="border.divider.alt" />}
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
>
{children}
Expand Down
2 changes: 0 additions & 2 deletions src/layouts/layouts/SiteViewLayout/SiteViewLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const GRID_LAYOUT: Pick<
export const SiteViewLayout = ({ children }: StackProps): JSX.Element => {
return (
<>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<Grid {...GRID_LAYOUT}>
<GridItem
area="header"
Expand Down Expand Up @@ -53,7 +52,6 @@ export const SiteViewContent = ({
w="100%"
h="100%"
divider={<StackDivider borderColor="border.divider.alt" />}
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
>
{children}
Expand Down
6 changes: 1 addition & 5 deletions src/routing/ProtectedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const ProtectedRoute = ({
if (displayedName && WrappedComponent) {
return (
<Route
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
render={(props) => {
const { match } = props
Expand All @@ -49,10 +48,7 @@ export const ProtectedRoute = ({
...match,
decodedParams: getDecodedParams(prune(params)),
}
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<WrappedComponent {...rest} {...props} match={newMatch} />
)
return <WrappedComponent {...rest} {...props} match={newMatch} />
}}
/>
)
Expand Down
1 change: 0 additions & 1 deletion src/routing/ProtectedRouteWithProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type RouteProps = {
export const ProtectedRouteWithProps = (props: RouteProps): JSX.Element => {
return (
<Sentry.ErrorBoundary fallback={FallbackComponent}>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<ProtectedRoute {...props} />
</Sentry.ErrorBoundary>
)
Expand Down
1 change: 0 additions & 1 deletion src/routing/RedirectIfLoggedInRoute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export default function RedirectIfLoggedInRoute({
<Redirect to="/sites" />
) : (
children ||
// eslint-disable-next-line react/jsx-props-no-spreading
(WrappedComponent && <Route {...rest} component={WrappedComponent} />)
)
}