forked from visgl/luma.gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
147 lines (135 loc) · 4.28 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
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
const {getESLintConfig, deepMerge} = require('ocular-dev-tools');
const defaultConfig = getESLintConfig({react: '16.8.2'});
// Make any changes to default config here
const config = deepMerge(defaultConfig, {
parserOptions: {
project: ['./tsconfig.json']
},
plugins: ['tree-shaking', 'luma-gl-custom-rules', 'import'],
env: {
browser: true,
es2020: true,
node: true
},
rules: {
'no-unused-expressions': 'warn',
'import/no-unresolved': 1,
'no-console': 1,
'no-continue': ['warn'],
'callback-return': 0,
'accessor-pairs': 0,
'max-depth': ['warn', 4],
camelcase: 'off',
complexity: 'off',
'max-statements': 'off',
'default-case': ['warn'],
'no-eq-null': ['warn'],
eqeqeq: ['warn'],
radix: 0
// 'accessor-pairs': ['error', {getWithoutSet: false, setWithoutGet: false}]
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx', '**/*.d.ts'],
rules: {
'no-unused-expressions': 'warn',
// For parquet module
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-non-null-asserted-optional-chain': 0,
// Gradually enable
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/ban-types': 0,
'@typescript-eslint/no-unsafe-member-access': 0,
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-unused-vars': [
'warn',
{vars: 'all', args: 'none', ignoreRestSiblings: false}
],
// We still have some issues with import resolution
'import/named': 0,
'import/no-extraneous-dependencies': ['warn'],
// Warn instead of error
// 'max-params': ['warn'],
// 'no-undef': ['warn'],
// camelcase: ['warn'],
// '@typescript-eslint/no-floating-promises': ['warn'],
// '@typescript-eslint/await-thenable': ['warn'],
// '@typescript-eslint/no-misused-promises': ['warn'],
'@typescript-eslint/no-empty-function': ['warn', {allow: ['arrowFunctions']}],
// We use function hoisting
'@typescript-eslint/no-use-before-define': 0,
// We always want explicit typing, e.g `field: string = ''`
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/restrict-template-expressions': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/require-await': 0,
'@typescript-eslint/no-unsafe-return': 0,
'@typescript-eslint/no-unsafe-call': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/restrict-plus-operands': 0
}
},
// tests are run with aliases set up in node and webpack.
// This means lint will not find the imported files and generate false warnings
{
// scripts use devDependencies
files: ['**/test/**/*.js', '**/scripts/**/*.js', '*.config.js', '*.config.local.js'],
rules: {
'import/no-unresolved': 0,
'import/no-extraneous-dependencies': 0
}
}
],
settings: {
// Ensure eslint finds typescript files
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx']
}
}
}
});
// config.overrides[1].parserOptions = {
// project: ['./tsconfig.json']
// };
// Uncomment to log the eslint config
// console.debug(config);
module.exports = config;
/*
TODO - remove. Pre-ocular eslintrc
module.exports = {
parserOptions: {
ecmaVersion: 2020
},
env: {
browser: true,
node: true
},
globals: {
globalThis: 'readonly',
GPUBufferUsage: 'readonly',
GPUTextureUsage: 'readonly'
},
extends: ['uber-es2015', 'prettier', 'plugin:import/errors'],
parser: '@typescript-eslint/parser',
plugins: ['tree-shaking', 'luma-gl-custom-rules', 'import'],
rules: {
'guard-for-in': 0,
'no-inline-comments': 0,
camelcase: 0,
'max-statements': 0,
'max-depth': 0,
'max-params': 0,
complexity: 0,
'luma-gl-custom-rules/check-log-call': 1,
'import/no-unresolved': ['error'],
'import/no-extraneous-dependencies': [
'error',
{devDependencies: false, peerDependencies: true}
],
// Turn on to help debug tree-shaking issues
'tree-shaking/no-side-effects-in-initialization': 0
},
};
*/