eslint-plugin-greasemonkey 1.8.4 → 1.9.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/README.md +304 -64
- package/docs/LICENSE.md +1 -1
- package/package.json +47 -41
- package/src/data/headers.js +24 -0
- package/src/index.d.ts +33 -3
- package/src/index.js +5 -80
- package/src/rules/meta-order.js +3 -4
- package/src/rules/meta-spacing.js +2 -2
- package/src/rules/no-duplicate-keys.js +2 -2
- package/src/rules/no-insecure-fetch.js +109 -0
- package/src/rules/no-insecure-messaging.js +68 -0
- package/src/rules/no-invalid-grants.js +3 -3
- package/src/rules/no-invalid-headers.js +3 -3
- package/src/rules/no-missing-grants.js +3 -3
- package/src/rules/no-missing-resources.js +4 -3
- package/src/rules/no-unused-grants.js +2 -2
- package/src/rules/no-unused-resources.js +6 -5
- package/src/rules/prefer-gm-add-style.js +66 -0
- package/src/rules/prefer-match.js +4 -3
- package/src/rules/require-homepage-pair.js +3 -4
- package/src/rules/require-matching-localized-fields.js +2 -2
- package/src/rules/require-required-fields.js +2 -2
- package/src/rules/require-space-before-meta-key.js +2 -2
- package/src/rules/require-sri-hashing.js +3 -3
- package/src/rules/require-update-download-pair.js +3 -4
- package/src/rules/require-user-js-filename.js +2 -2
- package/src/rules/valid-field-values.js +2 -2
- package/src/utils/deprecations.js +76 -0
- package/src/utils/init.js +91 -0
- package/src/utils/metadata.js +31 -0
- package/src/utils/rules.js +7 -0
- package/src/utils/template.js +21 -0
- package/src/utils.js +0 -119
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<a target="_blank" href="https://www.npmjs.com/package/eslint-plugin-greasemonkey">
|
|
6
6
|
<img alt="[Latest Build]" src="https://img.shields.io/npm/v/eslint-plugin-greasemonkey?logo=icinga&style=for-the-badge&label=Latest%20Build&color=32fcee"></a>
|
|
7
|
-
<a href="
|
|
7
|
+
<a href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/src/branch/main/docs/LICENSE.md">
|
|
8
8
|
<img alt="[License: MIT]" src="https://img.shields.io/badge/License-MIT-f1f20a.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
9
9
|
<a target="_blank" href="https://getnpmstats.com/?package=eslint-plugin-greasemonkey&range=last-year&interval=monthly">
|
|
10
10
|
<img src="https://img.shields.io/npm/dm/eslint-plugin-greasemonkey?style=for-the-badge&logo=npm&color=black"></a>
|
|
@@ -52,7 +52,7 @@ export default [
|
|
|
52
52
|
]
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Available bundles: `recommended`, `strict` (everything), `problem` (deterministic bugs only), `tampermonkey`, `violentmonkey`, `greasemonkey`, `scriptcat`, `adguard`
|
|
55
|
+
Available bundles: `recommended`, `strict` (everything), `problem` (deterministic bugs only), `security`, `tampermonkey`, `violentmonkey`, `greasemonkey`, `scriptcat`, `adguard`
|
|
56
56
|
|
|
57
57
|
**Note:** Rule config is either a severity string (`'off'`, `'warn'`, `'error'`) or an array `[severity, options]` when the rule accepts options.
|
|
58
58
|
|
|
@@ -73,7 +73,7 @@ Available bundles: `recommended`, `strict` (everything), `problem` (deterministi
|
|
|
73
73
|
<img height=18 alt="[Stylistic]" src="https://img.shields.io/badge/Stylistic-af68ff?style=flat-square" align="middle"></a>
|
|
74
74
|
<a title="Accepts array w/ options" href="#usage">
|
|
75
75
|
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
76
|
-
<a title="Copy rule URL" target="_blank"
|
|
76
|
+
<a title="Copy rule URL" target="_blank"
|
|
77
77
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23meta-order">
|
|
78
78
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
79
79
|
</h3>
|
|
@@ -84,7 +84,7 @@ Available bundles: `recommended`, `strict` (everything), `problem` (deterministi
|
|
|
84
84
|
|
|
85
85
|
<h4 id="meta-order-options">Options</h4>
|
|
86
86
|
|
|
87
|
-
- `order` (default `[]`) – metadata keys in custom order (e.g. `['license', 'namespace']`) to selectively override built-in order with
|
|
87
|
+
- `order` (default `[]`) – metadata keys in custom order (e.g. `['license', 'namespace']`) to selectively override built-in order with – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.5.0">v1.5.0</a>]
|
|
88
88
|
|
|
89
89
|
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
90
90
|
|
|
@@ -132,7 +132,7 @@ If you don't care about the order of metadata fields.
|
|
|
132
132
|
- [`no-invalid-headers`](#no-invalid-headers)
|
|
133
133
|
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
134
134
|
<a title="Optimized in tampermonkey config" href="#usage"><img height=14 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
135
|
-
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-
|
|
135
|
+
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-c68a3c?style=flat-square" align="middle"></a>
|
|
136
136
|
<a title="Optimized in greasemonkey config" href="#usage"><img height=14 alt="[Greasemonkey]" src="https://img.shields.io/badge/Greasemonkey-6c4d8c?style=flat-square" align="middle"></a>
|
|
137
137
|
<a title="Optimized in scriptcat config" href="#usage"><img height=14 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
|
|
138
138
|
<a title="Optimized in adguard config" href="#usage"><img height=14 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
@@ -150,6 +150,8 @@ If you don't care about the order of metadata fields.
|
|
|
150
150
|
|
|
151
151
|
<h3 id="meta-spacing">
|
|
152
152
|
<code>meta-spacing</code>
|
|
153
|
+
<a title="Introduced in v1.0.0" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">
|
|
154
|
+
<img height=18 align="middle" src="https://api.iconify.design/ph/flag-banner-fold-fill.svg?color=%234a4a4a"></a>
|
|
153
155
|
<a title="Included in recommended config" href="#usage">
|
|
154
156
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
155
157
|
<a title="Accepts eslint --fix" target="_blank" href="https://eslint.org/docs/latest/use/command-line-interface#--fix">
|
|
@@ -158,7 +160,7 @@ If you don't care about the order of metadata fields.
|
|
|
158
160
|
<img height=18 alt="[Stylistic]" src="https://img.shields.io/badge/Stylistic-af68ff?style=flat-square" align="middle"></a>
|
|
159
161
|
<a title="Accepts array w/ options" href="#usage">
|
|
160
162
|
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
161
|
-
<a title="Copy rule URL" target="_blank"
|
|
163
|
+
<a title="Copy rule URL" target="_blank"
|
|
162
164
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23meta-spacing">
|
|
163
165
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
164
166
|
</h3>
|
|
@@ -169,13 +171,13 @@ If you don't care about the order of metadata fields.
|
|
|
169
171
|
|
|
170
172
|
<h4 id="meta-spacing-options">Options</h4>
|
|
171
173
|
|
|
172
|
-
- `spaces` (default `3`) – minimum spaces after the longest key
|
|
174
|
+
- `spaces` (default `3`) – minimum spaces after the longest key – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
173
175
|
|
|
174
176
|
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
175
177
|
|
|
176
178
|
```diff
|
|
177
179
|
/* eslint greasemonkey/meta-spacing: ['error', { spaces: 1 }] */
|
|
178
|
-
|
|
180
|
+
|
|
179
181
|
// ==UserScript==
|
|
180
182
|
! // @name My Script
|
|
181
183
|
// @namespace example.com
|
|
@@ -187,7 +189,7 @@ If you don't care about the order of metadata fields.
|
|
|
187
189
|
|
|
188
190
|
```diff
|
|
189
191
|
/* eslint greasemonkey/meta-spacing: ['error', { spaces: 1 }] */
|
|
190
|
-
|
|
192
|
+
|
|
191
193
|
// ==UserScript==
|
|
192
194
|
- // @name My Script
|
|
193
195
|
+ // @name My Script
|
|
@@ -230,7 +232,7 @@ If you don't care about visual alignment in metadata blocks.
|
|
|
230
232
|
<code>no-duplicate-keys</code>
|
|
231
233
|
<a title="Included in recommended config" href="#usage">
|
|
232
234
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
233
|
-
<a title="Copy rule URL" target="_blank"
|
|
235
|
+
<a title="Copy rule URL" target="_blank"
|
|
234
236
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-duplicate-keys">
|
|
235
237
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
236
238
|
</h3>
|
|
@@ -294,6 +296,170 @@ If you intentionally repeat single-value keys.
|
|
|
294
296
|
|
|
295
297
|
</details>
|
|
296
298
|
|
|
299
|
+
<h3 id="no-insecure-fetch">
|
|
300
|
+
<code>no-insecure-fetch</code>
|
|
301
|
+
<a title="Introduced in recent release" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.9.0">
|
|
302
|
+
<img height=16 align="middle" src="https://api.iconify.design/mdi/sprout.svg?color=%234a4a4a"></a>
|
|
303
|
+
<a title="Included in recommended config" href="#usage">
|
|
304
|
+
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
305
|
+
<a title="Included in security config" href="#usage">
|
|
306
|
+
<img height=18 alt="[Security]" src="https://img.shields.io/badge/Security-e8357a?style=flat-square" align="middle"></a>
|
|
307
|
+
<a title="Copy rule URL" target="_blank"
|
|
308
|
+
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-insecure-fetch">
|
|
309
|
+
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
310
|
+
</h3>
|
|
311
|
+
|
|
312
|
+
<details>
|
|
313
|
+
|
|
314
|
+
<summary>Flags <code>fetch()</code>, <code>XMLHttpRequest.open()</code>, <code>GM_xmlhttpRequest()</code>, <code>GM.xmlHttpRequest()</code> calls and URL fields that use <code>http://</code>.</summary>
|
|
315
|
+
|
|
316
|
+
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
317
|
+
|
|
318
|
+
```diff
|
|
319
|
+
// ==UserScript==
|
|
320
|
+
! // @require http://cdn.example.com/lib.js
|
|
321
|
+
! // @resource myCSS http://cdn.example.com/style.css
|
|
322
|
+
// ==/UserScript==
|
|
323
|
+
|
|
324
|
+
! fetch('http://api.example.com/data')
|
|
325
|
+
! GM_xmlhttpRequest({ method: 'GET', url: 'http://api.example.com/data' })
|
|
326
|
+
! GM.xmlHttpRequest({ method: 'GET', url: 'http://api.example.com/data' })
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/green.svg" align="bottom"> Correct code
|
|
330
|
+
|
|
331
|
+
```diff
|
|
332
|
+
// ==UserScript==
|
|
333
|
+
- // @require http://cdn.example.com/lib.js
|
|
334
|
+
+ // @require https://cdn.example.com/lib.js
|
|
335
|
+
- // @resource myCSS http://cdn.example.com/style.css
|
|
336
|
+
+ // @resource myCSS https://cdn.example.com/style.css
|
|
337
|
+
// ==/UserScript==
|
|
338
|
+
|
|
339
|
+
- fetch('http://api.example.com/data')
|
|
340
|
+
+ fetch('https://api.example.com/data')
|
|
341
|
+
- GM_xmlhttpRequest({ method: 'GET', url: 'http://api.example.com/data' })
|
|
342
|
+
+ GM_xmlhttpRequest({ method: 'GET', url: 'https://api.example.com/data' })
|
|
343
|
+
- GM.xmlHttpRequest({ method: 'GET', url: 'http://api.example.com/data' })
|
|
344
|
+
+ GM.xmlHttpRequest({ method: 'GET', url: 'https://api.example.com/data' })
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
#### When not to use it
|
|
348
|
+
|
|
349
|
+
If you intentionally target HTTP endpoints.
|
|
350
|
+
|
|
351
|
+
#### Introduced in
|
|
352
|
+
|
|
353
|
+
<a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.9.0">v1.9.0</a> (October 18, 2026)
|
|
354
|
+
|
|
355
|
+
#### See also
|
|
356
|
+
|
|
357
|
+
- [`prefer-match`](#prefer-match)
|
|
358
|
+
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
359
|
+
<a title="Included in security config" href="#usage"><img height=14 alt="[Security]" src="https://img.shields.io/badge/Security-e8357a?style=flat-square" align="middle"></a>
|
|
360
|
+
- [`require-sri-hashing`](#require-sri-hashing)
|
|
361
|
+
<a title="Included in strict config" href="#usage"><img height=14 alt="[Strict]" src="https://img.shields.io/badge/Strict-ff8c42?style=flat-square" align="middle"></a>
|
|
362
|
+
<a title="Included in security config" href="#usage"><img height=14 alt="[Security]" src="https://img.shields.io/badge/Security-e8357a?style=flat-square" align="middle"></a>
|
|
363
|
+
<a title="Accepts array w/ options" href="#require-sri-hashing-options"><img height=14 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
364
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=rfc-editor.org&sz=64"> <a target="_blank" href="https://www.rfc-editor.org/info/rfc9110/">RFC 9110 — HTTP Semantics</a>
|
|
365
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=tampermonkey.net&sz=64"> <a target="_blank" href="https://www.tampermonkey.net/documentation.php?q=GM_xmlhttpRequest">Tampermonkey — `GM_xmlhttpRequest`</a>
|
|
366
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=violentmonkey.github.io&sz=64"> <a target="_blank" href="https://violentmonkey.github.io/api/gm/#gm_xmlhttprequest">Violentmonkey — `GM.xmlHttpRequest`</a>
|
|
367
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=developer.mozilla.org&sz=64"> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open">MDN — `XMLHttpRequest.open()`</a>
|
|
368
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=developer.mozilla.org&sz=64"> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch">MDN — `fetch()`</a>
|
|
369
|
+
|
|
370
|
+
<div align="center">
|
|
371
|
+
|
|
372
|
+
[Back to index ↑][epg-rules]
|
|
373
|
+
|
|
374
|
+
</div>
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
</details>
|
|
379
|
+
|
|
380
|
+
<h3 id="no-insecure-messaging">
|
|
381
|
+
<code>no-insecure-messaging</code>
|
|
382
|
+
<a title="Introduced in recent release" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.9.0">
|
|
383
|
+
<img height=16 align="middle" src="https://api.iconify.design/mdi/sprout.svg?color=%234a4a4a"></a>
|
|
384
|
+
<a title="Included in recommended config" href="#usage">
|
|
385
|
+
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
386
|
+
<a title="Included in security config" href="#usage">
|
|
387
|
+
<img height=18 alt="[Security]" src="https://img.shields.io/badge/Security-e8357a?style=flat-square" align="middle"></a>
|
|
388
|
+
<a title="Accepts array w/ options" href="#usage">
|
|
389
|
+
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
390
|
+
<a title="Copy rule URL" target="_blank"
|
|
391
|
+
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-insecure-messaging">
|
|
392
|
+
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
393
|
+
</h3>
|
|
394
|
+
|
|
395
|
+
<details>
|
|
396
|
+
|
|
397
|
+
<summary>Requires origin/source validation + explicit <code>postMessage()</code> target.</summary>
|
|
398
|
+
|
|
399
|
+
<h4 id="no-insecure-messaging-options">Options</h4>
|
|
400
|
+
|
|
401
|
+
- `disallowWildcardTarget` (default `true`) – flag <code>postMessage()</code> calls that use <code>'*'</code> as <code>targetOrigin</code>
|
|
402
|
+
|
|
403
|
+
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
404
|
+
|
|
405
|
+
```diff
|
|
406
|
+
window.addEventListener('message', event => {
|
|
407
|
+
! handle(event.data)
|
|
408
|
+
})
|
|
409
|
+
|
|
410
|
+
unsafeWindow.addEventListener('message', event => {
|
|
411
|
+
! handle(event.data)
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
! window.postMessage(payload, '*')
|
|
415
|
+
! unsafeWindow.postMessage(payload, '*')
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/green.svg" align="bottom"> Correct code
|
|
419
|
+
|
|
420
|
+
```diff
|
|
421
|
+
window.addEventListener('message', event => {
|
|
422
|
+
+ if (event.origin !== 'https://allowed-origin.com') return
|
|
423
|
+
handle(event.data)
|
|
424
|
+
})
|
|
425
|
+
|
|
426
|
+
unsafeWindow.addEventListener('message', event => {
|
|
427
|
+
+ if (event.origin !== 'https://allowed-origin.com') return
|
|
428
|
+
handle(event.data)
|
|
429
|
+
})
|
|
430
|
+
|
|
431
|
+
- window.postMessage(payload, '*')
|
|
432
|
+
+ window.postMessage(payload, 'https://allowed-origin.com')
|
|
433
|
+
- unsafeWindow.postMessage(payload, '*')
|
|
434
|
+
+ unsafeWindow.postMessage(payload, 'https://allowed-origin.com')
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
#### When not to use it
|
|
438
|
+
|
|
439
|
+
If you intentionally handle messages from any origin, or broadcast to any frame on the page.
|
|
440
|
+
|
|
441
|
+
#### Introduced in
|
|
442
|
+
|
|
443
|
+
<a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.9.0">v1.9.0</a> (October 18, 2026)
|
|
444
|
+
|
|
445
|
+
#### See also
|
|
446
|
+
|
|
447
|
+
- [`no-insecure-fetch`](#no-insecure-fetch)
|
|
448
|
+
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
449
|
+
<a title="Included in security config" href="#usage"><img height=14 alt="[Security]" src="https://img.shields.io/badge/Security-e8357a?style=flat-square" align="middle"></a>
|
|
450
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=developer.mozilla.org&sz=64"> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#security_concerns">MDN — `window.postMessage()` security concerns</a>
|
|
451
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=developer.mozilla.org&sz=64"> <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Window/message_event">MDN — `message` event</a>
|
|
452
|
+
|
|
453
|
+
<div align="center">
|
|
454
|
+
|
|
455
|
+
[Back to index ↑][epg-rules]
|
|
456
|
+
|
|
457
|
+
</div>
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
</details>
|
|
462
|
+
|
|
297
463
|
<h3 id="no-invalid-grants"><a deprecated id="valid-grants"></a>
|
|
298
464
|
<code>no-invalid-grants</code>
|
|
299
465
|
<a title="Included in recommended config" href="#usage">
|
|
@@ -301,7 +467,7 @@ If you intentionally repeat single-value keys.
|
|
|
301
467
|
<a title="Optimized in tampermonkey config" href="#usage">
|
|
302
468
|
<img height=18 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
303
469
|
<a title="Optimized in violentmonkey config" href="#usage">
|
|
304
|
-
<img height=18 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-
|
|
470
|
+
<img height=18 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-c68a3c?style=flat-square" align="middle"></a>
|
|
305
471
|
<a title="Optimized in greasemonkey config" href="#usage">
|
|
306
472
|
<img height=18 alt="[Greasemonkey]" src="https://img.shields.io/badge/Greasemonkey-6c4d8c?style=flat-square" align="middle"></a>
|
|
307
473
|
<a title="Optimized in scriptcat config" href="#usage">
|
|
@@ -310,7 +476,7 @@ If you intentionally repeat single-value keys.
|
|
|
310
476
|
<img height=18 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
311
477
|
<a title="Accepts array w/ options" href="#usage">
|
|
312
478
|
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
313
|
-
<a title="Copy rule URL" target="_blank"
|
|
479
|
+
<a title="Copy rule URL" target="_blank"
|
|
314
480
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-invalid-grants">
|
|
315
481
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
316
482
|
</h3>
|
|
@@ -321,21 +487,21 @@ If you intentionally repeat single-value keys.
|
|
|
321
487
|
|
|
322
488
|
<h4 id="no-invalid-grants-options">Options</h4>
|
|
323
489
|
|
|
324
|
-
- `target` (default `'all'`) – manager(s) whose grants to validate against (`'all'`, `'tampermonkey'`, `'violentmonkey'`, `'greasemonkey'`, `'scriptcat'`, `'adguard'`), as a single string or array
|
|
325
|
-
- `allowedGrants` (default `[]`) – additional `@grant` values to allow beyond the built-in list (covering Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat and AdGuard), as a single string or array
|
|
490
|
+
- `target` (default `'all'`) – manager(s) whose grants to validate against (`'all'`, `'tampermonkey'`, `'violentmonkey'`, `'greasemonkey'`, `'scriptcat'`, `'adguard'`), as a single string or array – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.2.0">v1.2.0</a>]
|
|
491
|
+
- `allowedGrants` (default `[]`) – additional `@grant` values to allow beyond the built-in list (covering Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat and AdGuard), as a single string or array – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.2.0">v1.2.0</a>]
|
|
326
492
|
|
|
327
493
|
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
328
494
|
|
|
329
495
|
```diff
|
|
330
496
|
/* eslint greasemonkey/no-invalid-grants: ['error', { target: 'tampermonkey' }] */
|
|
331
|
-
|
|
497
|
+
|
|
332
498
|
// ==UserScript==
|
|
333
499
|
// @grant GM_getTab
|
|
334
500
|
! // @grant CAT.agent.dom
|
|
335
501
|
// ==/UserScript==
|
|
336
502
|
|
|
337
503
|
/* eslint greasemonkey/no-invalid-grants: ['error', { target: 'scriptcat' }] */
|
|
338
|
-
|
|
504
|
+
|
|
339
505
|
// ==UserScript==
|
|
340
506
|
! // @grant GM_getTab
|
|
341
507
|
// @grant CAT.agent.dom
|
|
@@ -346,14 +512,14 @@ If you intentionally repeat single-value keys.
|
|
|
346
512
|
|
|
347
513
|
```diff
|
|
348
514
|
/* eslint greasemonkey/no-invalid-grants: ['error', { target: 'tampermonkey' }] */
|
|
349
|
-
|
|
515
|
+
|
|
350
516
|
// ==UserScript==
|
|
351
517
|
// @grant GM_getTab
|
|
352
518
|
- // @grant CAT.agent.dom
|
|
353
519
|
// ==/UserScript==
|
|
354
520
|
|
|
355
521
|
/* eslint greasemonkey/no-invalid-grants: ['error', { target: 'scriptcat' }] */
|
|
356
|
-
|
|
522
|
+
|
|
357
523
|
// ==UserScript==
|
|
358
524
|
- // @grant GM_getTab
|
|
359
525
|
// @grant CAT.agent.dom
|
|
@@ -391,12 +557,14 @@ If you don't want `@grant` validation at all. For individual uncovered grants, p
|
|
|
391
557
|
|
|
392
558
|
<h3 id="no-invalid-headers">
|
|
393
559
|
<code>no-invalid-headers</code>
|
|
560
|
+
<a title="Introduced in v1.0.0" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">
|
|
561
|
+
<img height=18 align="middle" src="https://api.iconify.design/ph/flag-banner-fold-fill.svg?color=%234a4a4a"></a>
|
|
394
562
|
<a title="Included in recommended config" href="#usage">
|
|
395
563
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
396
564
|
<a title="Optimized in tampermonkey config" href="#usage">
|
|
397
565
|
<img height=18 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
398
566
|
<a title="Optimized in violentmonkey config" href="#usage">
|
|
399
|
-
<img height=18 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-
|
|
567
|
+
<img height=18 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-c68a3c?style=flat-square" align="middle"></a>
|
|
400
568
|
<a title="Optimized in greasemonkey config" href="#usage">
|
|
401
569
|
<img height=18 alt="[Greasemonkey]" src="https://img.shields.io/badge/Greasemonkey-6c4d8c?style=flat-square" align="middle"></a>
|
|
402
570
|
<a title="Optimized in scriptcat config" href="#usage">
|
|
@@ -405,7 +573,7 @@ If you don't want `@grant` validation at all. For individual uncovered grants, p
|
|
|
405
573
|
<img height=18 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
406
574
|
<a title="Accepts array w/ options" href="#usage">
|
|
407
575
|
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
408
|
-
<a title="Copy rule URL" target="_blank"
|
|
576
|
+
<a title="Copy rule URL" target="_blank"
|
|
409
577
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-invalid-headers">
|
|
410
578
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
411
579
|
</h3>
|
|
@@ -416,14 +584,14 @@ If you don't want `@grant` validation at all. For individual uncovered grants, p
|
|
|
416
584
|
|
|
417
585
|
<h4 id="no-invalid-headers-options">Options</h4>
|
|
418
586
|
|
|
419
|
-
- `target` (default `'all'`) – manager(s) whose headers to validate against (`'all'`, `'tampermonkey'`, `'violentmonkey'`, `'greasemonkey'`, `'scriptcat'`, `'adguard'`), as a single string or array
|
|
420
|
-
- `allowedHeaders` (default `[]`) – additional headers to allow (strings or regexes), as a single value or array
|
|
587
|
+
- `target` (default `'all'`) – manager(s) whose headers to validate against (`'all'`, `'tampermonkey'`, `'violentmonkey'`, `'greasemonkey'`, `'scriptcat'`, `'adguard'`), as a single string or array – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
588
|
+
- `allowedHeaders` (default `[]`) – additional headers to allow (strings or regexes), as a single value or array – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
421
589
|
|
|
422
590
|
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
423
591
|
|
|
424
592
|
```diff
|
|
425
593
|
/* eslint greasemonkey/no-invalid-headers: ['error', { target: 'tampermonkey', allowedHeaders: /^\w*url$/i }] */
|
|
426
|
-
|
|
594
|
+
|
|
427
595
|
// ==UserScript==
|
|
428
596
|
// @name My Script
|
|
429
597
|
! // @runin normal-tabs
|
|
@@ -436,7 +604,7 @@ If you don't want `@grant` validation at all. For individual uncovered grants, p
|
|
|
436
604
|
|
|
437
605
|
```diff
|
|
438
606
|
/* eslint greasemonkey/no-invalid-headers: ['error', { target: 'tampermonkey', allowedHeaders: /^\w*url$/i }] */
|
|
439
|
-
|
|
607
|
+
|
|
440
608
|
// ==UserScript==
|
|
441
609
|
// @name My Script
|
|
442
610
|
- // @runin normal-tabs
|
|
@@ -460,7 +628,7 @@ If your script relies heavily on custom headers and you'd rather not maintain `a
|
|
|
460
628
|
- [`no-invalid-grants`](#no-invalid-grants)
|
|
461
629
|
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
462
630
|
<a title="Optimized in tampermonkey config" href="#usage"><img height=14 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
463
|
-
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-
|
|
631
|
+
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-c68a3c?style=flat-square" align="middle"></a>
|
|
464
632
|
<a title="Optimized in greasemonkey config" href="#usage"><img height=14 alt="[Greasemonkey]" src="https://img.shields.io/badge/Greasemonkey-6c4d8c?style=flat-square" align="middle"></a>
|
|
465
633
|
<a title="Optimized in scriptcat config" href="#usage"><img height=14 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
|
|
466
634
|
<a title="Optimized in adguard config" href="#usage"><img height=14 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
@@ -483,7 +651,7 @@ If your script relies heavily on custom headers and you'd rather not maintain `a
|
|
|
483
651
|
<code>no-missing-grants</code>
|
|
484
652
|
<a title="Included in recommended config" href="#usage">
|
|
485
653
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
486
|
-
<a title="Copy rule URL" target="_blank"
|
|
654
|
+
<a title="Copy rule URL" target="_blank"
|
|
487
655
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-missing-grants">
|
|
488
656
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
489
657
|
</h3>
|
|
@@ -498,7 +666,7 @@ If your script relies heavily on custom headers and you'd rather not maintain `a
|
|
|
498
666
|
// ==UserScript==
|
|
499
667
|
// @name My Script
|
|
500
668
|
// ==/UserScript==
|
|
501
|
-
|
|
669
|
+
|
|
502
670
|
! GM_setValue('key', 'value')
|
|
503
671
|
```
|
|
504
672
|
|
|
@@ -509,7 +677,7 @@ If your script relies heavily on custom headers and you'd rather not maintain `a
|
|
|
509
677
|
// @name My Script
|
|
510
678
|
+ // @grant GM_setValue
|
|
511
679
|
// ==/UserScript==
|
|
512
|
-
|
|
680
|
+
|
|
513
681
|
GM_setValue('key', 'value')
|
|
514
682
|
```
|
|
515
683
|
|
|
@@ -526,7 +694,7 @@ If you use APIs through aliases or wrappers that obscure the original call site.
|
|
|
526
694
|
- [`no-invalid-grants`](#no-invalid-grants)
|
|
527
695
|
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
528
696
|
<a title="Optimized in tampermonkey config" href="#usage"><img height=14 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
529
|
-
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-
|
|
697
|
+
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-c68a3c?style=flat-square" align="middle"></a>
|
|
530
698
|
<a title="Optimized in greasemonkey config" href="#usage"><img height=14 alt="[Greasemonkey]" src="https://img.shields.io/badge/Greasemonkey-6c4d8c?style=flat-square" align="middle"></a>
|
|
531
699
|
<a title="Optimized in scriptcat config" href="#usage"><img height=14 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
|
|
532
700
|
<a title="Optimized in adguard config" href="#usage"><img height=14 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
@@ -548,7 +716,7 @@ If you use APIs through aliases or wrappers that obscure the original call site.
|
|
|
548
716
|
<code>no-missing-resources</code>
|
|
549
717
|
<a title="Included in recommended config" href="#usage">
|
|
550
718
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
551
|
-
<a title="Copy rule URL" target="_blank"
|
|
719
|
+
<a title="Copy rule URL" target="_blank"
|
|
552
720
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-missing-resources">
|
|
553
721
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
554
722
|
</h3>
|
|
@@ -563,7 +731,7 @@ If you use APIs through aliases or wrappers that obscure the original call site.
|
|
|
563
731
|
// ==UserScript==
|
|
564
732
|
// @name My Script
|
|
565
733
|
// ==/UserScript==
|
|
566
|
-
|
|
734
|
+
|
|
567
735
|
! const css = GM_getResourceText('myCSS')
|
|
568
736
|
```
|
|
569
737
|
|
|
@@ -574,7 +742,7 @@ If you use APIs through aliases or wrappers that obscure the original call site.
|
|
|
574
742
|
// @name My Script
|
|
575
743
|
+ // @resource myCSS https://example.com/style.css
|
|
576
744
|
// ==/UserScript==
|
|
577
|
-
|
|
745
|
+
|
|
578
746
|
const css = GM_getResourceText('myCSS')
|
|
579
747
|
```
|
|
580
748
|
|
|
@@ -603,9 +771,11 @@ If you reference resources through an alias or computed pattern that obscures th
|
|
|
603
771
|
|
|
604
772
|
<h3 id="no-unused-grants">
|
|
605
773
|
<code>no-unused-grants</code>
|
|
774
|
+
<a title="Introduced in v1.0.0" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">
|
|
775
|
+
<img height=18 align="middle" src="https://api.iconify.design/ph/flag-banner-fold-fill.svg?color=%234a4a4a"></a>
|
|
606
776
|
<a title="Included in recommended config" href="#usage">
|
|
607
777
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
608
|
-
<a title="Copy rule URL" target="_blank"
|
|
778
|
+
<a title="Copy rule URL" target="_blank"
|
|
609
779
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-unused-grants">
|
|
610
780
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
611
781
|
</h3>
|
|
@@ -628,7 +798,7 @@ If you reference resources through an alias or computed pattern that obscures th
|
|
|
628
798
|
// ==UserScript==
|
|
629
799
|
// @grant GM_setValue
|
|
630
800
|
// ==/UserScript==
|
|
631
|
-
|
|
801
|
+
|
|
632
802
|
+ GM_setValue('key', 'value')
|
|
633
803
|
```
|
|
634
804
|
|
|
@@ -645,7 +815,7 @@ If you access the granted API through an alias or computed property rather than
|
|
|
645
815
|
- [`no-invalid-grants`](#no-invalid-grants)
|
|
646
816
|
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
647
817
|
<a title="Optimized in tampermonkey config" href="#usage"><img height=14 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
648
|
-
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-
|
|
818
|
+
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-c68a3c?style=flat-square" align="middle"></a>
|
|
649
819
|
<a title="Optimized in greasemonkey config" href="#usage"><img height=14 alt="[Greasemonkey]" src="https://img.shields.io/badge/Greasemonkey-6c4d8c?style=flat-square" align="middle"></a>
|
|
650
820
|
<a title="Optimized in scriptcat config" href="#usage"><img height=14 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
|
|
651
821
|
<a title="Optimized in adguard config" href="#usage"><img height=14 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
@@ -665,9 +835,11 @@ If you access the granted API through an alias or computed property rather than
|
|
|
665
835
|
|
|
666
836
|
<h3 id="no-unused-resources">
|
|
667
837
|
<code>no-unused-resources</code>
|
|
838
|
+
<a title="Introduced in v1.0.0" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">
|
|
839
|
+
<img height=18 align="middle" src="https://api.iconify.design/ph/flag-banner-fold-fill.svg?color=%234a4a4a"></a>
|
|
668
840
|
<a title="Included in recommended config" href="#usage">
|
|
669
841
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
670
|
-
<a title="Copy rule URL" target="_blank"
|
|
842
|
+
<a title="Copy rule URL" target="_blank"
|
|
671
843
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23no-unused-resources">
|
|
672
844
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
673
845
|
</h3>
|
|
@@ -690,7 +862,7 @@ If you access the granted API through an alias or computed property rather than
|
|
|
690
862
|
// ==UserScript==
|
|
691
863
|
// @resource myCSS https://example.com/style.css
|
|
692
864
|
// ==/UserScript==
|
|
693
|
-
|
|
865
|
+
|
|
694
866
|
+ const css = GM_getResourceText('myCSS')
|
|
695
867
|
```
|
|
696
868
|
|
|
@@ -717,11 +889,68 @@ If you pass resource names through variables or aliases rather than use them lit
|
|
|
717
889
|
|
|
718
890
|
</details>
|
|
719
891
|
|
|
892
|
+
<h3 id="prefer-gm-add-style">
|
|
893
|
+
<code>prefer-gm-add-style</code>
|
|
894
|
+
<a title="Introduced in recent release" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.9.0">
|
|
895
|
+
<img height=16 align="middle" src="https://api.iconify.design/mdi/sprout.svg?color=%234a4a4a"></a>
|
|
896
|
+
<a title="Only included in strict config" href="#usage">
|
|
897
|
+
<img height=18 alt="[Strict only]" src="https://img.shields.io/badge/Strict_only-ff8c42?style=flat-square" align="middle"></a>
|
|
898
|
+
<a title="Copy rule URL" target="_blank"
|
|
899
|
+
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23prefer-gm-add-style">
|
|
900
|
+
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
901
|
+
</h3>
|
|
902
|
+
|
|
903
|
+
<details>
|
|
904
|
+
|
|
905
|
+
<summary>Prefers <code>GM_addStyle()</code> or a shadow root over manual <code><style></code> injection.</summary>
|
|
906
|
+
|
|
907
|
+
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
908
|
+
|
|
909
|
+
```diff
|
|
910
|
+
! const style = document.createElement('style')
|
|
911
|
+
! style.textContent = 'body { color: red }'
|
|
912
|
+
! document.head.append(style)
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/green.svg" align="bottom"> Correct code
|
|
916
|
+
|
|
917
|
+
```diff
|
|
918
|
+
- const style = document.createElement('style')
|
|
919
|
+
- style.textContent = 'body { color: red }'
|
|
920
|
+
- document.head.append(style)
|
|
921
|
+
+ GM_addStyle('body { color: red }')
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
#### When not to use it
|
|
925
|
+
|
|
926
|
+
If you deliberately need manual control over the injected `<style>`.
|
|
927
|
+
|
|
928
|
+
#### Introduced in
|
|
929
|
+
|
|
930
|
+
<a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.9.0">v1.9.0</a> (October 18, 2026)
|
|
931
|
+
|
|
932
|
+
#### See also
|
|
933
|
+
|
|
934
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=tampermonkey.net&sz=64"> <a target="_blank" href="https://www.tampermonkey.net/documentation.php?q=GM_addStyle">Tampermonkey — `GM_addStyle`</a>
|
|
935
|
+
- <img height=12 src="https://www.google.com/s2/favicons?domain=docs.scriptcat.org&sz=64"> <a target="_blank" href="https://docs.scriptcat.org/en/docs/dev/api/#gm_addstyle">ScriptCat — `GM_addStyle`</a>
|
|
936
|
+
|
|
937
|
+
<div align="center">
|
|
938
|
+
|
|
939
|
+
[Back to index ↑][epg-rules]
|
|
940
|
+
|
|
941
|
+
</div>
|
|
942
|
+
|
|
943
|
+
---
|
|
944
|
+
|
|
945
|
+
</details>
|
|
946
|
+
|
|
720
947
|
<h3 id="prefer-match">
|
|
721
948
|
<code>prefer-match</code>
|
|
722
949
|
<a title="Included in recommended config" href="#usage">
|
|
723
950
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
724
|
-
<a title="
|
|
951
|
+
<a title="Included in security config" href="#usage">
|
|
952
|
+
<img height=18 alt="[Security]" src="https://img.shields.io/badge/Security-e8357a?style=flat-square" align="middle"></a>
|
|
953
|
+
<a title="Copy rule URL" target="_blank"
|
|
725
954
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23prefer-match">
|
|
726
955
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
727
956
|
</h3>
|
|
@@ -778,7 +1007,7 @@ If you rely on `@include` patterns that cannot be expressed using `@match`.
|
|
|
778
1007
|
<img height=18 alt="[Auto-fixable]" src="https://img.shields.io/badge/Auto--fixable-3b5bdb?style=flat-square" align="middle"></a>
|
|
779
1008
|
<a title="Doesn't prevent bugs" href="#require-blank-line-after-meta-block">
|
|
780
1009
|
<img height=18 alt="[Stylistic]" src="https://img.shields.io/badge/Stylistic-af68ff?style=flat-square" align="middle"></a>
|
|
781
|
-
<a title="Copy rule URL" target="_blank"
|
|
1010
|
+
<a title="Copy rule URL" target="_blank"
|
|
782
1011
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-blank-line-after-meta-block">
|
|
783
1012
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
784
1013
|
</h3>
|
|
@@ -847,7 +1076,7 @@ If you don't care about visual separation between metadata and code.
|
|
|
847
1076
|
<img height=18 alt="[Strict only]" src="https://img.shields.io/badge/Strict_only-ff8c42?style=flat-square" align="middle"></a>
|
|
848
1077
|
<a title="Accepts eslint --fix" target="_blank" href="https://eslint.org/docs/latest/use/command-line-interface#--fix">
|
|
849
1078
|
<img height=18 alt="[Auto-fixable]" src="https://img.shields.io/badge/Auto--fixable-3b5bdb?style=flat-square" align="middle"></a>
|
|
850
|
-
<a title="Copy rule URL" target="_blank"
|
|
1079
|
+
<a title="Copy rule URL" target="_blank"
|
|
851
1080
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-homepage-pair">
|
|
852
1081
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
853
1082
|
</h3>
|
|
@@ -898,11 +1127,13 @@ If you don't care about ensuring homepage URL compatibility across different man
|
|
|
898
1127
|
|
|
899
1128
|
<h3 id="require-matching-localized-fields">
|
|
900
1129
|
<code>require-matching-localized-fields</code>
|
|
1130
|
+
<a title="Introduced in v1.0.0" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">
|
|
1131
|
+
<img height=18 align="middle" src="https://api.iconify.design/ph/flag-banner-fold-fill.svg?color=%234a4a4a"></a>
|
|
901
1132
|
<a title="Included in recommended config" href="#usage">
|
|
902
1133
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
903
1134
|
<a title="Accepts array w/ options" href="#usage">
|
|
904
1135
|
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
905
|
-
<a title="Copy rule URL" target="_blank"
|
|
1136
|
+
<a title="Copy rule URL" target="_blank"
|
|
906
1137
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-matching-localized-fields">
|
|
907
1138
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
908
1139
|
</h3>
|
|
@@ -913,13 +1144,13 @@ If you don't care about ensuring homepage URL compatibility across different man
|
|
|
913
1144
|
|
|
914
1145
|
<h4 id="require-matching-localized-fields-options">Options</h4>
|
|
915
1146
|
|
|
916
|
-
- `ignoreLanguages` (default `[]`) – language code(s) to skip (e.g. `'de'` or `['es', 'fr']`)
|
|
1147
|
+
- `ignoreLanguages` (default `[]`) – language code(s) to skip (e.g. `'de'` or `['es', 'fr']`) – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
917
1148
|
|
|
918
1149
|
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
919
1150
|
|
|
920
1151
|
```diff
|
|
921
1152
|
/* eslint greasemonkey/require-matching-localized-fields: ['error', { ignoreLanguages: ['fr'] }] */
|
|
922
|
-
|
|
1153
|
+
|
|
923
1154
|
// ==UserScript==
|
|
924
1155
|
// @name:en My Script
|
|
925
1156
|
! // @name:de Mein Skript
|
|
@@ -932,7 +1163,7 @@ If you don't care about ensuring homepage URL compatibility across different man
|
|
|
932
1163
|
|
|
933
1164
|
```diff
|
|
934
1165
|
/* eslint greasemonkey/require-matching-localized-fields: ['error', { ignoreLanguages: ['fr'] }] */
|
|
935
|
-
|
|
1166
|
+
|
|
936
1167
|
// ==UserScript==
|
|
937
1168
|
// @name:en My Script
|
|
938
1169
|
// @name:de Mein Skript
|
|
@@ -970,11 +1201,13 @@ If you intentionally provide localized names without descriptions (or vice versa
|
|
|
970
1201
|
|
|
971
1202
|
<h3 id="require-required-fields">
|
|
972
1203
|
<code>require-required-fields</code>
|
|
1204
|
+
<a title="Introduced in v1.0.0" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">
|
|
1205
|
+
<img height=18 align="middle" src="https://api.iconify.design/ph/flag-banner-fold-fill.svg?color=%234a4a4a"></a>
|
|
973
1206
|
<a title="Included in recommended config" href="#usage">
|
|
974
1207
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
975
1208
|
<a title="Accepts array w/ options" href="#usage">
|
|
976
1209
|
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
977
|
-
<a title="Copy rule URL" target="_blank"
|
|
1210
|
+
<a title="Copy rule URL" target="_blank"
|
|
978
1211
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-required-fields">
|
|
979
1212
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
980
1213
|
</h3>
|
|
@@ -985,14 +1218,14 @@ If you intentionally provide localized names without descriptions (or vice versa
|
|
|
985
1218
|
|
|
986
1219
|
<h4 id="require-required-fields-options">Options</h4>
|
|
987
1220
|
|
|
988
|
-
- `fields` (default `['name', 'version']`) – override the required field list
|
|
989
|
-
- `requireMatchOrInclude` (default `true`) – require `@match` or `@include`
|
|
1221
|
+
- `fields` (default `['name', 'version']`) – override the required field list – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
1222
|
+
- `requireMatchOrInclude` (default `true`) – require `@match` or `@include` – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
990
1223
|
|
|
991
1224
|
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
992
1225
|
|
|
993
1226
|
```diff
|
|
994
1227
|
/* eslint greasemonkey/require-required-fields: ['error', { fields: ['name', 'version', 'license'] }] */
|
|
995
|
-
|
|
1228
|
+
|
|
996
1229
|
// ==UserScript==
|
|
997
1230
|
// @name My Script
|
|
998
1231
|
// ==/UserScript==
|
|
@@ -1002,7 +1235,7 @@ If you intentionally provide localized names without descriptions (or vice versa
|
|
|
1002
1235
|
|
|
1003
1236
|
```diff
|
|
1004
1237
|
/* eslint greasemonkey/require-required-fields: ['error', { fields: ['name', 'version', 'license'] }] */
|
|
1005
|
-
|
|
1238
|
+
|
|
1006
1239
|
// ==UserScript==
|
|
1007
1240
|
// @name My Script
|
|
1008
1241
|
+ // @version 1.0.0
|
|
@@ -1045,7 +1278,7 @@ If your script is a work-in-progress, or metadata is injected at build time.
|
|
|
1045
1278
|
<img height=18 alt="[Auto-fixable]" src="https://img.shields.io/badge/Auto--fixable-3b5bdb?style=flat-square" align="middle"></a>
|
|
1046
1279
|
<a title="Doesn't prevent bugs" href="#require-space-before-meta-key">
|
|
1047
1280
|
<img height=18 alt="[Stylistic]" src="https://img.shields.io/badge/Stylistic-af68ff?style=flat-square" align="middle"></a>
|
|
1048
|
-
<a title="Copy rule URL" target="_blank"
|
|
1281
|
+
<a title="Copy rule URL" target="_blank"
|
|
1049
1282
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-space-before-meta-key">
|
|
1050
1283
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
1051
1284
|
</h3>
|
|
@@ -1105,11 +1338,13 @@ If you intentionally use a different prefix style.
|
|
|
1105
1338
|
|
|
1106
1339
|
<h3 id="require-sri-hashing">
|
|
1107
1340
|
<code>require-sri-hashing</code>
|
|
1108
|
-
<a title="
|
|
1109
|
-
<img height=18 alt="[Strict
|
|
1341
|
+
<a title="Included in strict config" href="#usage">
|
|
1342
|
+
<img height=18 alt="[Strict]" src="https://img.shields.io/badge/Strict-ff8c42?style=flat-square" align="middle"></a>
|
|
1343
|
+
<a title="Included in security config" href="#usage">
|
|
1344
|
+
<img height=18 alt="[Security]" src="https://img.shields.io/badge/Security-e8357a?style=flat-square" align="middle"></a>
|
|
1110
1345
|
<a title="Accepts array w/ options" href="#usage">
|
|
1111
1346
|
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
1112
|
-
<a title="Copy rule URL" target="_blank"
|
|
1347
|
+
<a title="Copy rule URL" target="_blank"
|
|
1113
1348
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-sri-hashing">
|
|
1114
1349
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
1115
1350
|
</h3>
|
|
@@ -1120,7 +1355,7 @@ If you intentionally use a different prefix style.
|
|
|
1120
1355
|
|
|
1121
1356
|
<h4 id="require-sri-hashing-options">Options</h4>
|
|
1122
1357
|
|
|
1123
|
-
- `algorithm` (default `'sha256'`) – SRI hash algorithm(s) to enforce (`'md5'`, `'sha1'`, `'sha256'`, `'sha384'`, `'sha512'`), as a single string or array
|
|
1358
|
+
- `algorithm` (default `'sha256'`) – SRI hash algorithm(s) to enforce (`'md5'`, `'sha1'`, `'sha256'`, `'sha384'`, `'sha512'`), as a single string or array – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.5.0">v1.5.0</a>]
|
|
1124
1359
|
|
|
1125
1360
|
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
1126
1361
|
|
|
@@ -1158,6 +1393,9 @@ If you prefer shorter URLs, or don't support users who strictly enforce subresou
|
|
|
1158
1393
|
|
|
1159
1394
|
#### See also
|
|
1160
1395
|
|
|
1396
|
+
- [`no-insecure-fetch`](#no-insecure-fetch)
|
|
1397
|
+
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
1398
|
+
<a title="Included in security config" href="#usage"><img height=14 alt="[Security]" src="https://img.shields.io/badge/Security-e8357a?style=flat-square" align="middle"></a>
|
|
1161
1399
|
- <img height=12 src="https://www.google.com/s2/favicons?domain=tampermonkey.net&sz=64"> <a target="_blank" href="https://www.tampermonkey.net/documentation.php?q=sri">Tampermonkey — Subresource Integrity</a>
|
|
1162
1400
|
- <img height=12 src="https://www.google.com/s2/favicons?domain=docs.scriptcat.org&sz=64"> <a target="_blank" href="https://docs.scriptcat.org/en/docs/dev/meta/#resource-integrity-verification">ScriptCat — Resource Integrity Verification</a>
|
|
1163
1401
|
|
|
@@ -1181,7 +1419,7 @@ If you prefer shorter URLs, or don't support users who strictly enforce subresou
|
|
|
1181
1419
|
<img height=18 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
|
|
1182
1420
|
<a title="Included in adguard config" href="#usage">
|
|
1183
1421
|
<img height=18 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
1184
|
-
<a title="Copy rule URL" target="_blank"
|
|
1422
|
+
<a title="Copy rule URL" target="_blank"
|
|
1185
1423
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-update-download-pair">
|
|
1186
1424
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
1187
1425
|
</h3>
|
|
@@ -1234,7 +1472,7 @@ If you don't strictly target Tampermonkey, ScriptCat or AdGuard (where `@updateU
|
|
|
1234
1472
|
<code>require-user-js-filename</code>
|
|
1235
1473
|
<a title="Included in recommended config" href="#usage">
|
|
1236
1474
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
1237
|
-
<a title="Copy rule URL" target="_blank"
|
|
1475
|
+
<a title="Copy rule URL" target="_blank"
|
|
1238
1476
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-user-js-filename">
|
|
1239
1477
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
1240
1478
|
</h3>
|
|
@@ -1276,6 +1514,8 @@ If you intentionally name your userscripts something other than `*.user.js`.
|
|
|
1276
1514
|
|
|
1277
1515
|
<h3 id="valid-field-values">
|
|
1278
1516
|
<code>valid-field-values</code>
|
|
1517
|
+
<a title="Introduced in v1.0.0" target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">
|
|
1518
|
+
<img height=18 align="middle" src="https://api.iconify.design/ph/flag-banner-fold-fill.svg?color=%234a4a4a"></a>
|
|
1279
1519
|
<a title="Included in recommended config" href="#usage">
|
|
1280
1520
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
1281
1521
|
<a title="Accepts array w/ options" href="#usage">
|
|
@@ -1291,15 +1531,15 @@ If you intentionally name your userscripts something other than `*.user.js`.
|
|
|
1291
1531
|
|
|
1292
1532
|
<h4 id="valid-field-values-options">Options</h4>
|
|
1293
1533
|
|
|
1294
|
-
- `versionType` (default `'semver'`) – version format to enforce (`'semver'`, `'date'`)
|
|
1295
|
-
- `allowFutureDate` (default `false`) – allow `@version` dates later than the current date
|
|
1296
|
-
- `timezone` (default `''`) – <a target="_blank" href="https://data.iana.org/time-zones/tzdb/zone1970.tab">IANA timezone</a> used to determine the current date (when omitted, only year/month are enforced)
|
|
1534
|
+
- `versionType` (default `'semver'`) – version format to enforce (`'semver'`, `'date'`) – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
1535
|
+
- `allowFutureDate` (default `false`) – allow `@version` dates later than the current date – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
1536
|
+
- `timezone` (default `''`) – <a target="_blank" href="https://data.iana.org/time-zones/tzdb/zone1970.tab">IANA timezone</a> used to determine the current date (when omitted, only year/month are enforced) – [since <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/releases/tag/v1.0.0">v1.0.0</a>]
|
|
1297
1537
|
|
|
1298
1538
|
#### <img width=13 height=13 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/99f14247b2/assets/images/icons/square/with-symbol/gray.svg" align="bottom"> Incorrect code
|
|
1299
1539
|
|
|
1300
1540
|
```diff
|
|
1301
1541
|
/* eslint greasemonkey/valid-field-values: ['error', { versionType: 'semver' }] */
|
|
1302
|
-
|
|
1542
|
+
|
|
1303
1543
|
// ==UserScript==
|
|
1304
1544
|
! // @version abc
|
|
1305
1545
|
! // @homepage not-a-url
|
|
@@ -1310,7 +1550,7 @@ If you intentionally name your userscripts something other than `*.user.js`.
|
|
|
1310
1550
|
|
|
1311
1551
|
```diff
|
|
1312
1552
|
/* eslint greasemonkey/valid-field-values: ['error', { versionType: 'semver' }] */
|
|
1313
|
-
|
|
1553
|
+
|
|
1314
1554
|
// ==UserScript==
|
|
1315
1555
|
- // @version abc
|
|
1316
1556
|
+ // @version 1.0.0
|
|
@@ -1332,7 +1572,7 @@ If you use a custom versioning scheme or URLs that aren't standard.
|
|
|
1332
1572
|
- [`no-invalid-grants`](#no-invalid-grants)
|
|
1333
1573
|
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
1334
1574
|
<a title="Optimized in tampermonkey config" href="#usage"><img height=14 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
1335
|
-
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-
|
|
1575
|
+
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-c68a3c?style=flat-square" align="middle"></a>
|
|
1336
1576
|
<a title="Optimized in greasemonkey config" href="#usage"><img height=14 alt="[Greasemonkey]" src="https://img.shields.io/badge/Greasemonkey-6c4d8c?style=flat-square" align="middle"></a>
|
|
1337
1577
|
<a title="Optimized in scriptcat config" href="#usage"><img height=14 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
|
|
1338
1578
|
<a title="Optimized in adguard config" href="#usage"><img height=14 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
@@ -1340,7 +1580,7 @@ If you use a custom versioning scheme or URLs that aren't standard.
|
|
|
1340
1580
|
- [`no-invalid-headers`](#no-invalid-headers)
|
|
1341
1581
|
<a title="Included in recommended config" href="#usage"><img height=14 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
1342
1582
|
<a title="Optimized in tampermonkey config" href="#usage"><img height=14 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
1343
|
-
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-
|
|
1583
|
+
<a title="Optimized in violentmonkey config" href="#usage"><img height=14 alt="[Violentmonkey]" src="https://img.shields.io/badge/Violentmonkey-c68a3c?style=flat-square" align="middle"></a>
|
|
1344
1584
|
<a title="Optimized in greasemonkey config" href="#usage"><img height=14 alt="[Greasemonkey]" src="https://img.shields.io/badge/Greasemonkey-6c4d8c?style=flat-square" align="middle"></a>
|
|
1345
1585
|
<a title="Optimized in scriptcat config" href="#usage"><img height=14 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
|
|
1346
1586
|
<a title="Optimized in adguard config" href="#usage"><img height=14 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
@@ -1379,7 +1619,7 @@ If you use a custom versioning scheme or URLs that aren't standard.
|
|
|
1379
1619
|
## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/baseline-account-balance.svg?color=%232b2b2a"> License
|
|
1380
1620
|
|
|
1381
1621
|
<a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/src/branch/main/docs/LICENSE.md">
|
|
1382
|
-
<img height=
|
|
1622
|
+
<img height=80 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/9e820e5d51/assets/images/logos/mit-license/red-pixelated.png"></a>
|
|
1383
1623
|
<br><br>
|
|
1384
1624
|
|
|
1385
1625
|
<details>
|