fix: upgrade eslint

This commit is contained in:
Jannis Mattheis 2025-08-03 18:04:44 +02:00
parent edddfc9d9c
commit 734113d187
14 changed files with 650 additions and 1050 deletions

View File

@ -1,2 +0,0 @@
src/setupTests.ts
src/registerServiceWorker.ts

View File

@ -1,91 +0,0 @@
---
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- plugin:react/recommended
- plugin:import/errors
- plugin:import/typescript
- plugin:jest/recommended
- prettier
env:
browser: true
es6: true
node: true
parser: "@typescript-eslint/parser"
parserOptions:
project: tsconfig.json
sourceType: module
plugins:
- "@typescript-eslint"
- react
- import
- unicorn
settings:
react:
version: detect
rules:
consistent-return: error
default-case: error
default-param-last: error
no-loop-func: off
arrow-body-style: [error, as-needed]
import/no-useless-path-segments: error
import/group-exports: off
import/extensions: [error, never]
import/no-duplicates: error
import/first: error
import/no-unused-modules: error
unicorn/no-abusive-eslint-disable: off
unicorn/no-array-instanceof: error
unicorn/no-unreadable-array-destructuring: error
unicorn/no-zero-fractions: error
react/jsx-key: error
react/jsx-pascal-case: error
react/destructuring-assignment: off
react/function-component-definition: off
react/no-array-index-key: error
react/no-deprecated: off
react/no-string-refs: error
react/no-this-in-sfc: error
react/no-typos: error
react/no-unknown-property: error
react/prefer-stateless-function: off
react/prop-types: off
jest/expect-expect: off
jest/no-jasmine-globals: off
"@typescript-eslint/require-await": off
"@typescript-eslint/restrict-template-expressions": off
"@typescript-eslint/array-type": [error, {default: array-simple}]
"@typescript-eslint/await-thenable": error
"@typescript-eslint/no-unused-vars": error
"@typescript-eslint/no-use-before-define": off
"@typescript-eslint/no-unsafe-call": off
"@typescript-eslint/consistent-type-assertions": [error, {assertionStyle: as}]
"@typescript-eslint/no-extra-non-null-assertion": error
"@typescript-eslint/no-inferrable-types": error
"@typescript-eslint/no-this-alias": error
"@typescript-eslint/no-throw-literal": error
"@typescript-eslint/no-non-null-assertion": off
"@typescript-eslint/prefer-nullish-coalescing": error
"@typescript-eslint/prefer-optional-chain": error
"@typescript-eslint/prefer-readonly": off
"@typescript-eslint/unbound-method": error
"@typescript-eslint/no-empty-function": off
"@typescript-eslint/explicit-module-boundary-types": off
"@typescript-eslint/ban-ts-comment": off
"@typescript-eslint/no-floating-promises": off
"@typescript-eslint/no-unsafe-member-access": off
"@typescript-eslint/no-unsafe-return": off
"@typescript-eslint/no-unsafe-assignment": off
"@typescript-eslint/restrict-plus-operands": off
"@typescript-eslint/no-misused-promises": off
"@typescript-eslint/no-explicit-any": error

6
ui/eslint.config.mjs Normal file
View File

@ -0,0 +1,6 @@
// @ts-check
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended);

View File

