-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
81 lines (79 loc) · 2.58 KB
/
eslint.config.js
File metadata and controls
81 lines (79 loc) · 2.58 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
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
const __dirname = dirname(fileURLToPath(import.meta.url));
export default tseslint.config(
{
ignores: ['**/dist/**', '**/build/**', '**/coverage/**'],
},
js.configs.recommended,
{
files: ['**/*.{js,cjs,mjs}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: globals.node,
parserOptions: {
project: false,
tsconfigRootDir: __dirname,
},
},
},
...tseslint.configs.recommended,
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tseslint.parser,
ecmaVersion: 'latest',
sourceType: 'module',
globals: { ...globals.browser, ...globals.node },
parserOptions: {
project: [
'./tsconfig.json',
'./crates/bindings-typescript/tsconfig.json',
'./crates/bindings-typescript/test-app/tsconfig.json',
'./crates/bindings-typescript/examples/basic-react/tsconfig.json',
'./crates/bindings-typescript/examples/empty/tsconfig.json',
'./crates/bindings-typescript/examples/quickstart-chat/tsconfig.json',
'./docs/tsconfig.json',
],
projectService: true,
tsconfigRootDir: __dirname,
},
},
linterOptions: {
reportUnusedDisableDirectives: "off",
},
plugins: {
'@typescript-eslint': tseslint.plugin,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'error',
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
'no-restricted-syntax': [
'error',
{ selector: 'TSEnumDeclaration', message: 'Do not use enums; stick to JS-compatible types.' },
{ selector: 'TSEnumDeclaration[const=true]', message: 'Do not use const enum; use unions or objects.' },
{ selector: 'Decorator', message: 'Do not use decorators.' },
],
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
"eslint-comments/no-unused-disable": "off",
},
}
);