-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy patheslint.config.mjs
More file actions
83 lines (82 loc) · 2.5 KB
/
Copy patheslint.config.mjs
File metadata and controls
83 lines (82 loc) · 2.5 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import stylistic from '@stylistic/eslint-plugin';
export default tseslint.config(
{ ignores: ['**/dist/**'] },
js.configs.recommended,
...tseslint.configs.recommended,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
{
files: ['**/*.{ts,tsx,js,jsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
settings: {
react: {
version: 'detect',
},
},
},
stylistic.configs.customize({
indent: 2,
quotes: 'single',
semi: true,
jsx: true,
}),
{
rules: {
'no-constant-binary-expression': 'warn',
// Match Prettier: keep `else` on the `} else {` line (1TBS), not on a new line.
'@stylistic/brace-style': ['error', '1tbs'],
// Match Prettier: don't wrap multiline JSX passed as a prop in extra parens.
'@stylistic/jsx-wrap-multilines': 'off',
// Match Prettier: allow multiple JSX children on one line (e.g. `{a} {b}`).
'@stylistic/jsx-one-expression-per-line': 'off',
// Match Prettier: align closing tags to the opening tag's line (accepts
// inline-opened fragments like `{cond && <>...</>}`).
'@stylistic/jsx-closing-tag-location': ['error', 'line-aligned'],
// No trailing comma after the last argument/parameter in multi-line
// function calls and definitions; keep it elsewhere (arrays, objects,
// imports, exports, TS enums/generics/tuples).
'@stylistic/comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'never',
enums: 'always-multiline',
generics: 'always-multiline',
tuples: 'always-multiline',
},
],
'@stylistic/max-len': [
'warn',
{
code: 120,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreComments: true,
ignoreUrls: true,
ignoreRegExpLiterals: true,
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
}
);