-
Notifications
You must be signed in to change notification settings - Fork 22
/
eslint.config.js
70 lines (67 loc) · 1.97 KB
/
eslint.config.js
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
import js from "@eslint/js";
// import { FlatCompat } from '@eslint/eslintrc';
import globals from "globals";
import typescriptEslintParser from '@typescript-eslint/parser';
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
// const compat = new FlatCompat();
/**
* @type {import('eslint').Linter.FlatConfig[]}
*/
const config = [
{
ignores: [
".eslintrc.cjs",
"babel.config.js",
"rollup.conf.js",
"demo/**",
"dist/**",
"node_modules/**",
],
},
{
files: ["**/*.{ts}"],
languageOptions: {
globals: {
...globals.browser,
// ...globals.node,
// myCustomGlobal: "readonly"
},
parser: typescriptEslintParser,
parserOptions: {
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': typescriptEslintPlugin,
},
rules: {
...js.configs.recommended.rules,
...typescriptEslintPlugin.configs.recommended.rules,
},
},
{
files: ["**/*.{js,mjc,cjs}"],
languageOptions: {
globals: {
...globals.browser,
// ...globals.node,
// myCustomGlobal: "readonly"
},
},
rules: {
...js.configs.recommended.rules,
indent: ['error', 4, { SwitchCase: 1 }],
'max-len': ['off'],
'no-param-reassign': ['off'],
'no-use-before-define': ['off'],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
// allow let
'prefer-const': 'off',
'prefer-destructuring': ['error', { object: true, array: false }],
// allow extension in imports
'import/extensions': 'off',
'prefer-object-spread': 'off',
},
},
];
export default config;