Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade eslint and typescript
Browse files Browse the repository at this point in the history
Ben Willenbring committed Jan 16, 2024
1 parent 7679011 commit bdf2a28
Showing 20 changed files with 2,752 additions and 2,143 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -3,4 +3,5 @@ build/
dist/
coverage/
cache
.nx
.nx
.eslintrc.js
15 changes: 9 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { join } = require("path");

module.exports = {
env: {
browser: true,
@@ -8,22 +10,23 @@ module.exports = {
version: "detect",
},
},
parser: "@typescript-eslint/parser",
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"next/core-web-vitals",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"standard-with-typescript",
"plugin:prettier/recommended",
],
overrides: [{ files: ["**/*.ts", "**/*.tsx"] }],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["tsconfig.json"],
},
plugins: ["react", "prettier", "unused-imports"],
plugins: ["react", "prettier", "@typescript-eslint"],
rules: {
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"@typescript-eslint/no-unused-vars": [
"warn",
{ vars: "all", varsIgnorePattern: "^_", args: "after-used", argsIgnorePattern: "^_" },
],
@@ -35,7 +38,6 @@ module.exports = {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/triple-slash-reference": "off",
"padding-line-between-statements": "off",
"@typescript-eslint/padding-line-between-statements": [
@@ -46,6 +48,7 @@ module.exports = {
next: ["interface", "type", "function", "export"],
},
],
"@next/next/no-html-link-for-pages": ["error", join(__dirname, "packages/frontend/src/pages")],
"prettier/prettier": "warn",
},
};
4,734 changes: 2,667 additions & 2,067 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -34,18 +34,15 @@
"@commitlint/config-conventional": "^18.4.4",
"@playwright/test": "^1.40.1",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"all-contributors-cli": "^6.26.1",
"eslint": "^8.56.0",
"eslint-config-next": "^14.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^33.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^2.0.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"lint-staged": "^15.2.0",
18 changes: 10 additions & 8 deletions packages/frontend/src/common/components/FlexBox.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { Box, BoxProps } from "@mui/material";
import React from "react";
import React, { Ref } from "react";

interface FlexBoxProps extends BoxProps {
children?: React.ReactNode;
}

export const FlexBox = React.forwardRef(({ children, ...props }: FlexBoxProps, ref: any) => {
return (
<Box {...props} ref={ref} display="flex">
{children}
</Box>
);
});
export const FlexBox = React.forwardRef(
({ children, ...props }: FlexBoxProps, ref: Ref<HTMLElement>) => {
return (
<Box {...props} ref={ref} display="flex">
{children}
</Box>
);
},
);
Original file line number Diff line number Diff line change
@@ -7,15 +7,15 @@ interface SettingsButtonProps {
}

