forked from sirmalloc/ccstatusline
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
159 lines (158 loc) · 5.75 KB
/
Copy patheslint.config.js
File metadata and controls
159 lines (158 loc) · 5.75 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
153
154
155
156
157
158
159
import js from '@eslint/js';
import ts from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';
import importPlugin from 'eslint-plugin-import';
import importNewlinesPlugin from 'eslint-plugin-import-newlines';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import globals from 'globals';
export default ts.config([
{
files: ['**/*.ts', '**/*.tsx'],
plugins: {
stylistic,
importPlugin,
'import-newlines': importNewlinesPlugin
},
extends: [
js.configs.recommended,
ts.configs.strictTypeChecked,
ts.configs.stylisticTypeChecked,
importPlugin.flatConfigs.recommended,
stylistic.configs.customize({
quotes: 'single',
semi: true,
indent: 4,
jsx: true
})
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: import.meta.dirname
},
globals: {
...globals.node,
...globals.es2021
}
},
settings: {
'import/resolver': {
typescript: {
project: ['./tsconfig.json'],
alwaysTryTypes: true,
noWarnOnMultipleProjects: true
},
parcel2: {},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
}
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
},
'import/external-module-folders': ['node_modules', 'node_modules/@types']
},
rules: {
'no-control-regex': 'off', // We intentionally match ANSI escape sequences
'eqeqeq': 'error',
'import/order': ['error', {
alphabetize: {
'order': 'asc',
'orderImportKind': 'asc',
'caseInsensitive': false
},
named: {
'enabled': true,
'types': 'types-last'
},
pathGroupsExcludedImportTypes: ["builtin"],
groups: [
['builtin', 'external'],
'internal',
'parent',
'sibling',
'index',
'unknown'
],
'newlines-between': 'always'
}],
'import-newlines/enforce': ['error', {
items: 1,
semi: true
}],
'@typescript-eslint/no-unused-vars': ['error', { 'args': 'none' }],
'@typescript-eslint/no-empty-function': ['error', { 'allow': ['private-constructors'] }],
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-inferrable-types': ['error', { 'ignoreProperties': true }],
'@typescript-eslint/restrict-template-expressions': 'off',
'@stylistic/indent': ['error', 4, {
'ImportDeclaration': 1
}],
'@stylistic/key-spacing': 'off',
'@stylistic/comma-dangle': ['error', 'never'],
'@stylistic/no-multi-spaces': 'off',
'@stylistic/brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
'@stylistic/max-statements-per-line': ['error', { 'max': 2 }],
'@stylistic/operator-linebreak': ['error', 'before'],
'@stylistic/padding-line-between-statements': 'error',
'@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
'@stylistic/no-extra-semi': 'error',
'@stylistic/nonblock-statement-body-position': ['error', 'below'],
'@stylistic/object-curly-newline': ['error', { 'multiline': true }],
'@stylistic/switch-colon-spacing': 'error',
'@stylistic/eol-last': ['error', 'never'],
'@stylistic/jsx-quotes': ['error', 'prefer-single'],
'@stylistic/multiline-ternary': 'off',
'import/no-unresolved': ['error'],
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/default': 'off'
}
},
{
files: ['**/*.tsx', '**/*.jsx'],
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin
},
settings: {
...{
'import/resolver': {
typescript: {
project: ['./tsconfig.json'],
alwaysTryTypes: true,
noWarnOnMultipleProjects: true
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
}
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
},
'import/external-module-folders': ['node_modules', 'node_modules/@types']
},
react: {
version: 'detect'
}
},
rules: {
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn'
}
},
{
ignores: [
'**/dist/',
'**/node_modules/',
'**/*.js',
'!eslint.config.js'
]
}
]);