-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy patheslint.config.js
More file actions
112 lines (104 loc) · 3.17 KB
/
eslint.config.js
File metadata and controls
112 lines (104 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* Copyright (c) 2026, Salesforce, Inc.
* All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* For full license text, see the LICENSE file in the repo root or https://www.apache.org/licenses/LICENSE-2.0
*/
import tseslint from 'typescript-eslint';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import globals from 'globals';
/** @type {import("eslint").Linter.Config} */
export default [
// Ignore patterns (must be first)
{
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/build/**',
'**/.turbo/**',
'**/coverage/**',
'**/.next/**',
'**/.react-router/**',
'**/.vite/**',
'**/packages/parser-tree-sitter/bindings/**',
'**/packages/parser-tree-sitter/build/**',
'**/packages/parser-tree-sitter/src/**/*.c',
'parity_testing/**',
],
},
// Base TypeScript configuration for all files
...tseslint.configs.recommended,
// General TypeScript files (non-React)
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: {
allowDefaultProject: [
'packages/agentforce/tests/*.test.ts',
'packages/compiler/modality/test/*.test.ts',
'packages/lsp/src/*.test.ts',
'packages/lsp/src/adapters/*.test.ts',
'packages/lsp/src/providers/*.test.ts',
'packages/lsp-server/src/*.test.ts',
'packages/parser-javascript/test/*.test.ts',
],
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 40,
},
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// TypeScript-specific rules
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/require-await': 'warn',
// General code quality
'no-console': ['warn', { allow: ['warn', 'error'] }],
'prefer-const': 'error',
'no-var': 'error',
},
},
// React-specific configuration for UI app
{
files: ['apps/ui/**/*.{ts,tsx}'],
languageOptions: {
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
// React hooks rules
...reactHooks.configs.recommended.rules,
// React refresh rules
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
// Relaxed rules for test files
{
files: ['**/tests/**/*.ts', '**/*.test.ts', '**/*.spec.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'no-console': 'off',
},
},
];