forked from alexandreL/UberDirectSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
86 lines (79 loc) · 2.24 KB
/
eslint.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
74
75
76
77
78
79
80
81
82
83
84
85
86
import importPlugin from 'eslint-plugin-import'
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'
import eslintJs from '@eslint/js'
import eslintTs from 'typescript-eslint'
import stylisticTs from '@stylistic/eslint-plugin-ts'
import stylistic from '@stylistic/eslint-plugin'
const tsFiles = [ '{src,example}/**/*.ts' ]
const languageOptions = {
globals: {
...globals.node,
},
ecmaVersion: 2023,
sourceType: 'module',
}
const customTypescriptConfig = {
files: tsFiles,
plugins: {
import: importPlugin,
'import/parsers': tsParser,
'@stylistic/ts': stylisticTs,
'@stylistic': stylistic,
},
languageOptions: {
...languageOptions,
parser: tsParser,
parserOptions: {
project: './tsconfig.json',
},
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': [ '.ts' ],
},
},
rules: {
...importPlugin.configs.typescript.rules,
'@stylistic/ts/indent': [ 'error', 4 ],
'@stylistic/ts/semi': [ 'error', 'never' ],
'@stylistic/ts/quotes': [ 'error', 'single' ],
'@stylistic/ts/object-curly-newline': 'error',
'@stylistic/ts/object-curly-spacing': [
'error',
'always',
],
'@stylistic/array-bracket-spacing': [
'error',
'always',
],
'@stylistic/array-element-newline': [
'error',
'consistent',
],
'@stylistic/comma-dangle': [
'error',
'always-multiline',
],
},
}
// Add the files for applying the recommended TypeScript configs
// only for the Typescript files.
// This is necessary when we have the multiple extensions files
// (e.g. .ts, .tsx, .js, .cjs, .mjs, etc.).
const recommendedTypeScriptConfigs = [
...eslintTs.configs.recommended.map((config) => ({
...config,
files: tsFiles,
})),
...eslintTs.configs.stylistic.map((config) => ({
...config,
files: tsFiles,
})),
]
export default [
{ ignores: [ 'lib/*', 'dist/*' ] }, // global ignores
eslintJs.configs.recommended,
...recommendedTypeScriptConfigs,
customTypescriptConfig,
]