Skip to content

Upgrade eslint and migrate config #4456

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

Merged
merged 3 commits into from
Jan 8, 2025
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
37 changes: 0 additions & 37 deletions .eslintrc

This file was deleted.

52 changes: 52 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import importPlugin from 'eslint-plugin-import';

export default tseslint.config([
{
ignores: [
"**/*.pb.ts",
"**/*.js",
"**/*.mjs"
],
},
{
extends: [
eslint.configs.recommended,
importPlugin.flatConfigs.errors,
importPlugin.flatConfigs.warnings,
tseslint.configs.recommended,
importPlugin.flatConfigs.typescript,
],
rules: {
"import/default": 0,
"import/no-named-as-default-member": 0,
"import/named": 2,
"import/order": [
2,
{
alphabetize: {
order: "asc",
caseInsensitive: true,
},
}
],
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/ban-ts-comment": 0,
"import/no-named-as-default": 0,
"@typescript-eslint/switch-exhaustiveness-check": ["error",
{
"considerDefaultExhaustiveForUnions": true
}],
"import/no-unresolved": 0,
},
languageOptions: {
ecmaVersion: 5,
sourceType: "script",
parserOptions: {
project: "./tsconfig.json",
},
},
}
]);
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@eslint/js": "9.17.0",
"@parcel/babel-preset-env": "^2.13.3",
"@parcel/config-default": "^2.8.3",
"@parcel/core": "^2.13.3",
Expand All @@ -100,12 +101,10 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-is": "^18",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"babel-jest": "^29.7.0",
"babel-plugin-styled-components": "^2.1.4",
"buffer": "^6.0.3",
"eslint": "8.57.1",
"eslint": "9.17.0",
"eslint-plugin-import": "^2.31.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand All @@ -119,6 +118,7 @@
"react-test-renderer": "^18.0.0",
"ts-jest": "^29.2.5",
"typescript": "^5.2.2",
"typescript-eslint": "^8.19.1",
"yarn-audit-fix": "^10.1.1"
},
"alias": {
Expand Down
14 changes: 6 additions & 8 deletions ui/components/AddKustomizationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ type Props = {
loading: boolean;
};

const defaultInitialState = () => ({
name: "",
namespace: "",
source: "",
path: "",
});

type FormState = ReturnType<typeof defaultInitialState>;
type FormState = {
name: "";
namespace: "";
source: "";
path: "";
};

function AddKustomizationForm({
className,
Expand Down
1 change: 0 additions & 1 deletion ui/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line
import { CircularProgress } from "@mui/material";
import MaterialButton, { type ButtonProps } from "@mui/material/Button";
import * as React from "react";
Expand Down
1 change: 0 additions & 1 deletion ui/components/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import WarningIcon from "@mui/icons-material/Warning";
import * as React from "react";
import styled from "styled-components";
import images from "../lib/images";
// eslint-disable-next-line
import { colors, fontSizes, spacing } from "../typedefs/styled";
import Flex from "./Flex";
import ApplicationsIcon from "./NavIcons/ApplicationsIcon";
Expand Down
1 change: 0 additions & 1 deletion ui/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import styled from "styled-components";
import { formatURL } from "../lib/nav";
import { PageRoute, V2Routes } from "../lib/types";
import { Fade } from "../lib/utils";
// eslint-disable-next-line
import { colors } from "../typedefs/styled";

import Flex from "./Flex";
Expand Down
2 changes: 2 additions & 0 deletions ui/components/ReconciliationGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import Spacer from "./Spacer";
// https://github.com/parcel-bundler/parcel/issues/8792
// https://github.com/weaveworks/weave-gitops/issues/3672
// Theory: this is tricking parcel into correctly importing d3. :shrug:
// TODO: Investigate if this can be removed safely via a component upgrade path
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
d3;

interface Props {
Expand Down
1 change: 0 additions & 1 deletion ui/components/Spacer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import styled from "styled-components";
// eslint-disable-next-line
import { spacing } from "../typedefs/styled";

type Spacing = keyof typeof spacing;
Expand Down
1 change: 0 additions & 1 deletion ui/components/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import styled from "styled-components";
// eslint-disable-next-line
import { colors, fontSizes } from "../typedefs/styled";

export interface TextProps {
Expand Down
1 change: 0 additions & 1 deletion ui/lib/fonts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createGlobalStyle } from "styled-components";
// Typescript will handle type-checking/linting for this file
/* eslint-disable */
// @ts-ignore
import ProximaNovaBold from "url:../fonts/ProximaNovaBold.otf";
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class HelmRelease extends FluxObject {
super(response);
try {
this.inventory = response.inventory || [];
} catch (error) {
} catch {
this.inventory = [];
}
}
Expand Down
Loading
Loading