eslint-plugin-ore-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +3 -0
- package/LICENSE +21 -0
- package/README.md +604 -0
- package/dist/index.cjs +121 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +274 -0
- package/dist/rules/no-bugged.cjs +621 -0
- package/dist/rules/no-bugged.cjs.map +1 -0
- package/dist/rules/no-bugged.d.cts +9 -0
- package/dist/rules/no-critically-bugged.cjs +623 -0
- package/dist/rules/no-critically-bugged.cjs.map +1 -0
- package/dist/rules/no-critically-bugged.d.cts +9 -0
- package/dist/rules/no-illegal-constructors.cjs +516 -0
- package/dist/rules/no-illegal-constructors.cjs.map +1 -0
- package/dist/rules/no-illegal-constructors.d.cts +9 -0
- package/dist/rules/no-regex-unicode-properties.cjs +34 -0
- package/dist/rules/no-regex-unicode-properties.cjs.map +1 -0
- package/dist/rules/no-regex-unicode-properties.d.cts +17 -0
- package/dist/rules/no-regex-v-flag.cjs +26 -0
- package/dist/rules/no-regex-v-flag.cjs.map +1 -0
- package/dist/rules/no-regex-v-flag.d.cts +17 -0
- package/dist/rules/no-using-keyword.cjs +57 -0
- package/dist/rules/no-using-keyword.cjs.map +1 -0
- package/dist/rules/no-using-keyword.d.cts +35 -0
- package/package.json +109 -0
package/Changelog.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 8Crafter Studios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
# eslint-plugin-ore-ui
|
|
2
|
+
|
|
3
|
+
<!--  --> <!-- TODO -->
|
|
4
|
+
|
|
5
|
+
[](https://npmjs.com/package/eslint-plugin-ore-ui)
|
|
6
|
+
[](https://npmjs.com/package/eslint-plugin-ore-ui)
|
|
7
|
+
[](https://npmjs.com/package/eslint-plugin-ore-ui)
|
|
8
|
+
[](https://npmjs.com/package/eslint-plugin-ore-ui)
|
|
9
|
+
[](https://npmjs.com/package/eslint-plugin-ore-ui)
|
|
10
|
+
[](https://github.com/8Crafter-Studios/eslint-plugin-ore-ui/commits/main)
|
|
11
|
+
[](https://discord.8crafter.com)
|
|
12
|
+
|
|
13
|
+
An ESLint plugin to be used on Minecraft Bedrock Edition Ore UI scripts.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install ESLint if you haven't already:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm i eslint --save-dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Install the plugin:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm i eslint-plugin-ore-ui --save-dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Flat Config
|
|
32
|
+
|
|
33
|
+
Here are several examples of flat configs using this plugin:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
// eslint.config.js
|
|
37
|
+
import oreUIPlugin from "eslint-plugin-ore-ui";
|
|
38
|
+
|
|
39
|
+
export default [
|
|
40
|
+
// Enables the plugin and enables the recommended config (without type checking).
|
|
41
|
+
oreUIPlugin.flatConfigs.recommended,
|
|
42
|
+
];
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
// eslint.config.js
|
|
47
|
+
import { defineConfig } from "eslint/config";
|
|
48
|
+
import tseslint from "typescript-eslint";
|
|
49
|
+
import oreUIPlugin from "eslint-plugin-ore-ui";
|
|
50
|
+
|
|
51
|
+
export default defineConfig(
|
|
52
|
+
// Enables the typescript-eslint plugin and enables the recommended config for it (with type checking).
|
|
53
|
+
tseslint.configs.recommendedTypeChecked,
|
|
54
|
+
// Enables the plugin and enables the recommended config (with type checking).
|
|
55
|
+
oreUIPlugin.flatConfigs.recommendedTypeChecked,
|
|
56
|
+
{
|
|
57
|
+
languageOptions: {
|
|
58
|
+
ecmaVersion: "latest",
|
|
59
|
+
sourceType: "module",
|
|
60
|
+
globals: {
|
|
61
|
+
...globals.es2015,
|
|
62
|
+
...globals.node,
|
|
63
|
+
},
|
|
64
|
+
parser: tseslint.parser,
|
|
65
|
+
parserOptions: {
|
|
66
|
+
// Required: Without this, the type checked options will throw errors.
|
|
67
|
+
projectService: true,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
// eslint.config.mts
|
|
76
|
+
import { defineConfig } from "eslint/config";
|
|
77
|
+
import tseslint from "typescript-eslint";
|
|
78
|
+
import oreUIPlugin from "eslint-plugin-ore-ui";
|
|
79
|
+
|
|
80
|
+
export default defineConfig(
|
|
81
|
+
// Enables the typescript-eslint plugin and enables the recommended config for it (with type checking).
|
|
82
|
+
tseslint.configs.recommendedTypeChecked,
|
|
83
|
+
// Enables the plugin and enables the recommended config (with type checking).
|
|
84
|
+
oreUIPlugin.flatConfigs.recommendedTypeChecked,
|
|
85
|
+
{
|
|
86
|
+
languageOptions: {
|
|
87
|
+
ecmaVersion: "latest",
|
|
88
|
+
sourceType: "module",
|
|
89
|
+
globals: {
|
|
90
|
+
...globals.es2015,
|
|
91
|
+
...globals.node,
|
|
92
|
+
},
|
|
93
|
+
parser: tseslint.parser,
|
|
94
|
+
parserOptions: {
|
|
95
|
+
// Required: Without this, the type checked options will throw errors.
|
|
96
|
+
projectService: true,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```cjs
|
|
104
|
+
// eslint.config.cjs
|
|
105
|
+
const { defineConfig } = require("eslint/config");
|
|
106
|
+
const tseslint = require("typescript-eslint");
|
|
107
|
+
const oreUIPlugin = require("eslint-plugin-ore-ui");
|
|
108
|
+
|
|
109
|
+
module.exports = defineConfig([
|
|
110
|
+
// Enables the typescript-eslint plugin and enables the recommended config for it (with type checking).
|
|
111
|
+
tseslint.configs.recommendedTypeChecked,
|
|
112
|
+
// Enables the plugin and enables the recommended config (with type checking).
|
|
113
|
+
oreUIPlugin.flatConfigs.recommendedTypeChecked,
|
|
114
|
+
{
|
|
115
|
+
languageOptions: {
|
|
116
|
+
ecmaVersion: "latest",
|
|
117
|
+
sourceType: "module",
|
|
118
|
+
globals: {
|
|
119
|
+
...globals.es2015,
|
|
120
|
+
...globals.node,
|
|
121
|
+
},
|
|
122
|
+
// Required: Without this, the type checked options will throw errors.
|
|
123
|
+
parser: tseslint.parser,
|
|
124
|
+
parserOptions: {
|
|
125
|
+
// Required: Without this, the type checked options will throw errors.
|
|
126
|
+
projectService: true,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
files: ["*.js", "*.cjs", "*.mjs"],
|
|
132
|
+
// Disables the type checked rules on JS files.
|
|
133
|
+
extends: [tseslint.configs.disableTypeChecked, oreUIPlugin.flatConfigs.disableTypeChecked],
|
|
134
|
+
languageOptions: {
|
|
135
|
+
parserOptions: {
|
|
136
|
+
projectService: false,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
]);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Legacy Config
|
|
144
|
+
|
|
145
|
+
Here are four examples of legacy configs using this plugin:
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
// .eslintrc.json
|
|
149
|
+
{
|
|
150
|
+
"extends": [
|
|
151
|
+
// Enables the plugin and enables the recommended config (without type checking).
|
|
152
|
+
"plugin:ore-ui/recommended"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
// .eslintrc
|
|
159
|
+
{
|
|
160
|
+
"extends": [
|
|
161
|
+
// Enables the typescript-eslint plugin and enables the recommended config for it (with type checking).
|
|
162
|
+
"plugin:@typescript-eslint/recommended-type-checked",
|
|
163
|
+
// Enables the plugin and enables the recommended config (with type checking).
|
|
164
|
+
"plugin:ore-ui/recommended-type-checked"
|
|
165
|
+
],
|
|
166
|
+
// Required for type checked rules.
|
|
167
|
+
"parser": "@typescript-eslint/parser",
|
|
168
|
+
"root": true,
|
|
169
|
+
"parserOptions": {
|
|
170
|
+
// Required for type checked rules.
|
|
171
|
+
"project": true
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
// .eslintrc
|
|
178
|
+
{
|
|
179
|
+
// Required for type checked rules.
|
|
180
|
+
"parser": "@typescript-eslint/parser",
|
|
181
|
+
"plugins": [
|
|
182
|
+
// Enables the typescript-eslint plugin.
|
|
183
|
+
"@typescript-eslint/eslint-plugin",
|
|
184
|
+
// Enables the plugin.
|
|
185
|
+
"ore-ui",
|
|
186
|
+
// Enabled the no-import-attributes plugin.
|
|
187
|
+
"no-import-attributes"
|
|
188
|
+
],
|
|
189
|
+
"rules": {
|
|
190
|
+
// Configures the recommended type checked options.
|
|
191
|
+
"no-import-attributes/no-import-attributes": ["error", "Import attributes are not supported by CoHTML (Ore UI)."],
|
|
192
|
+
"ore-ui/no-illegal-constructors": "error",
|
|
193
|
+
"ore-ui/no-bugged": "warn",
|
|
194
|
+
"ore-ui/no-critically-bugged": "error",
|
|
195
|
+
"ore-ui/no-regex-unicode-properties": "warn",
|
|
196
|
+
"ore-ui/no-regex-v-flag": "error",
|
|
197
|
+
"ore-ui/no-using-keyword": "error"
|
|
198
|
+
},
|
|
199
|
+
"root": true,
|
|
200
|
+
"parserOptions": {
|
|
201
|
+
// Required for type checked rules.
|
|
202
|
+
"project": true
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
```cjs
|
|
208
|
+
// .eslintrc.cjs
|
|
209
|
+
/* eslint-env node */
|
|
210
|
+
import {} from "eslint-plugin-ore-ui";
|
|
211
|
+
module.exports = {
|
|
212
|
+
extends: ["plugin:ore-ui/recommended"],
|
|
213
|
+
rules: {
|
|
214
|
+
// Disables the `ore-ui/no-regex-unicode-properties` rule.
|
|
215
|
+
"ore-ui/no-regex-unicode-properties": "off",
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Rules
|
|
221
|
+
|
|
222
|
+
### `ore-ui/no-illegal-constructors`
|
|
223
|
+
|
|
224
|
+
Disallow using constructing constructors marked as being an illegal constructor.
|
|
225
|
+
|
|
226
|
+
#### Options
|
|
227
|
+
|
|
228
|
+
This rule accepts the following options:
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
type Options = [
|
|
232
|
+
{
|
|
233
|
+
/** Type specifiers that can be allowed. */
|
|
234
|
+
allow?: (
|
|
235
|
+
| {
|
|
236
|
+
from: "file";
|
|
237
|
+
name: string | string[];
|
|
238
|
+
path?: string;
|
|
239
|
+
}
|
|
240
|
+
| {
|
|
241
|
+
from: "lib";
|
|
242
|
+
name: string | string[];
|
|
243
|
+
}
|
|
244
|
+
| {
|
|
245
|
+
from: "package";
|
|
246
|
+
name: string | string[];
|
|
247
|
+
package: string;
|
|
248
|
+
}
|
|
249
|
+
| string
|
|
250
|
+
)[];
|
|
251
|
+
/** Whether to ignore the built-in illegal constructor messages. */
|
|
252
|
+
ignoreBuiltInIllegalConstructorMessages?: boolean;
|
|
253
|
+
/** Additional illegal constructor messages to check for. */
|
|
254
|
+
additionalIllegalConstructorMessages?: IllegalConstructorMessage[];
|
|
255
|
+
},
|
|
256
|
+
];
|
|
257
|
+
|
|
258
|
+
interface IllegalConstructorMessage {
|
|
259
|
+
/** The message to filter JSDoc comments by, only matching JSDoc comments will cause a violation. If not provided, any JSDoc tag of the specified name will cause a violation. */
|
|
260
|
+
message?:
|
|
261
|
+
| string
|
|
262
|
+
| {
|
|
263
|
+
regex: string;
|
|
264
|
+
flags?: string;
|
|
265
|
+
};
|
|
266
|
+
/** The JSDoc tag name or a list of JSDoc tag names to filter by, should not be prefixed with '@'. ex. 'throws' */
|
|
267
|
+
tagName: string | string[];
|
|
268
|
+
/** The reason for the violation, this is what will be reported. ex. If the reason is 'This is only constructable by the engine itself.', the message will be '`{{name}}` is an illegal constructor. This is only constructable by the engine itself.' */
|
|
269
|
+
reason?: string;
|
|
270
|
+
/** The error message to report. This will take precedence over `reason`. Unlike reason, this does not prepend '`{{name}}` is an illegal constructor.' to the reason. ex. If the reason override is 'This is only constructable by the engine itself.', the message will be 'This is only constructable by the engine itself.' */
|
|
271
|
+
reasonOverride?: string;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const defaultOptions: Options = [
|
|
275
|
+
{
|
|
276
|
+
allow: [],
|
|
277
|
+
ignoreBuiltInIllegalConstructorMessages: false,
|
|
278
|
+
additionalIllegalConstructorMessages: [],
|
|
279
|
+
},
|
|
280
|
+
];
|
|
281
|
+
|
|
282
|
+
const builtInIllegalConstructorMessages: IllegalConstructorMessage[] = [
|
|
283
|
+
{
|
|
284
|
+
message: {
|
|
285
|
+
regex: "^(?:\\{[^\\}]*\\} )?Throws an [`\"']Illegal constructor[`\"'] error as this is only constructable by the engine itself\\.",
|
|
286
|
+
flags: "",
|
|
287
|
+
},
|
|
288
|
+
tagName: "throws",
|
|
289
|
+
reason: "This is only constructable by the engine itself.",
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
message: {
|
|
293
|
+
regex: "^(?:\\{[^\\}]*\\} )?\\(BROWSER ONLY\\) Throws an [`\"']Illegal constructor[`\"'] error as this is only constructable by the engine itself\\.",
|
|
294
|
+
flags: "",
|
|
295
|
+
},
|
|
296
|
+
tagName: "throws",
|
|
297
|
+
reason: "In the browser, this is only constructable by the engine itself.",
|
|
298
|
+
},
|
|
299
|
+
];
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
### `ore-ui/no-bugged`
|
|
305
|
+
|
|
306
|
+
Disallow bugged symbols.
|
|
307
|
+
|
|
308
|
+
#### Options
|
|
309
|
+
|
|
310
|
+
This rule accepts the following options:
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
type Options = [
|
|
314
|
+
{
|
|
315
|
+
/** Type specifiers that can be allowed. */
|
|
316
|
+
allow?: (
|
|
317
|
+
| {
|
|
318
|
+
from: "file";
|
|
319
|
+
name: string | string[];
|
|
320
|
+
path?: string;
|
|
321
|
+
}
|
|
322
|
+
| {
|
|
323
|
+
from: "lib";
|
|
324
|
+
name: string | string[];
|
|
325
|
+
}
|
|
326
|
+
| {
|
|
327
|
+
from: "package";
|
|
328
|
+
name: string | string[];
|
|
329
|
+
package: string;
|
|
330
|
+
}
|
|
331
|
+
| string
|
|
332
|
+
)[];
|
|
333
|
+
/** Whether to ignore the built-in bugged messages. */
|
|
334
|
+
ignoreBuiltInBuggedMessages?: boolean;
|
|
335
|
+
/** Additional bugged messages to check for. */
|
|
336
|
+
additionalBuggedMessages?: BuggedMessage[];
|
|
337
|
+
},
|
|
338
|
+
];
|
|
339
|
+
|
|
340
|
+
type StringOrRegExpFilterItem =
|
|
341
|
+
| string
|
|
342
|
+
| {
|
|
343
|
+
regex: string;
|
|
344
|
+
flags?: string;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
type StringOrRegExpFilter = StringOrRegExpFilterItem | StringOrRegExpFilterItem[];
|
|
348
|
+
|
|
349
|
+
interface BuggedMessage {
|
|
350
|
+
/** The message to filter JSDoc comments by, only matching JSDoc comments will cause a violation. If not provided, any JSDoc tag of the specified name will cause a violation. */
|
|
351
|
+
message?: StringOrRegExpFilterItem;
|
|
352
|
+
/** The prefix filtering options, these are used to find the start of the bug description, only matching JSDoc comments will cause a violation. */
|
|
353
|
+
prefix:
|
|
354
|
+
| {
|
|
355
|
+
/** The JSDoc tag name or a list of JSDoc tag names to filter by, should not be prefixed with '@'. ex. 'throws' */
|
|
356
|
+
tagName: StringOrRegExpFilter;
|
|
357
|
+
}
|
|
358
|
+
| {
|
|
359
|
+
/** The prefix to filter by, this is text that would be at the start of a line in the JSDoc, immediately followed by a colon, should not be suffixed with a colon. ex. 'Critical Bug' or 'Bug!!' */
|
|
360
|
+
prefix: StringOrRegExpFilter;
|
|
361
|
+
}
|
|
362
|
+
| {
|
|
363
|
+
/** The JSDoc tag name or a list of JSDoc tag names to filter by, should not be prefixed with '@'. ex. 'throws' */
|
|
364
|
+
tagName: StringOrRegExpFilter;
|
|
365
|
+
/** The prefix to filter by, this is text that would be at the start of a line in the JSDoc, immediately followed by a colon, should not be suffixed with a colon. ex. 'Critical Bug' or 'Bug!!' */
|
|
366
|
+
prefix: StringOrRegExpFilter;
|
|
367
|
+
};
|
|
368
|
+
/** The reason for the violation, this is what will be reported, if not specified, the message will be the bug description. ex. If the reason is 'This does not work at all in CoHTML (Ore UI).', the message will be '`{{name}}` has a bug. This does not work at all in CoHTML (Ore UI).' */
|
|
369
|
+
reason?: string;
|
|
370
|
+
/** The error message to report. This will take precedence over `reason`. Unlike reason, this does not prepend '`{{name}}` has a bug.' to the reason. ex. If the reason override is 'This does not work at all in CoHTML (Ore UI).', the message will be 'This does not work at all in CoHTML (Ore UI).' */
|
|
371
|
+
reasonOverride?: string;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const defaultOptions: Options = [
|
|
375
|
+
{
|
|
376
|
+
allow: [],
|
|
377
|
+
ignoreBuiltInBuggedMessages: false,
|
|
378
|
+
additionalBuggedMessages: [],
|
|
379
|
+
},
|
|
380
|
+
];
|
|
381
|
+
|
|
382
|
+
const builtInBuggedMessages: BuggedMessage[] = [
|
|
383
|
+
{
|
|
384
|
+
prefix: {
|
|
385
|
+
tagName: [
|
|
386
|
+
{ regex: "^bugged1$", flags: "i" },
|
|
387
|
+
{ regex: "^bug1$", flags: "i" },
|
|
388
|
+
],
|
|
389
|
+
prefix: ["Bug!", "!Bug"],
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
];
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
### `ore-ui/no-critically-bugged`
|
|
398
|
+
|
|
399
|
+
Disallow critically bugged symbols.
|
|
400
|
+
|
|
401
|
+
#### Options
|
|
402
|
+
|
|
403
|
+
This rule accepts the following options:
|
|
404
|
+
|
|
405
|
+
```ts
|
|
406
|
+
type Options = [
|
|
407
|
+
{
|
|
408
|
+
/** Type specifiers that can be allowed. */
|
|
409
|
+
allow?: (
|
|
410
|
+
| {
|
|
411
|
+
from: "file";
|
|
412
|
+
name: string | string[];
|
|
413
|
+
path?: string;
|
|
414
|
+
}
|
|
415
|
+
| {
|
|
416
|
+
from: "lib";
|
|
417
|
+
name: string | string[];
|
|
418
|
+
}
|
|
419
|
+
| {
|
|
420
|
+
from: "package";
|
|
421
|
+
name: string | string[];
|
|
422
|
+
package: string;
|
|
423
|
+
}
|
|
424
|
+
| string
|
|
425
|
+
)[];
|
|
426
|
+
/** Whether to ignore the built-in critically bugged messages. */
|
|
427
|
+
ignoreBuiltInCriticallyBuggedMessages?: boolean;
|
|
428
|
+
/** Additional critically bugged messages to check for. */
|
|
429
|
+
additionalCriticallyBuggedMessages?: CriticallyBuggedMessage[];
|
|
430
|
+
},
|
|
431
|
+
];
|
|
432
|
+
|
|
433
|
+
type StringOrRegExpFilterItem =
|
|
434
|
+
| string
|
|
435
|
+
| {
|
|
436
|
+
regex: string;
|
|
437
|
+
flags?: string;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
type StringOrRegExpFilter = StringOrRegExpFilterItem | StringOrRegExpFilterItem[];
|
|
441
|
+
|
|
442
|
+
interface CriticallyBuggedMessage {
|
|
443
|
+
/** The message to filter JSDoc comments by, only matching JSDoc comments will cause a violation. If not provided, any JSDoc tag of the specified name will cause a violation. */
|
|
444
|
+
message?: StringOrRegExpFilterItem;
|
|
445
|
+
/** The prefix filtering options, these are used to find the start of the bug description, only matching JSDoc comments will cause a violation. */
|
|
446
|
+
prefix:
|
|
447
|
+
| {
|
|
448
|
+
/** The JSDoc tag name or a list of JSDoc tag names to filter by, should not be prefixed with '@'. ex. 'throws' */
|
|
449
|
+
tagName: StringOrRegExpFilter;
|
|
450
|
+
}
|
|
451
|
+
| {
|
|
452
|
+
/** The prefix to filter by, this is text that would be at the start of a line in the JSDoc, immediately followed by a colon, should not be suffixed with a colon. ex. 'Critical Bug' or 'Bug!!' */
|
|
453
|
+
prefix: StringOrRegExpFilter;
|
|
454
|
+
}
|
|
455
|
+
| {
|
|
456
|
+
/** The JSDoc tag name or a list of JSDoc tag names to filter by, should not be prefixed with '@'. ex. 'throws' */
|
|
457
|
+
tagName: StringOrRegExpFilter;
|
|
458
|
+
/** The prefix to filter by, this is text that would be at the start of a line in the JSDoc, immediately followed by a colon, should not be suffixed with a colon. ex. 'Critical Bug' or 'Bug!!' */
|
|
459
|
+
prefix: StringOrRegExpFilter;
|
|
460
|
+
};
|
|
461
|
+
/** The reason for the violation, this is what will be reported, if not specified, the message will be the bug description. ex. If the reason is 'This does not work at all in CoHTML (Ore UI).', the message will be '`{{name}}` has a critical bug. This does not work at all in CoHTML (Ore UI).' */
|
|
462
|
+
reason?: string;
|
|
463
|
+
/** The error message to report. This will take precedence over `reason`. Unlike reason, this does not prepend '`{{name}}` has a critical bug.' to the reason. ex. If the reason override is 'This does not work at all in CoHTML (Ore UI).', the message will be 'This does not work at all in CoHTML (Ore UI).' */
|
|
464
|
+
reasonOverride?: string;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const defaultOptions: Options = [
|
|
468
|
+
{
|
|
469
|
+
allow: [],
|
|
470
|
+
ignoreBuiltInCriticallyBuggedMessages: false,
|
|
471
|
+
additionalCriticallyBuggedMessages: [],
|
|
472
|
+
},
|
|
473
|
+
];
|
|
474
|
+
|
|
475
|
+
const builtInCriticallyBuggedMessages: CriticallyBuggedMessage[] = [
|
|
476
|
+
{
|
|
477
|
+
prefix: {
|
|
478
|
+
tagName: [
|
|
479
|
+
{ regex: "^criticallyBugged$", flags: "i" },
|
|
480
|
+
{ regex: "^criticalBug$", flags: "i" },
|
|
481
|
+
{ regex: "^bugged2$", flags: "i" },
|
|
482
|
+
{ regex: "^bug2$", flags: "i" },
|
|
483
|
+
],
|
|
484
|
+
prefix: ["Critical Bug", "Bug (Critical)", "Bug!!", "!!Bug"],
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
];
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
### `ore-ui/no-regex-unicode-properties`
|
|
493
|
+
|
|
494
|
+
Disallow regex Unicode property escapes.
|
|
495
|
+
|
|
496
|
+
#### Options
|
|
497
|
+
|
|
498
|
+
This rule is not configurable.
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
### `ore-ui/no-regex-v-flag`
|
|
503
|
+
|
|
504
|
+
Disallow the `v` regex flag.
|
|
505
|
+
|
|
506
|
+
#### Options
|
|
507
|
+
|
|
508
|
+
This rule is not configurable.
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
### `ore-ui/no-using-keyword`
|
|
513
|
+
|
|
514
|
+
Disallow the `using` keyword.
|
|
515
|
+
|
|
516
|
+
#### Options
|
|
517
|
+
|
|
518
|
+
```ts
|
|
519
|
+
type Options = [
|
|
520
|
+
{
|
|
521
|
+
/** Types of using variable declarations that can be allowed. Should be one of `using` or `await using`. Defaults to an empty array. */
|
|
522
|
+
allow?: ("using" | "await using")[];
|
|
523
|
+
},
|
|
524
|
+
];
|
|
525
|
+
|
|
526
|
+
const defaultOptions: Options = [
|
|
527
|
+
{
|
|
528
|
+
allow: [],
|
|
529
|
+
},
|
|
530
|
+
];
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
## Configs
|
|
534
|
+
|
|
535
|
+
### `ore-ui/recommended`
|
|
536
|
+
|
|
537
|
+
The recommended config when not using type checked rules.
|
|
538
|
+
|
|
539
|
+
Legacy Config ID: `plugin:ore-ui/recommended`\
|
|
540
|
+
Flat Config Property Path: `plugin.flatConfigs.recommended`
|
|
541
|
+
|
|
542
|
+
```ts
|
|
543
|
+
const plugins = [
|
|
544
|
+
// This plugin.
|
|
545
|
+
"ore-ui",
|
|
546
|
+
// The `no-import-attributes` plugin (`eslint-plugin-no-import-attributes` on NPM).
|
|
547
|
+
"no-import-attributes",
|
|
548
|
+
];
|
|
549
|
+
|
|
550
|
+
const rules = {
|
|
551
|
+
"no-import-attributes/no-import-attributes": ["error", "Import attributes are not supported by CoHTML (Ore UI)."],
|
|
552
|
+
"ore-ui/no-illegal-constructors": "off",
|
|
553
|
+
"ore-ui/no-bugged": "off",
|
|
554
|
+
"ore-ui/no-critically-bugged": "off",
|
|
555
|
+
"ore-ui/no-regex-unicode-properties": "warn",
|
|
556
|
+
"ore-ui/no-regex-v-flag": "error",
|
|
557
|
+
"ore-ui/no-using-keyword": "error",
|
|
558
|
+
};
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
### `ore-ui/recommended-type-checked`
|
|
564
|
+
|
|
565
|
+
The recommended config when using type checked rules.
|
|
566
|
+
|
|
567
|
+
Legacy Config ID: `plugin:ore-ui/recommended-type-checked`\
|
|
568
|
+
Flat Config Property Path: `plugin.flatConfigs.recommendedTypeChecked`
|
|
569
|
+
|
|
570
|
+
```ts
|
|
571
|
+
const plugins = [
|
|
572
|
+
// This plugin.
|
|
573
|
+
"ore-ui",
|
|
574
|
+
// The `no-import-attributes` plugin (`eslint-plugin-no-import-attributes` on NPM).
|
|
575
|
+
"no-import-attributes",
|
|
576
|
+
];
|
|
577
|
+
|
|
578
|
+
const rules = {
|
|
579
|
+
"no-import-attributes/no-import-attributes": ["error", "Import attributes are not supported by CoHTML (Ore UI)."] as const,
|
|
580
|
+
"ore-ui/no-illegal-constructors": "error",
|
|
581
|
+
"ore-ui/no-bugged": "warn",
|
|
582
|
+
"ore-ui/no-critically-bugged": "error",
|
|
583
|
+
"ore-ui/no-regex-unicode-properties": "warn",
|
|
584
|
+
"ore-ui/no-regex-v-flag": "error",
|
|
585
|
+
"ore-ui/no-using-keyword": "error",
|
|
586
|
+
};
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
### `ore-ui/disable-type-checked`
|
|
592
|
+
|
|
593
|
+
Disable type checked rules.
|
|
594
|
+
|
|
595
|
+
Legacy Config ID: `plugin:ore-ui/disable-type-checked`\
|
|
596
|
+
Flat Config Property Path: `plugin.flatConfigs.disableTypeChecked`
|
|
597
|
+
|
|
598
|
+
```ts
|
|
599
|
+
const rules = {
|
|
600
|
+
"ore-ui/no-illegal-constructors": "off",
|
|
601
|
+
"ore-ui/no-bugged": "off",
|
|
602
|
+
"ore-ui/no-critically-bugged": "off",
|
|
603
|
+
};
|
|
604
|
+
```
|