This repository was archived by the owner on Feb 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheslint.shared.config.mjs
73 lines (67 loc) · 1.89 KB
/
eslint.shared.config.mjs
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
import javascript from '@eslint/js'
import globals from 'globals'
/** @type {import('eslint').Linter.Config.RulesRecord} */
export const sharedJsRules = {
'arrow-spacing': 'error',
camelcase: 'off',
'comma-spacing': 'error',
'comma-dangle': ['error', 'always-multiline'],
'eol-last': 'error',
eqeqeq: 'error',
indent: ['error', 2],
'no-constant-condition': 'off',
'no-extra-parens': 'error',
'no-multi-spaces': 'error',
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
'no-trailing-spaces': 'error',
'no-unused-vars': 'off',
'no-useless-concat': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'object-curly-spacing': ['error', 'always'],
'prefer-const': 'warn',
'prefer-destructuring': [
'warn',
{
object: true,
array: false,
},
],
'prefer-promise-reject-errors': 'error',
quotes: ['error', 'single'],
'require-await': 'warn',
semi: ['error', 'never'],
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
},
],
'space-infix-ops': 'error',
/// From https://emotion.sh/docs/eslint-plugin-react - maybe there's a better way to avoid 'no-unknown-property' on 'sx' and 'css' props
'react/no-unknown-property': ['error', { 'ignore': ['css', 'sx'] }]
}
/** @type {import('eslint').Linter.Config.RulesRecord} */
export const sharedTsRules = {
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
}
/** @type {import('eslint').Linter.Config[]} */
export default [
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
...javascript.configs.recommended.rules,
...sharedJsRules,
},
files: ['eslint.config.js', 'test/**/*.js'],
},
]