generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy patheslint.config.mjs
More file actions
100 lines (99 loc) · 2.88 KB
/
eslint.config.mjs
File metadata and controls
100 lines (99 loc) · 2.88 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
import eslint from '@eslint/js';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import security from 'eslint-plugin-security';
import tseslint from 'typescript-eslint';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
import: importPlugin,
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
security,
},
rules: {
...importPlugin.configs.recommended.rules,
...react.configs.recommended.rules,
...security.configs.recommended.rules,
// CLI inherently works with dynamic file paths and Record lookups — these are false positives
'security/detect-non-literal-fs-filename': 'off',
'security/detect-object-injection': 'off',
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react-hooks/preserve-manual-memoization': 'warn',
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'import/no-unresolved': 'off', // TypeScript handles this
// Allow intentional unused placeholders like `_unused`
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: true,
node: true,
},
},
},
prettier,
// Relaxed rules for test files
{
files: ['**/*.test.ts', '**/*.test.tsx', '**/test-utils/**', 'integ-tests/**'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
},
},
{
ignores: [
'dist',
'node_modules',
'src/assets',
'src/schema/llm-compacted',
'.agentcore',
'**/.agentcore/**',
'.venv',
'**/.venv/**',
'*.config.js',
'.idea',
'.vscode',
'.kiro',
'.amazonq',
'coverage',
'*.log',
'*.tsbuildinfo',
],
}
);