Skip to content

Commit 9f2fb59

Browse files
authored
Dev: Migrate to ESLint 9, flat config (#32471)
1 parent 132069c commit 9f2fb59

File tree

4 files changed

+542
-337
lines changed

4 files changed

+542
-337
lines changed

.eslintrc.json

Lines changed: 0 additions & 88 deletions
This file was deleted.

eslint.config.js

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import mdcs from 'eslint-config-mdcs';
4+
import compat from 'eslint-plugin-compat';
5+
import html from 'eslint-plugin-html';
6+
import importPlugin from 'eslint-plugin-import';
7+
import jsdoc from 'eslint-plugin-jsdoc';
8+
9+
export default [
10+
// files to ignore
11+
{
12+
name: 'files to ignore',
13+
ignores: [
14+
'**/node_modules/**',
15+
'**/build/**',
16+
'**/libs/**',
17+
'**/ifc/**',
18+
'**/prettify.js',
19+
'**/prettify/**',
20+
'**/3rdparty/**',
21+
'**/shapefile.js',
22+
'**/vendor/**',
23+
'**/fuse/**'
24+
]
25+
},
26+
27+
// recommended
28+
js.configs.recommended,
29+
// jsdoc.configs['flat/recommended'],
30+
31+
// base rules
32+
{
33+
name: 'base rules',
34+
files: [ '**/*.js', '**/*.html' ],
35+
plugins: {
36+
html,
37+
import: importPlugin,
38+
compat,
39+
jsdoc
40+
},
41+
languageOptions: {
42+
ecmaVersion: 2018,
43+
sourceType: 'module',
44+
globals: {
45+
...globals.browser,
46+
...globals.node,
47+
...globals.es2017,
48+
__THREE_DEVTOOLS__: 'readonly',
49+
potpack: 'readonly',
50+
fflate: 'readonly',
51+
Stats: 'readonly',
52+
XRWebGLBinding: 'readonly',
53+
XRWebGLLayer: 'readonly',
54+
GPUShaderStage: 'readonly',
55+
GPUBufferUsage: 'readonly',
56+
GPUTextureUsage: 'readonly',
57+
GPUTexture: 'readonly',
58+
GPUMapMode: 'readonly',
59+
QUnit: 'readonly',
60+
Ammo: 'readonly',
61+
XRRigidTransform: 'readonly',
62+
XRMediaBinding: 'readonly',
63+
CodeMirror: 'readonly',
64+
esprima: 'readonly',
65+
jsonlint: 'readonly',
66+
VideoFrame: 'readonly',
67+
VideoDecoder: 'readonly',
68+
Float16Array: 'readonly',
69+
BigInt: 'readonly',
70+
BigUint64Array: 'readonly'
71+
},
72+
},
73+
settings: {
74+
polyfills: [
75+
'WebGL2RenderingContext'
76+
],
77+
jsdoc: {
78+
preferredTypes: {
79+
Any: 'any',
80+
Boolean: 'boolean',
81+
Number: 'number',
82+
object: 'Object',
83+
String: 'string'
84+
},
85+
tagNamePreference: {
86+
returns: 'return',
87+
extends: 'augments'
88+
},
89+
},
90+
},
91+
rules: {
92+
...mdcs.rules,
93+
...compat.configs.recommended.rules,
94+
'no-throw-literal': 'error',
95+
'quotes': [ 'error', 'single' ],
96+
'prefer-const': [ 'error', {
97+
destructuring: 'any',
98+
ignoreReadBeforeAssign: false
99+
} ],
100+
'no-irregular-whitespace': 'error',
101+
'no-duplicate-imports': 'error',
102+
'prefer-spread': 'error',
103+
104+
'no-useless-escape': 'off',
105+
'no-case-declarations': 'off',
106+
'no-cond-assign': 'off',
107+
'getter-return': 'off',
108+
'no-async-promise-executor': 'off',
109+
'no-empty': 'off',
110+
111+
// 'jsdoc/check-types': 'error',
112+
'jsdoc/require-returns': 'off',
113+
'jsdoc/require-returns-type': 'error',
114+
'jsdoc/require-param-description': 'off',
115+
'jsdoc/require-returns-description': 'off',
116+
'jsdoc/require-param-type': 'error'
117+
}
118+
}
119+
];

0 commit comments

Comments
 (0)