-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy patheslint.config.js
More file actions
120 lines (119 loc) · 3.29 KB
/
eslint.config.js
File metadata and controls
120 lines (119 loc) · 3.29 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
113
114
115
116
117
118
119
120
import js from '@eslint/js';
import prettierConfig from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import prettierPlugin from 'eslint-plugin-prettier';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import tseslint from 'typescript-eslint';
export default [
{
ignores: [
'node_modules/**',
'dist/**',
'build/**',
'public/**',
'html/**',
'.DS_Store',
'coverage/**',
'*.log',
'scripts/**',
'test-script-api.mjs',
'test-integration.ts',
'rust/**',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.{js,jsx,ts,tsx}'],
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin,
import: importPlugin,
prettier: prettierPlugin,
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
jsx: true,
},
globals: {
document: 'readonly',
navigator: 'readonly',
window: 'readonly',
},
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.json',
},
},
},
rules: {
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'prettier/prettier': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
prefix: ['I'],
},
],
'import/no-restricted-paths': [
'error',
{
zones: [
{
target: './src/game/**/*',
from: './src/core/**/*',
except: [
'**/index.ts',
'**/lib/extension/**/*',
'**/lib/input/inputTypes.ts',
'**/lib/serialization/assets/**/*',
'**/animation/assets/**/*',
'**/types/components.ts',
'**/materials/Material.types.ts',
'**/prefabs/Prefab.types.ts',
'**/lib/rendering/shapes/IShapeDescriptor.ts',
],
message:
'Game code can only import from @core/* public API or @core/lib/extension/*. Use @core/* instead of deep imports.',
},
],
},
],
},
},
{
files: ['**/*.test.{js,jsx,ts,tsx}', '**/__tests__/**/*.{js,jsx,ts,tsx}'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},
{
files: ['src/game/scripts/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'no-unused-vars': 'off',
// External scripts are standalone and may declare duplicate global lifecycle functions
// Ensure parser doesn't attempt full type-aware linting using the project config here
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/triple-slash-reference': 'off',
},
},
prettierConfig,
];