forked from customerio/cdp-analytics-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
77 lines (77 loc) · 2.78 KB
/
.eslintrc.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
71
72
73
74
75
76
77
/** @type { import('eslint').Linter.Config } */
module.exports = {
root: true,
ignorePatterns: ['node_modules', 'dist'],
parserOptions: {
ecmaVersion: 2020,
},
env: {
es6: true,
node: true,
browser: true,
},
extends: [
// Turn on on eslint recommended rules https://github.com/eslint/eslint/blob/main/conf/eslint-recommended.js
'eslint:recommended',
// Turn off eslint rules that conflict with prettier https://github.com/prettier/eslint-config-prettier/blob/main/index.js
'prettier',
],
overrides: [
{
files: ['*.{js,mjs}'],
extends: [
// Handle prettier rules through eslint https://github.com/prettier/eslint-plugin-prettier/blob/master/eslint-plugin-prettier.js#L65
'plugin:prettier/recommended',
],
},
{
files: ['*.{ts,tsx}'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: [
'./tsconfig.json',
'./packages/*/tsconfig.json',
'./examples/*/tsconfig.json',
],
},
extends: [
// Disable rules from eslint:recommended which are already handled by TypeScript. Enables eslint (@not typescript-eslint) rules that make sense due to TS's typechecking / transpilation.
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
'plugin:@typescript-eslint/eslint-recommended',
// Enable recommended rules from @typescript-eslint
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts
'plugin:@typescript-eslint/recommended',
// Handle prettier rules through eslint https://github.com/prettier/eslint-plugin-prettier/blob/master/eslint-plugin-prettier.js#L65
'plugin:prettier/recommended',
],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-floating-promises': [
'error',
{
ignoreVoid: true,
},
],
'require-await': 'off',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-types': 'off', // TODO: turn on
},
overrides: [
{
files: ['*.test.*'],
rules: {
'require-await': 'off',
'@typescript-eslint/require-await': 'off',
},
},
],
},
],
}