-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patheslint.config.mjs
More file actions
152 lines (150 loc) · 4.73 KB
/
Copy patheslint.config.mjs
File metadata and controls
152 lines (150 loc) · 4.73 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import pluginCypress from 'eslint-plugin-cypress/flat'
import tseslint from 'typescript-eslint'
import js from '@eslint/js'
import pluginReact from '@eslint-react/eslint-plugin'
// import pluginImport from 'eslint-plugin-import'
import pluginJSXA11y from 'eslint-plugin-jsx-a11y'
import pluginReactHooks from 'eslint-plugin-react-hooks'
import pluginTSDoc from 'eslint-plugin-tsdoc'
import pluginUnicorn from 'eslint-plugin-unicorn'
import globals from 'globals'
/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: [
'.pnp.*',
'.yarn/',
'**/bin/',
'**/build/',
'**/coverage/',
'**/dist/',
'packages/website/.docusaurus/',
'packages/jbrowse-plugin-apollo/.jbrowse/',
],
},
js.configs.recommended,
pluginUnicorn.configs.recommended,
// pluginImport.flatConfigs.typescript,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
globals: { ...globals.browser, ...globals.node },
parserOptions: { projectService: true },
},
plugins: {
tsdoc: pluginTSDoc,
// import: pluginImport
},
rules: {
// eslint built-in rules (override recommended)
curly: 'warn',
'new-cap': [
'error',
{
newIsCap: true,
newIsCapExceptions: [],
capIsNew: false,
capIsNewExceptions: [
'Immutable.Map',
'Immutable.Set',
'Immutable.List',
],
},
],
'no-console': ['warn', { allow: ['error', 'warn', 'debug'] }],
'no-else-return': ['error', { allowElseIf: false }],
'no-extra-semi': 'off',
'object-shorthand': 'warn',
'prefer-destructuring': 'warn',
'prefer-template': 'warn',
radix: 'error',
// @typescript-eslint/eslint-plugin rules (override recommended)
'@typescript-eslint/consistent-type-imports': [
'error',
{ fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/no-extraneous-class': [
'error',
{ allowWithDecorator: true },
],
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/restrict-template-expressions': [
'warn',
{ allowNumber: true },
],
'@typescript-eslint/return-await': 'error',
// eslint-plugin-import rules
// 'import/export': 'error',
// 'import/no-duplicates': ['warn', { 'prefer-inline': true }],
// 'import/no-extraneous-dependencies': 'error',
// 'import/no-named-as-default': 'warn',
// 'import/order': [
// 'warn',
// {
// named: true,
// 'newlines-between': 'always',
// alphabetize: { order: 'asc' },
// groups: ['builtin', 'external', 'parent', 'sibling'],
// },
// ],
// eslint-plugin-tsdoc rules
'tsdoc/syntax': 'warn',
// eslint-plugin-unicorn rules (override recommended)
'unicorn/filename-case': 'off', // Doesn't match our file naming, maybe can be configured later
'unicorn/no-empty-file': 'off', // False positives
'unicorn/no-null': 'off', // A lot of null in React and other libraries
'unicorn/prefer-module': 'off', // Cypress and apollo-collaboration-server need this
'unicorn/prevent-abbreviations': 'off', // Doesn't guess a lot of abbreviations correctly
},
},
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
...pluginReactHooks.configs.flat.recommended,
files: [
'packages/jbrowse-plugin-apollo/src/**/*.{jsx,tsx}',
'packages/website/src/**/*.{jsx,tsx}',
],
},
{
...pluginReact.configs['disable-conflict-eslint-plugin-react-hooks'],
files: [
'packages/jbrowse-plugin-apollo/src/**/*.{jsx,tsx}',
'packages/website/src/**/*.{jsx,tsx}',
],
},
{
...pluginReact.configs['recommended-typescript'],
files: [
'packages/jbrowse-plugin-apollo/src/**/*.{jsx,tsx}',
'packages/website/src/**/*.{jsx,tsx}',
],
},
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
...pluginJSXA11y.flatConfigs.recommended,
files: [
'packages/jbrowse-plugin-apollo/src/**/*.{jsx,tsx}',
'packages/website/src/**/*.{jsx,tsx}',
],
},
{
...pluginCypress.configs.recommended,
files: ['packages/jbrowse-plugin-apollo/cypress/**/*'],
},
// Don't enforce tsdoc syntax in JS files
{
files: ['*.{c,m,}js', '**/*.{c,m,}js'],
rules: {
'tsdoc/syntax': 'off',
},
},
{
files: ['packages/apollo-cli/src/**/*.ts'],
rules: { '@typescript-eslint/no-deprecated': 'off' },
},
]