-
-
Notifications
You must be signed in to change notification settings - Fork 36.6k
Expand file tree
/
Copy patheslint.config.js
More file actions
157 lines (151 loc) · 3.54 KB
/
Copy patheslint.config.js
File metadata and controls
157 lines (151 loc) · 3.54 KB
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
148
149
150
151
152
153
154
155
156
157
import js from '@eslint/js';
import globals from 'globals';
import mdcs from 'eslint-config-mdcs';
import compat from 'eslint-plugin-compat';
import html from 'eslint-plugin-html';
import jsdoc from 'eslint-plugin-jsdoc';
export default [
// files to ignore
{
name: 'files to ignore',
ignores: [
'**/node_modules/**',
'**/build/**',
'examples/jsm/libs/**',
'test/treeshake/*.bundle.js',
'test/treeshake/*.bundle.min.js',
'editor/js/libs/acorn/**',
'editor/js/libs/codemirror/**',
'editor/js/libs/tern-threejs/**',
'editor/js/libs/ternjs/**',
'editor/js/libs/esprima.js',
'editor/js/libs/jsonlint.js',
'editor/js/libs/signals.min.js',
'**/ifc/**',
'**/prettify.js',
'**/prettify/**',
'**/3rdparty/**',
'**/shapefile.js',
'**/vendor/**',
'**/fuse/**',
'**/template/static/**',
]
},
// recommended
js.configs.recommended,
// jsdoc.configs['flat/recommended'],
// base rules
{
name: 'base rules',
files: [ '**/*.js', '**/*.html' ],
plugins: {
html,
compat,
jsdoc
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.es2017,
__THREE_DEVTOOLS__: 'readonly',
potpack: 'readonly',
fflate: 'readonly',
Stats: 'readonly',
XRWebGLBinding: 'readonly',
XRWebGLLayer: 'readonly',
GPUShaderStage: 'readonly',
GPUBufferUsage: 'readonly',
GPUTextureUsage: 'readonly',
GPUTexture: 'readonly',
GPUMapMode: 'readonly',
QUnit: 'readonly',
Ammo: 'readonly',
XRRigidTransform: 'readonly',
XRMediaBinding: 'readonly',
CodeMirror: 'readonly',
esprima: 'readonly',
jsonlint: 'readonly',
VideoFrame: 'readonly',
VideoDecoder: 'readonly',
Float16Array: 'readonly',
BigInt: 'readonly',
BigUint64Array: 'readonly'
},
},
settings: {
polyfills: [
'WebGL2RenderingContext'
],
jsdoc: {
preferredTypes: {
Any: 'any',
Boolean: 'boolean',
Number: 'number',
object: 'Object',
String: 'string'
},
tagNamePreference: {
returns: 'return',
extends: 'augments'
},
},
},
rules: {
...mdcs.rules,
...compat.configs.recommended.rules,
'no-throw-literal': 'error',
'quotes': [ 'error', 'single' ],
'prefer-const': [ 'error', {
destructuring: 'any',
ignoreReadBeforeAssign: false
} ],
'no-irregular-whitespace': 'error',
'no-duplicate-imports': 'error',
'prefer-spread': 'error',
// 'eqeqeq': 'error',
'no-useless-escape': 'off',
'no-case-declarations': 'off',
'no-cond-assign': 'off',
'getter-return': 'off',
'no-async-promise-executor': 'off',
'no-empty': 'off',
'no-fallthrough': 'off',
'no-prototype-builtins': 'off',
'no-loss-of-precision': 'off',
'no-unused-vars': [ 'error', {
caughtErrors: 'none',
} ],
'jsdoc/check-types': 'error',
'jsdoc/require-returns': 'off',
'jsdoc/require-returns-type': 'error',
'jsdoc/require-param-description': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/require-param-type': 'error'
}
},
// editor rules
{
name: 'editor rules',
files: [ 'editor/**/*.js' ],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module'
}
},
// tests must import from src, not build
{
name: 'unit test rules',
files: [ 'test/unit/**/*.js' ],
rules: {
'no-restricted-imports': [ 'error', {
patterns: [ {
group: [ '**/build/*' ],
message: 'Tests must import from /src, not /build as build is not guaranteed to be fresh.'
} ]
} ]
}
}
];