-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
76 lines (75 loc) · 2.8 KB
/
Copy patheslint.config.js
File metadata and controls
76 lines (75 loc) · 2.8 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
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import prettier from 'eslint-config-prettier'
import tseslint from 'typescript-eslint'
export default tseslint.config(
// The data-table ignore also covered the shared renderer the product tables
// actually use, so it had never been linted. Now that the unused schema-driven
// table system is gone, what remains under data-table/ is live code.
{ ignores: ['dist', 'src/components/custom/**', 'src/components/controls.tsx', 'src/lib/format.ts', 'src/lib/delimiters.ts', 'src/lib/is-array.ts', 'src/lib/compose-refs.ts', 'src/lib/date-preset.ts', 'src/lib/react-table.d.ts', 'src/lib/constants/**', 'src/hooks/use-debounce.ts', 'src/hooks/use-hot-key.ts', 'src/hooks/use-media-query.ts', 'src/hooks/use-local-storage.ts', 'src/hooks/use-copy-to-clipboard.ts'] },
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
prettier,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{ varsIgnorePattern: '^_', argsIgnorePattern: '^_' },
],
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true, allowExportNames: ['useAuth', 'useTheme', 'useToast', 'useSidebar', 'useServerEventsHealth', 'buttonVariants'] },
],
// Row identity is the invariant the data-table/useTableState seam exists
// to centralise, and `getRowId` can only be *required* if there is one
// place to require it from. A comment is not a seam, and a source scan
// matches strings; this matches the import and fails at author time.
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@tanstack/react-table',
importNames: ['useTable'],
message:
'Call useTableState from @/components/data-table/useTableState instead. It wraps useTable so getRowId cannot fall back to TanStack’s index default (#307, #359).',
},
],
},
],
},
},
{
// The one file allowed to build a table instance.
files: ['src/components/data-table/useTableState.ts'],
rules: {
'no-restricted-imports': 'off',
},
},
{
files: ['playwright.config.ts', 'tests/**/*.{ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
'react-refresh/only-export-components': 'off',
},
},
)