mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 17:48:30 +02:00
Upgrade eslint and fix issues
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
dist/
|
|
||||||
.eslintrc.cjs
|
|
||||||
.prettierrc.cjs
|
|
||||||
src-web/postcss.config.cjs
|
|
||||||
src-web/vite.config.ts
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:react/recommended',
|
|
||||||
'plugin:react-hooks/recommended',
|
|
||||||
'plugin:import/recommended',
|
|
||||||
'plugin:jsx-a11y/recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'eslint-config-prettier',
|
|
||||||
],
|
|
||||||
plugins: ['react-refresh'],
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
project: ['./tsconfig.json'],
|
|
||||||
},
|
|
||||||
ignorePatterns: [
|
|
||||||
'scripts/**/*',
|
|
||||||
'packages/plugin-runtime/**/*',
|
|
||||||
'packages/plugin-runtime-types/**/*',
|
|
||||||
'src-tauri/**/*',
|
|
||||||
'src-web/tailwind.config.cjs',
|
|
||||||
'src-web/vite.config.ts',
|
|
||||||
],
|
|
||||||
settings: {
|
|
||||||
react: {
|
|
||||||
version: 'detect',
|
|
||||||
},
|
|
||||||
'import/resolver': {
|
|
||||||
node: {
|
|
||||||
paths: ['src-web'],
|
|
||||||
extensions: ['.ts', '.tsx'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
'react-refresh/only-export-components': 'error',
|
|
||||||
'jsx-a11y/no-autofocus': 'off',
|
|
||||||
'react/react-in-jsx-scope': 'off',
|
|
||||||
'import/no-unresolved': 'off',
|
|
||||||
'@typescript-eslint/consistent-type-imports': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
prefer: 'type-imports',
|
|
||||||
disallowTypeAnnotations: true,
|
|
||||||
fixStyle: 'separate-type-imports',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
88
eslint.config.cjs
Normal file
88
eslint.config.cjs
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
const { defineConfig, globalIgnores } = require('eslint/config');
|
||||||
|
|
||||||
|
const { fixupConfigRules } = require('@eslint/compat');
|
||||||
|
|
||||||
|
const reactRefresh = require('eslint-plugin-react-refresh');
|
||||||
|
const tsParser = require('@typescript-eslint/parser');
|
||||||
|
const js = require('@eslint/js');
|
||||||
|
|
||||||
|
const { FlatCompat } = require('@eslint/eslintrc');
|
||||||
|
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all,
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = defineConfig([
|
||||||
|
{
|
||||||
|
extends: fixupConfigRules(
|
||||||
|
compat.extends(
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:react/recommended',
|
||||||
|
'plugin:react-hooks/recommended',
|
||||||
|
'plugin:import/recommended',
|
||||||
|
'plugin:jsx-a11y/recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'eslint-config-prettier',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
'react-refresh': reactRefresh,
|
||||||
|
},
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.json'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: 'detect',
|
||||||
|
},
|
||||||
|
|
||||||
|
'import/resolver': {
|
||||||
|
node: {
|
||||||
|
paths: ['src-web'],
|
||||||
|
extensions: ['.ts', '.tsx'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'react-refresh/only-export-components': 'error',
|
||||||
|
'jsx-a11y/no-autofocus': 'off',
|
||||||
|
'react/react-in-jsx-scope': 'off',
|
||||||
|
'import/no-unresolved': 'off',
|
||||||
|
|
||||||
|
'@typescript-eslint/consistent-type-imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
prefer: 'type-imports',
|
||||||
|
disallowTypeAnnotations: true,
|
||||||
|
fixStyle: 'separate-type-imports',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
globalIgnores([
|
||||||
|
'scripts/**/*',
|
||||||
|
'packages/plugin-runtime/**/*',
|
||||||
|
'packages/plugin-runtime-types/**/*',
|
||||||
|
'src-tauri/**/*',
|
||||||
|
'src-web/tailwind.config.cjs',
|
||||||
|
'src-web/vite.config.ts',
|
||||||
|
]),
|
||||||
|
globalIgnores([
|
||||||
|
'**/node_modules/',
|
||||||
|
'**/dist/',
|
||||||
|
'**/.eslintrc.cjs',
|
||||||
|
'**/.prettierrc.cjs',
|
||||||
|
'src-web/postcss.config.cjs',
|
||||||
|
'src-web/vite.config.ts',
|
||||||
|
]),
|
||||||
|
]);
|
||||||
1295
package-lock.json
generated
1295
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
@@ -67,16 +67,19 @@
|
|||||||
"jotai": "^2.12.2"
|
"jotai": "^2.12.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/compat": "^1.3.0",
|
||||||
|
"@eslint/eslintrc": "^3.3.1",
|
||||||
|
"@eslint/js": "^9.29.0",
|
||||||
"@tauri-apps/cli": "2.4.1",
|
"@tauri-apps/cli": "2.4.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
||||||
"@typescript-eslint/parser": "^8.27.0",
|
"@typescript-eslint/parser": "^8.27.0",
|
||||||
"@yaakapp/cli": "^0.1.5",
|
"@yaakapp/cli": "^0.1.5",
|
||||||
"eslint": "^8",
|
"eslint": "^9.29.0",
|
||||||
"eslint-config-prettier": "^8",
|
"eslint-config-prettier": "^10.1.5",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.32.0",
|
||||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||||
"eslint-plugin-react": "^7.37.2",
|
"eslint-plugin-react": "^7.37.5",
|
||||||
"eslint-plugin-react-hooks": "^5.1.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"nodejs-file-downloader": "^4.13.0",
|
"nodejs-file-downloader": "^4.13.0",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ function ExportDataDialogContent({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions,jsx-a11y/click-events-have-key-events */}
|
|
||||||
<td
|
<td
|
||||||
className="py-1 pl-4 text whitespace-nowrap overflow-x-auto hide-scrollbars"
|
className="py-1 pl-4 text whitespace-nowrap overflow-x-auto hide-scrollbars"
|
||||||
onClick={() => setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))}
|
onClick={() => setSelectedWorkspaces((prev) => ({ ...prev, [w.id]: !prev[w.id] }))}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,10 @@
|
|||||||
import { useMutation, useQuery } from '@tanstack/react-query';
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
||||||
import { openUrl } from '@tauri-apps/plugin-opener';
|
import { openUrl } from '@tauri-apps/plugin-opener';
|
||||||
import { Plugin, pluginsAtom } from '@yaakapp-internal/models';
|
import type { Plugin } from '@yaakapp-internal/models';
|
||||||
import {
|
import { pluginsAtom } from '@yaakapp-internal/models';
|
||||||
checkPluginUpdates,
|
import type { PluginVersion } from '@yaakapp-internal/plugins';
|
||||||
installPlugin,
|
import { checkPluginUpdates, installPlugin, searchPlugins } from '@yaakapp-internal/plugins';
|
||||||
PluginVersion,
|
import type { PluginUpdatesResponse } from '@yaakapp-internal/plugins/bindings/gen_api';
|
||||||
searchPlugins,
|
|
||||||
} from '@yaakapp-internal/plugins';
|
|
||||||
import { PluginUpdatesResponse } from '@yaakapp-internal/plugins/bindings/gen_api';
|
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useDebouncedValue } from '../../hooks/useDebouncedValue';
|
import { useDebouncedValue } from '../../hooks/useDebouncedValue';
|
||||||
@@ -190,7 +187,7 @@ function PluginSearch() {
|
|||||||
<TableHeaderCell>Name</TableHeaderCell>
|
<TableHeaderCell>Name</TableHeaderCell>
|
||||||
<TableHeaderCell>Version</TableHeaderCell>
|
<TableHeaderCell>Version</TableHeaderCell>
|
||||||
<TableHeaderCell>Description</TableHeaderCell>
|
<TableHeaderCell>Description</TableHeaderCell>
|
||||||
<TableHeaderCell children="" />
|
<TableHeaderCell />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import type { ReactNode } from 'react';
|
|||||||
import { memo, useEffect, useRef } from 'react';
|
import { memo, useEffect, useRef } from 'react';
|
||||||
import { ErrorBoundary } from '../../ErrorBoundary';
|
import { ErrorBoundary } from '../../ErrorBoundary';
|
||||||
import { Icon } from '../Icon';
|
import { Icon } from '../Icon';
|
||||||
import { RadioDropdown, RadioDropdownProps } from '../RadioDropdown';
|
import type { RadioDropdownProps } from '../RadioDropdown';
|
||||||
|
import { RadioDropdown } from '../RadioDropdown';
|
||||||
|
|
||||||
export type TabItem =
|
export type TabItem =
|
||||||
| {
|
| {
|
||||||
@@ -49,7 +50,7 @@ export function Tabs({
|
|||||||
const tabs = ref.current?.querySelectorAll<HTMLDivElement>(`[data-tab]`);
|
const tabs = ref.current?.querySelectorAll<HTMLDivElement>(`[data-tab]`);
|
||||||
for (const tab of tabs ?? []) {
|
for (const tab of tabs ?? []) {
|
||||||
const v = tab.getAttribute('data-tab');
|
const v = tab.getAttribute('data-tab');
|
||||||
let parent = tab.closest('.tabs-container');
|
const parent = tab.closest('.tabs-container');
|
||||||
if (parent !== ref.current) {
|
if (parent !== ref.current) {
|
||||||
// Tab is part of a nested tab container, so ignore it
|
// Tab is part of a nested tab container, so ignore it
|
||||||
} else if (v === value) {
|
} else if (v === value) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ export function useSyncWorkspaceRequestTitle() {
|
|||||||
newTitle += ` [${activeEnvironment.name}]`;
|
newTitle += ` [${activeEnvironment.name}]`;
|
||||||
}
|
}
|
||||||
if (activeRequest) {
|
if (activeRequest) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
newTitle += ` › ${resolvedModelName(activeRequest)}`;
|
newTitle += ` › ${resolvedModelName(activeRequest)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ export async function tryFormatJson(text: string): Promise<string> {
|
|||||||
try {
|
try {
|
||||||
const result = await invokeCmd<string>('cmd_format_json', { text });
|
const result = await invokeCmd<string>('cmd_format_json', { text });
|
||||||
return result;
|
return result;
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn("Failed to format JSON", err);
|
console.warn('Failed to format JSON', err);
|
||||||
// Nothing
|
// Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user