Skip to content

Commit 3209870

Browse files
authored
Merge pull request #4456 from erikgb/eslint
Upgrade eslint and migrate config
2 parents 4737022 + a76587d commit 3209870

13 files changed

+354
-316
lines changed

.eslintrc

Lines changed: 0 additions & 37 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
import importPlugin from 'eslint-plugin-import';
4+
5+
export default tseslint.config([
6+
{
7+
ignores: [
8+
"**/*.pb.ts",
9+
"**/*.js",
10+
"**/*.mjs"
11+
],
12+
},
13+
{
14+
extends: [
15+
eslint.configs.recommended,
16+
importPlugin.flatConfigs.errors,
17+
importPlugin.flatConfigs.warnings,
18+
tseslint.configs.recommended,
19+
importPlugin.flatConfigs.typescript,
20+
],
21+
rules: {
22+
"import/default": 0,
23+
"import/no-named-as-default-member": 0,
24+
"import/named": 2,
25+
"import/order": [
26+
2,
27+
{
28+
alphabetize: {
29+
order: "asc",
30+
caseInsensitive: true,
31+
},
32+
}
33+
],
34+
"@typescript-eslint/explicit-module-boundary-types": 0,
35+
"@typescript-eslint/no-explicit-any": 0,
36+
"@typescript-eslint/ban-ts-comment": 0,
37+
"import/no-named-as-default": 0,
38+
"@typescript-eslint/switch-exhaustiveness-check": ["error",
39+
{
40+
"considerDefaultExhaustiveForUnions": true
41+
}],
42+
"import/no-unresolved": 0,
43+
},
44+
languageOptions: {
45+
ecmaVersion: 5,
46+
sourceType: "script",
47+
parserOptions: {
48+
project: "./tsconfig.json",
49+
},
50+
},
51+
}
52+
]);

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
},
8585
"devDependencies": {
8686
"@babel/core": "^7.26.0",
87+
"@eslint/js": "9.17.0",
8788
"@parcel/babel-preset-env": "^2.13.3",
8889
"@parcel/config-default": "^2.8.3",
8990
"@parcel/core": "^2.13.3",
@@ -100,12 +101,10 @@
100101
"@types/react": "^18.0.0",
101102
"@types/react-dom": "^18.0.0",
102103
"@types/react-is": "^18",
103-
"@typescript-eslint/eslint-plugin": "^6.6.0",
104-
"@typescript-eslint/parser": "^6.6.0",
105104
"babel-jest": "^29.7.0",
106105
"babel-plugin-styled-components": "^2.1.4",
107106
"buffer": "^6.0.3",
108-
"eslint": "8.57.1",
107+
"eslint": "9.17.0",
109108
"eslint-plugin-import": "^2.31.0",
110109
"jest": "^29.7.0",
111110
"jest-environment-jsdom": "^29.7.0",
@@ -119,6 +118,7 @@
119118
"react-test-renderer": "^18.0.0",
120119
"ts-jest": "^29.2.5",
121120
"typescript": "^5.2.2",
121+
"typescript-eslint": "^8.19.1",
122122
"yarn-audit-fix": "^10.1.1"
123123
},
124124
"alias": {

ui/components/AddKustomizationForm.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ type Props = {
2121
loading: boolean;
2222
};
2323

24-
const defaultInitialState = () => ({
25-
name: "",
26-
namespace: "",
27-
source: "",
28-
path: "",
29-
});
30-
31-
type FormState = ReturnType<typeof defaultInitialState>;
24+
type FormState = {
25+
name: "";
26+
namespace: "";
27+
source: "";
28+
path: "";
29+
};
3230

3331
function AddKustomizationForm({
3432
className,

ui/components/Button.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line
21
import { CircularProgress } from "@mui/material";
32
import MaterialButton, { type ButtonProps } from "@mui/material/Button";
43
import * as React from "react";

ui/components/Icon.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import WarningIcon from "@mui/icons-material/Warning";
3737
import * as React from "react";
3838
import styled from "styled-components";
3939
import images from "../lib/images";
40-
// eslint-disable-next-line
4140
import { colors, fontSizes, spacing } from "../typedefs/styled";
4241
import Flex from "./Flex";
4342
import ApplicationsIcon from "./NavIcons/ApplicationsIcon";

ui/components/Nav.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import styled from "styled-components";
66
import { formatURL } from "../lib/nav";
77
import { PageRoute, V2Routes } from "../lib/types";
88
import { Fade } from "../lib/utils";
9-
// eslint-disable-next-line
109
import { colors } from "../typedefs/styled";
1110

1211
import Flex from "./Flex";

ui/components/ReconciliationGraph.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import Spacer from "./Spacer";
1414
// https://github.com/parcel-bundler/parcel/issues/8792
1515
// https://github.com/weaveworks/weave-gitops/issues/3672
1616
// Theory: this is tricking parcel into correctly importing d3. :shrug:
17+
// TODO: Investigate if this can be removed safely via a component upgrade path
18+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
1719
d3;
1820

1921
interface Props {

ui/components/Spacer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import styled from "styled-components";
2-
// eslint-disable-next-line
32
import { spacing } from "../typedefs/styled";
43

54
type Spacing = keyof typeof spacing;

ui/components/Text.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import styled from "styled-components";
2-
// eslint-disable-next-line
32
import { colors, fontSizes } from "../typedefs/styled";
43

54
export interface TextProps {

ui/lib/fonts.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createGlobalStyle } from "styled-components";
22
// Typescript will handle type-checking/linting for this file
3-
/* eslint-disable */
43
// @ts-ignore
54
import ProximaNovaBold from "url:../fonts/ProximaNovaBold.otf";
65
// @ts-ignore

ui/lib/objects.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export class HelmRelease extends FluxObject {
262262
super(response);
263263
try {
264264
this.inventory = response.inventory || [];
265-
} catch (error) {
265+
} catch {
266266
this.inventory = [];
267267
}
268268
}

0 commit comments

Comments
 (0)