-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.ts
More file actions
127 lines (126 loc) · 3.81 KB
/
eslint.config.ts
File metadata and controls
127 lines (126 loc) · 3.81 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
121
122
123
124
125
126
127
import js from '@eslint/js';
import typescriptParser from '@typescript-eslint/parser';
import { defineConfig } from 'eslint/config';
import prettierConfig from 'eslint-config-prettier';
import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
import prettierPlugin from 'eslint-plugin-prettier';
import promisePlugin from 'eslint-plugin-promise';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
export default defineConfig([
js.configs.recommended,
prettierConfig,
{
files: ['**/*.{js,ts,tsx}'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
},
globals: {
// Build-time constants
__DEV__: 'readonly',
__LIB__: 'readonly',
__LIB_VERSION__: 'readonly',
// Browser globals that are safe to use
URL: 'readonly',
fetch: 'readonly',
},
},
plugins: {
prettier: prettierPlugin,
'eslint-comments': eslintCommentsPlugin,
'simple-import-sort': simpleImportSort,
promise: promisePlugin,
'react-hooks': reactHooksPlugin,
},
rules: {
'eslint-comments/disable-enable-pair': [
'error',
{ allowWholeFile: true },
],
'no-unused-vars': 'off', // TypeScript handles this
'no-undef': 'off', // TypeScript handles this
'no-restricted-globals': [
'error',
{
name: 'window',
message:
'Use a different approach to access browser APIs. Consider using a utility function or checking for window availability.',
},
{
name: 'document',
message:
'Use a different approach to access DOM APIs. Consider using a utility function or checking for document availability.',
},
{
name: 'navigator',
message:
'Use a different approach to access navigator APIs. Consider using a utility function or checking for navigator availability.',
},
{
name: 'location',
message:
'Use a different approach to access location APIs. Consider using a utility function or checking for location availability.',
},
{
name: 'localStorage',
message:
'Use a different approach to access localStorage. Consider using a utility function or checking for localStorage availability.',
},
{
name: 'sessionStorage',
message:
'Use a different approach to access sessionStorage. Consider using a utility function or checking for sessionStorage availability.',
},
],
'prettier/prettier': 'error',
'promise/always-return': 'error',
'promise/no-return-wrap': 'error',
'promise/param-names': 'error',
'promise/catch-or-return': 'error',
'promise/no-new-statics': 'error',
'promise/no-return-in-finally': 'error',
'promise/valid-params': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
},
{
files: ['packages/**/src/**/*.{js,ts,tsx}'],
rules: {
'no-console': 'error',
},
},
{
files: [
'**/test/**/*.{js,ts,tsx}',
'**/*.test.{js,ts,tsx}',
'examples/**/*.{js,ts,tsx}',
'packages/altertable-snippet/**/*.{js,ts,tsx}',
],
rules: {
'no-restricted-globals': 'off',
},
},
{
files: ['**/*.d.ts'],
rules: {
'no-unused-vars': 'off',
},
},
{
ignores: [
'**/*/dist/*',
'**/*/build/*',
'**/*/out/*',
'**/*/lib/*',
'**/*/coverage/*',
'**/*/.next/*',
'**/*/node_modules/*',
],
},
]);