export function SettingsButton({ children }: SettingsButtonProps) {
const [anchorEl, setAnchorEl] = useState(null);
const [anchorEl, setAnchorEl] = useState<Element>();
const open = Boolean(anchorEl);

const handleSettings = (event: any) => {
const handleSettings = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
setAnchorEl(event.currentTarget);
};

const handleClose = () => {
setAnchorEl(null);
setAnchorEl(undefined);
};

return (
4 changes: 2 additions & 2 deletions packages/frontend/src/home/components/WelcomeTypewriter.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Typography } from "@mui/material";
import Typewriter from "typewriter-effect";
import Typewriter, { TypewriterClass } from "typewriter-effect";
import React from "react";

export function WelcomeTypewriter() {
return (
<Typography variant="h2" m={2} zIndex={2}>
<Typewriter
onInit={(typewriter: any) => {
onInit={(typewriter: TypewriterClass) => {
typewriter.start();
}}
options={{
2 changes: 1 addition & 1 deletion packages/frontend/src/poker/components/PokerVoteSlider.tsx
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import { PokerNaturalNumbersSlider } from "./sliders/PokerNaturalNumbersSlider";
import { PokerTShirtSlider } from "./sliders/PokerTShirtSlider";

interface PokerVoteSliderProps {
onSliderChange: (event: any, newValue: number | number[]) => void;
onSliderChange: (event: Event, newValue: number | number[]) => void;
}

export function PokerVoteSlider({ onSliderChange }: PokerVoteSliderProps) {
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import React from "react";
import React, { Ref, PropsWithChildren } from "react";
import { Build } from "@mui/icons-material";
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
import { useUserContext } from "../../../common/context/UserContext";
import { isModerator } from "../../../common/utils/participantsUtils";
import { EstimationUnitSetupDialog } from "../dialogs/EstimationUnitSetupDialog";
import { useDialog } from "../../../common/hooks/useDialog";

export const EstimationUnitSetupMenuItem = React.forwardRef((_props: any, ref: any) => {
const { user } = useUserContext();
const { isOpen, closeDialog, openDialog } = useDialog(false);
export const EstimationUnitSetupMenuItem = React.forwardRef(
(_: PropsWithChildren, ref: Ref<HTMLLIElement>) => {
const { user } = useUserContext();
const { isOpen, closeDialog, openDialog } = useDialog(false);

return (
<>
<MenuItem
ref={ref}
aria-label="Change Poker Unit"
onClick={openDialog}
disabled={!isModerator(user)}
>
<ListItemIcon>
<Build fontSize="small" />
</ListItemIcon>
<ListItemText primary="Change Poker Unit" />
</MenuItem>
<EstimationUnitSetupDialog close={closeDialog} isOpen={isOpen} />
</>
);
});
return (
<>
<MenuItem
ref={ref}
aria-label="Change Poker Unit"
onClick={openDialog}
disabled={!isModerator(user)}
>
<ListItemIcon>
<Build fontSize="small" />
</ListItemIcon>
<ListItemText primary="Change Poker Unit" />
</MenuItem>
<EstimationUnitSetupDialog close={closeDialog} isOpen={isOpen} />
</>
);
},
);
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ export function PokerVoteDialog({ isOpen, close }: DialogProps) {
const { handleSendVote } = usePokerContext();
const { user } = useUserContext();

function handleSliderChange(event: any, newValue: number | number[]) {
function handleSliderChange(event: Event, newValue: number | number[]) {
const vote = Array.isArray(newValue) ? newValue[0] : newValue;
setVote(vote ?? 0);
}
Original file line number Diff line number Diff line change
@@ -4,22 +4,22 @@ import { getFibonacciMarks } from "../../utils/pokerUtils";

interface PokerFibonacciSliderProps {
maxValue: number;
onChange: (event: any, newValue: number | number[]) => void;
onChange: (event: Event, newValue: number | number[]) => void;
valueText: (value: number) => string;
}

export function PokerFibonacciSlider(props: PokerFibonacciSliderProps) {
export function PokerFibonacciSlider({ onChange, valueText, maxValue }: PokerFibonacciSliderProps) {
return (
<Slider
defaultValue={0}
onChange={props.onChange}
getAriaValueText={props.valueText}
onChange={onChange}
getAriaValueText={valueText}
aria-labelledby="vote-slider-label"
step={null}
valueLabelDisplay="auto"
marks={getFibonacciMarks(props.maxValue)}
marks={getFibonacciMarks(maxValue)}
min={0}
max={props.maxValue}
max={maxValue}
/>
);
}
Original file line number Diff line number Diff line change
@@ -3,19 +3,23 @@ import { Slider } from "@mui/material";

interface PokerNaturalNumbersSliderProps {
maxValue: number;
onChange: (event: any, newValue: number | number[]) => void;
onChange: (event: Event, newValue: number | number[]) => void;
valueText: (value: number) => string;
}

export function PokerNaturalNumbersSlider(props: PokerNaturalNumbersSliderProps) {
export function PokerNaturalNumbersSlider({
onChange,
valueText,
maxValue,
}: PokerNaturalNumbersSliderProps) {
return (
<Slider
defaultValue={0}
onChange={props.onChange}
getAriaValueText={props.valueText}
onChange={onChange}
getAriaValueText={valueText}
aria-labelledby="vote-slider-label"
valueLabelDisplay="auto"
max={props.maxValue}
max={maxValue}
/>
);
}
Original file line number Diff line number Diff line change
@@ -3,14 +3,14 @@ import { Slider } from "@mui/material";
import { getTShirtSizesMarks } from "../../utils/pokerUtils";

interface PokerTShirtSliderProps {
onChange: (event: any, newValue: number | number[]) => void;
onChange: (event: Event, newValue: number | number[]) => void;
}

export function PokerTShirtSlider(props: PokerTShirtSliderProps) {
export function PokerTShirtSlider({ onChange }: PokerTShirtSliderProps) {
return (
<Slider
defaultValue={0}
onChange={props.onChange}
onChange={onChange}
aria-labelledby="vote-slider-label"
step={null}
marks={getTShirtSizesMarks()}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { Ref } from "react";
import { BlurOff, BlurOn } from "@mui/icons-material";
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
import { RetroColumn } from "../../../types/retroTypes";
@@ -11,7 +11,7 @@ interface BlurColumnMenuItemProperties {
}

export const BlurColumnMenuItem = React.forwardRef(
({ column }: BlurColumnMenuItemProperties, ref: any) => {
({ column }: BlurColumnMenuItemProperties, ref: Ref<HTMLLIElement>) => {
const { handleToggleColumnBlur } = useRetroContext();
const { user } = useUserContext();

Original file line number Diff line number Diff line change
@@ -15,17 +15,17 @@ interface ColumnMenuProps {
}

export function ColumnMenu({ column }: ColumnMenuProps) {
const [anchorEl, setAnchorEl] = useState(null);
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>();
const { user } = useUserContext();

if (!isModerator(user)) return null;

function openMenu(event: any) {
function openMenu(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {
setAnchorEl(event.currentTarget);
}

function closeMenu() {
setAnchorEl(null);
setAnchorEl(undefined);
}

const open = Boolean(anchorEl);
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ interface DeleteColumnMenuItemProps {
}

export const DeleteColumnMenuItem = React.forwardRef(
({ columnIndex }: DeleteColumnMenuItemProps, ref: any) => {
({ columnIndex }: DeleteColumnMenuItemProps, ref: React.Ref<HTMLLIElement>) => {
const { isOpen, closeDialog, openDialog } = useDialog();

return (
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { Ref } from "react";
import { Edit } from "@mui/icons-material";
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
import { EditColumnDialog } from "../../dialogs/EditColumnDialog";
@@ -10,7 +10,7 @@ interface EditColumnMenuItemProps {
}

export const EditColumnMenuItem = React.forwardRef(
({ column }: EditColumnMenuItemProps, ref: any) => {
({ column }: EditColumnMenuItemProps, ref: Ref<HTMLLIElement>) => {
const { isOpen, closeDialog, openDialog } = useDialog();

return (
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { Ref } from "react";
import { Sort } from "@mui/icons-material";
import { ListItemIcon, ListItemText, MenuItem } from "@mui/material";
import { RetroColumn } from "../../../types/retroTypes";
@@ -9,7 +9,7 @@ interface SortColumnMenuItemProps {
}

export const SortColumnMenuItem = React.forwardRef(
({ column }: SortColumnMenuItemProps, ref: any) => {
({ column }: SortColumnMenuItemProps, ref: Ref<HTMLLIElement>) => {
const { handleSortCardsByVotesDescending } = useRetroContext();

function sortByVotesDescending() {
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ export function ManageVotesDialog({ isOpen, close }: DialogProps) {
close();
}

function handleVoteCountChange(event: any, newValue: number | number[]) {
function handleVoteCountChange(event: Event, newValue: number | number[]) {
setVoteCount(newValue as number);
}

4 changes: 2 additions & 2 deletions packages/shared/browserlogger/src/BrowserLogger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LogLevel } from "@shared/configuration";

export type LogFn = (message?: any, ...optionalParams: any[]) => void;
export type LogFn = (message?: unknown, ...optionalParams: unknown[]) => void;

export interface Logger {
debug: LogFn;
@@ -13,7 +13,7 @@ export interface BrowserLoggerOptions {
level?: LogLevel;
}

const NO_OP: LogFn = (_message?: any, ..._optionalParams: any[]) => {};
const NO_OP: LogFn = (_message?: unknown, ..._optionalParams: unknown[]) => {};

export class BrowserLogger implements Logger {
readonly debug: LogFn;

0 comments on commit bdf2a28

Please sign in to comment.