@ -41,6 +41,7 @@
"testformat": "prettier \"src/**/*.{ts,tsx}\" --list-different"
},
"devDependencies": {
"@eslint/js": "^9.32.0",
"@types/codemirror": "5.60.0",
"@types/detect-browser": "^4.0.0",
"@types/get-port": "^4.0.0",
@ -53,25 +54,16 @@
"@types/react-router-dom": "^5.1.7",
"@types/remove-markdown": "^0.3.0",
"@types/rimraf": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-prefer-arrow": "^1.2.2",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-unicorn": "^21.0.0",
"eslint": "^9.32.0",
"get-port": "^5.1.1",
"prettier": "^2.3.1",
"puppeteer": "^17.1.3",
"rimraf": "^3.0.2",
"tree-kill": "^1.2.0",
"typescript": "^5.9.2",
"typescript-eslint": "^8.38.0",
"wait-on": "^5.3.0"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",

View File

@ -73,7 +73,6 @@ export class CurrentUser {
url: config.get('url') + 'client',
method: 'POST',
data: {name},
// eslint-disable-next-line @typescript-eslint/naming-convention
headers: {Authorization: 'Basic ' + btoa(username + ':' + password)},
})
.then((resp: AxiosResponse<IClient>) => {
@ -97,41 +96,38 @@ export class CurrentUser {
return Promise.reject();
}
return (
axios
.create()
// eslint-disable-next-line @typescript-eslint/naming-convention
.get(config.get('url') + 'current/user', {headers: {'X-Gotify-Key': this.token()}})
.then((passThrough) => {
this.user = passThrough.data;
this.loggedIn = true;
this.authenticating = false;
this.connectionErrorMessage = null;
this.reconnectTime = 7500;
return passThrough;
})
.catch((error: AxiosError) => {
this.authenticating = false;
if (!error || !error.response) {
this.connectionError('No network connection or server unavailable.');
return Promise.reject(error);
}
if (error.response.status >= 500) {
this.connectionError(
`${error.response.statusText} (code: ${error.response.status}).`
);
return Promise.reject(error);
}
this.connectionErrorMessage = null;
if (error.response.status >= 400 && error.response.status < 500) {
this.logout();
}
return axios
.create()
.get(config.get('url') + 'current/user', {headers: {'X-Gotify-Key': this.token()}})
.then((passThrough) => {
this.user = passThrough.data;
this.loggedIn = true;
this.authenticating = false;
this.connectionErrorMessage = null;
this.reconnectTime = 7500;
return passThrough;
})
.catch((error: AxiosError) => {
this.authenticating = false;
if (!error || !error.response) {
this.connectionError('No network connection or server unavailable.');
return Promise.reject(error);
})
);
}
if (error.response.status >= 500) {
this.connectionError(
`${error.response.statusText} (code: ${error.response.status}).`
);
return Promise.reject(error);
}
this.connectionErrorMessage = null;
if (error.response.status >= 400 && error.response.status < 500) {
this.logout();
}
return Promise.reject(error);
});
};
public logout = async () => {

View File

@ -6,7 +6,6 @@ export interface IConfig {
version: IVersion;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declare global {
interface Window {
config?: Partial<IConfig>;

View File

@ -25,8 +25,7 @@ export type Stores<T extends AllStores> = Pick<StoreMapping, T>;
export const inject =
<I extends AllStores>(...stores: I[]) =>
// eslint-disable-next-line @typescript-eslint/ban-types
<P extends {}>(
<P extends object>(
node: React.ComponentType<P>
): React.ComponentType<Pick<P, Exclude<keyof P, I>>> =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any

View File

@ -30,6 +30,7 @@ const styles = (theme: Theme) =>
minHeight: '100%',
height: '100vh',
},
// eslint-disable-next-line
toolbar: theme.mixins.toolbar as any,
link: {
color: 'inherit',

View File

@ -211,7 +211,6 @@ class ConfigurerPanel extends Component<IConfigurerPanelProps, {unsavedChanges:
className="config-save"
onClick={() => {
const newConfig = this.state.unsavedChanges;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.props.save(newConfig!).then(() => {
this.setState({unsavedChanges: null});
});

View File

@ -99,7 +99,6 @@ describe('Client', () => {
expect(await count(page, $table.rows())).toBe(2);
});
// eslint-disable-next-line
it('deletes own client', async () => {
await page.click($table.cell(1, Col.Delete, '.delete'));

View File

@ -17,7 +17,6 @@ beforeAll(async () => {
afterAll(async () => await gotify.close());
// eslint-disable-next-line
const axiosAuth = {auth: {username: 'admin', password: 'admin'}};
let windowsServerToken: string;
@ -36,7 +35,6 @@ const navigate = async (appName: string) => {
await waitForExists(page, selector.heading(), appName);
};
// eslint-disable-next-line
describe('Messages', () => {
it('does login', async () => await auth.login(page));
it('is on messages', async () => {

View File

@ -4,7 +4,7 @@ import rimraf from 'rimraf';
import path from 'path';
import puppeteer, {Browser, Page} from 'puppeteer';
import fs from 'fs';
// @ts-ignore
// @ts-expect-error no types
import wait from 'wait-on';
import kill from 'tree-kill';

View File

@ -1,3 +1,4 @@
// eslint-disable-next-line
import Notify = require('notifyjs');
export as namespace notifyjs;
export = Notify;

File diff suppressed because it is too large Load Diff