Skip to content

Commit

Permalink
Simplify eslint rules that don't need to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescrowley committed Sep 13, 2024
1 parent 12bb7ac commit 7d64e6c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,13 @@ module.exports = {
// we do not need to import React in every file
"react/react-in-jsx-scope": "off",
"react/jsx-props-no-spreading": "off",
// matter of preference (allows to use props.propName instead of deconstructing props first)
"react/destructuring-assignment": "off",
// allow other than jsx extensions
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx", ".ts", ".tsx"] }],
// --------- Import Plugin Rules ---------
// ensure that all modules that are imported are actually declared in a package.json file
"import/no-extraneous-dependencies": ["error"],
// ensure that all modules that are imported can be resolved to a module on the local filesystem
"import/no-unresolved": [2, { caseSensitive: true }],
// if there is only a single export on a file, it does not have to be a default export
"import/prefer-default-export": "off",
// TODO: enable this rule at some point, we have quite a few circular imports due to type definitions being all over the place.
"import/no-cycle": ["off"],
// ensure consistent use of file extension within the import statements
"import/extensions": [
"error",
Expand Down
15 changes: 10 additions & 5 deletions front/src/components/Form/ShipmentOption.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { chakra } from "@chakra-ui/react";
import { IDropdownOption } from "./SelectField";
import { GroupBase, OptionProps } from "chakra-react-select";

export function ShipmentOption({
isDisabled,
innerProps,
data,
}: {
isDisabled: boolean;
innerProps: object;
data: IDropdownOption;
}) {
}: OptionProps<
IDropdownOption | ((prevState: IDropdownOption) => IDropdownOption),
false,
GroupBase<IDropdownOption | ((prevState: IDropdownOption) => IDropdownOption)>
>) {
if (isDisabled) {
return null;
}
// supporting this scenario is not required
if (data != null && typeof data === "function") {
return null;
}

const [base, organisation] = (data.label as string).split("-").map((part) => part.trim());

Expand Down
2 changes: 1 addition & 1 deletion front/src/components/Table/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function SelectColumnFilter({
column: { render, filterValue, setFilter, preFilteredRows, id },
}: {
column: {
render: (string) => string;
render: (type: "Header" | "Footer" | string, props?: object) => React.ReactNode;
filterValue: any;
setFilter: any;
preFilteredRows: any;
Expand Down
6 changes: 3 additions & 3 deletions front/src/hooks/useAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export function useAuthorization() {

const authorize = ({ requiredAbp, minBeta }: IAuthorizeProps) =>
user &&
(user["https://www.boxtribute.com/roles"].includes("boxtribute_god") ||
((requiredAbp?.every((abp) => user["https://www.boxtribute.com/actions"].includes(abp)) ??
(user["https://www.boxtribute.com/roles"]?.includes("boxtribute_god") ||
((requiredAbp?.every((abp) => user["https://www.boxtribute.com/actions"]?.includes(abp)) ??
true) &&
parseInt(user["https://www.boxtribute.com/beta_user"], 10) >= (minBeta ?? 0)));
parseInt(user["https://www.boxtribute.com/beta_user"] ?? "", 10) >= (minBeta ?? 0)));

return authorize;
}
1 change: 0 additions & 1 deletion shared-components/statviz/utils/analytics/heap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const getHeap = (): IHeap => {
return {
// Note that on production the global heap object is returned
track: (name, event) => {
// eslint-disable-next-line no-console
console.log(`Tracked ${name}, event: ${JSON.stringify(event)}`);
},
};
Expand Down
2 changes: 1 addition & 1 deletion statviz/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Route, Routes } from "react-router-dom";
import Dashboard from "@boxtribute/shared-components/Statviz/Dashboard/Dashboard";
import Dashboard from "@boxtribute/shared-components/statviz/dashboard/Dashboard";

// test precommit
function App() {
Expand Down
2 changes: 1 addition & 1 deletion statviz/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReactDOM from "react-dom/client";
import { ChakraProvider, CSSReset } from "@chakra-ui/react";
import { BrowserRouter } from "react-router-dom";
import { ApolloClient, InMemoryCache, ApolloProvider } from "@apollo/client";
import { theme } from "@boxtribute/shared-components/Utils/theme";
import { theme } from "@boxtribute/shared-components/utils/theme";
import App from "./App";

const client = new ApolloClient({
Expand Down

0 comments on commit 7d64e6c

Please sign in to comment.