fix: use flat config for react eslint plugin (#265)
This commit is contained in:
parent
6812235cfa
commit
c5182d5ca4
|
@ -7,7 +7,6 @@
|
||||||
import eslint from '@eslint/js';
|
import eslint from '@eslint/js';
|
||||||
import tseslint from 'typescript-eslint';
|
import tseslint from 'typescript-eslint';
|
||||||
import reactPlugin from 'eslint-plugin-react';
|
import reactPlugin from 'eslint-plugin-react';
|
||||||
import reactRecommended from 'eslint-plugin-react/configs/recommended.js';
|
|
||||||
import reactHooks from 'eslint-plugin-react-hooks';
|
import reactHooks from 'eslint-plugin-react-hooks';
|
||||||
import prettierConfig from 'eslint-config-prettier';
|
import prettierConfig from 'eslint-config-prettier';
|
||||||
import importPlugin from 'eslint-plugin-import';
|
import importPlugin from 'eslint-plugin-import';
|
||||||
|
@ -29,7 +28,7 @@ export default tseslint.config(
|
||||||
{
|
{
|
||||||
// Global ignores
|
// Global ignores
|
||||||
ignores: [
|
ignores: [
|
||||||
'node_modules/**',
|
'node_modules/*',
|
||||||
'eslint.config.js',
|
'eslint.config.js',
|
||||||
'packages/cli/dist/**',
|
'packages/cli/dist/**',
|
||||||
'packages/server/dist/**',
|
'packages/server/dist/**',
|
||||||
|
@ -38,37 +37,9 @@ export default tseslint.config(
|
||||||
},
|
},
|
||||||
eslint.configs.recommended,
|
eslint.configs.recommended,
|
||||||
...tseslint.configs.recommended,
|
...tseslint.configs.recommended,
|
||||||
{
|
reactHooks.configs['recommended-latest'],
|
||||||
// React specific config
|
reactPlugin.configs.flat.recommended,
|
||||||
files: ['packages/cli/src/**/*.tsx'], // Target only TSX in the cli package
|
reactPlugin.configs.flat['jsx-runtime'], // Add this if you are using React 17+
|
||||||
languageOptions: {
|
|
||||||
// Keep languageOptions from reactRecommended if needed, or define explicitly
|
|
||||||
parserOptions: {
|
|
||||||
ecmaFeatures: { jsx: true },
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
...globals.browser,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
// Define the plugins used in this block
|
|
||||||
react: reactPlugin,
|
|
||||||
'react-hooks': reactHooks,
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
// Apply recommended rules explicitly
|
|
||||||
...reactRecommended.rules,
|
|
||||||
...reactHooks.configs.recommended.rules,
|
|
||||||
// Custom overrides
|
|
||||||
'react/react-in-jsx-scope': 'off',
|
|
||||||
'react/prop-types': 'off',
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
react: {
|
|
||||||
version: 'detect',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
// Import specific config
|
// Import specific config
|
||||||
files: ['packages/cli/src/**/*.{ts,tsx}'], // Target only TS/TSX in the cli package
|
files: ['packages/cli/src/**/*.{ts,tsx}'], // Target only TS/TSX in the cli package
|
||||||
|
@ -117,7 +88,7 @@ export default tseslint.config(
|
||||||
],
|
],
|
||||||
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
|
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
|
||||||
'@typescript-eslint/no-unused-vars': [
|
'@typescript-eslint/no-unused-vars': [
|
||||||
'warn',
|
'error',
|
||||||
{
|
{
|
||||||
argsIgnorePattern: '^_',
|
argsIgnorePattern: '^_',
|
||||||
varsIgnorePattern: '^_',
|
varsIgnorePattern: '^_',
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { Box, Static, Text, useStdout } from 'ink';
|
import { Box, Static, Text, useStdout } from 'ink';
|
||||||
import { StreamingState, type HistoryItem } from './types.js';
|
import { StreamingState, type HistoryItem } from './types.js';
|
||||||
import { useGeminiStream } from './hooks/useGeminiStream.js';
|
import { useGeminiStream } from './hooks/useGeminiStream.js';
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import { Box, Text } from 'ink';
|
import { Box, Text } from 'ink';
|
||||||
export interface Suggestion {
|
export interface Suggestion {
|
||||||
label: string;
|
label: string;
|
||||||
|
|
|
@ -68,7 +68,7 @@ export const useSlashCommandProcessor = (
|
||||||
description: '',
|
description: '',
|
||||||
action: (_value: PartListUnion) => {
|
action: (_value: PartListUnion) => {
|
||||||
setDebugMessage('Quitting. Good-bye.');
|
setDebugMessage('Quitting. Good-bye.');
|
||||||
const timestamp = getNextMessageId(Date.now());
|
getNextMessageId(Date.now());
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"jsx": "react",
|
"jsx": "react-jsx",
|
||||||
"lib": ["DOM", "DOM.Iterable", "ES2020"],
|
"lib": ["DOM", "DOM.Iterable", "ES2020"],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@gemini-code/*": ["./packages/*"]
|
"@gemini-code/*": ["./packages/*"]
|
||||||
|
|
|
@ -11,7 +11,6 @@ import { GrepTool } from '../tools/grep.js';
|
||||||
import { ReadFileTool } from '../tools/read-file.js';
|
import { ReadFileTool } from '../tools/read-file.js';
|
||||||
import { ReadManyFilesTool } from '../tools/read-many-files.js';
|
import { ReadManyFilesTool } from '../tools/read-many-files.js';
|
||||||
import { ShellTool } from '../tools/shell.js';
|
import { ShellTool } from '../tools/shell.js';
|
||||||
import { WebFetchTool } from '../tools/web-fetch.js';
|
|
||||||
import { WriteFileTool } from '../tools/write-file.js';
|
import { WriteFileTool } from '../tools/write-file.js';
|
||||||
|
|
||||||
const contactEmail = 'gemini-code-dev@google.com';
|
const contactEmail = 'gemini-code-dev@google.com';
|
||||||
|
|
Loading…
Reference in New Issue