mirror of
https://github.com/jlengrand/Maestro.git
synced 2026-03-10 08:31:19 +00:00
feat: add ESLint with TypeScript/React plugins and fix all lint errors
- Add ESLint 9 configuration (eslint.config.mjs) with TypeScript and React hooks plugins
- Add npm run lint:eslint command for code quality checks
- Expand npm run lint to check all three TypeScript configs (renderer, main, cli)
- Update tsconfig.cli.json to include src/prompts and src/types directories
Fix 29 ESLint errors:
- Remove unused updateCliActivity import in batch-processor.ts
- Convert {false && <jsx>} patterns to comments in AutoRun components
- Wrap case block with const declarations in braces (AgentSelectionScreen)
- Fix unused expression pattern in PreparingPlanScreen
- Fix conditional hook calls in FilePreview, OfflineQueueBanner, RecentCommandChips, TerminalOutput
- Add windows-diagnostics.json to PackageContents interface
Update CLAUDE.md and CONTRIBUTING.md with new linting commands and documentation.
Claude ID: 029e8abe-5734-4967-9fb4-c85078c1973d
Maestro ID: 87ffa06e-0ecd-4eb8-b327-dad1ec24f7a9
This commit is contained in:
86
eslint.config.mjs
Normal file
86
eslint.config.mjs
Normal file
@@ -0,0 +1,86 @@
|
||||
// @ts-check
|
||||
import eslint from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import reactPlugin from 'eslint-plugin-react';
|
||||
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
||||
import globals from 'globals';
|
||||
|
||||
export default tseslint.config(
|
||||
// Ignore patterns
|
||||
{
|
||||
ignores: [
|
||||
'dist/**',
|
||||
'release/**',
|
||||
'node_modules/**',
|
||||
'*.config.js',
|
||||
'*.config.mjs',
|
||||
'*.config.ts',
|
||||
'scripts/**',
|
||||
'src/__tests__/**',
|
||||
'src/web/utils/serviceWorker.ts', // Service worker has special globals
|
||||
'src/web/public/**', // Service worker and static assets
|
||||
],
|
||||
},
|
||||
|
||||
// Base ESLint recommended rules
|
||||
eslint.configs.recommended,
|
||||
|
||||
// TypeScript ESLint recommended rules
|
||||
...tseslint.configs.recommended,
|
||||
|
||||
// Main configuration for all TypeScript files
|
||||
{
|
||||
files: ['src/**/*.ts', 'src/**/*.tsx'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module',
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
...globals.es2020,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
react: reactPlugin,
|
||||
'react-hooks': reactHooksPlugin,
|
||||
},
|
||||
rules: {
|
||||
// TypeScript-specific rules
|
||||
'@typescript-eslint/no-unused-vars': ['warn', {
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
}],
|
||||
'@typescript-eslint/no-explicit-any': 'off', // Too many existing uses
|
||||
'@typescript-eslint/no-empty-object-type': 'off',
|
||||
'@typescript-eslint/no-require-imports': 'off', // Used in main process
|
||||
|
||||
// React rules
|
||||
'react/jsx-uses-react': 'error',
|
||||
'react/jsx-uses-vars': 'error',
|
||||
'react/prop-types': 'off', // Using TypeScript for prop types
|
||||
'react/react-in-jsx-scope': 'off', // Not needed with new JSX transform
|
||||
|
||||
// React Hooks rules
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
|
||||
// General rules
|
||||
'no-console': 'off', // Console is used throughout
|
||||
'no-undef': 'off', // TypeScript handles this
|
||||
'no-control-regex': 'off', // Intentionally used for terminal escape sequences
|
||||
'no-useless-escape': 'off', // Sometimes needed for clarity in regexes
|
||||
'prefer-const': 'warn',
|
||||
'no-var': 'error',
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user