eslint-plugin-greasemonkey 1.7.0 → 1.8.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 +11 -13
- package/docs/LICENSE.md +1 -1
- package/package.json +1 -1
- package/src/data/deprecations.js +2 -2
- package/src/index.js +6 -0
- package/src/rules/meta-spacing.js +2 -1
- package/src/rules/prefer-match.js +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ ESLint rules for Greasemonkey userscripts.
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
## Installation
|
|
19
|
+
## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/sharp-install-desktop.svg?color=%232b2b2a"> Installation
|
|
20
20
|
|
|
21
21
|
From your project root:
|
|
22
22
|
|
|
@@ -27,10 +27,8 @@ npm i -D eslint-plugin-greasemonkey
|
|
|
27
27
|
---
|
|
28
28
|
|
|
29
29
|
<h2 id="usage">
|
|
30
|
+
<img height=30 width=28 align="top" src="https://api.iconify.design/entypo/power-plug.svg?color=%232b2b2a">
|
|
30
31
|
Usage
|
|
31
|
-
<a title="Copy section URL" target="_blank"
|
|
32
|
-
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23usage">
|
|
33
|
-
<img height=17 width=22 alt="[Copy section URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="bottom"></a>
|
|
34
32
|
</h2>
|
|
35
33
|
|
|
36
34
|
Add a bundled config to your `eslint.config.*js`:
|
|
@@ -52,17 +50,15 @@ export default [
|
|
|
52
50
|
]
|
|
53
51
|
```
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
Available bundles: `recommended`, `strict`, `problem`, `tampermonkey`, `violentmonkey`, `greasemonkey`, `scriptcat`, `adguard`
|
|
56
54
|
|
|
57
55
|
**Note:** Rule config is either a severity string (`'off'`, `'warn'`, `'error'`) or an array `[severity, options]` when the rule accepts options.
|
|
58
56
|
|
|
59
57
|
---
|
|
60
58
|
|
|
61
59
|
<h2 id="supported-rules">
|
|
60
|
+
<img height=30 width=27 align="top" src="https://api.iconify.design/mdi/format-list-checks.svg?color=%232b2b2a">
|
|
62
61
|
Supported rules
|
|
63
|
-
<a title="Copy section URL" target="_blank"
|
|
64
|
-
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23supported-rules">
|
|
65
|
-
<img height=17 width=22 alt="[Copy section URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="bottom"></a>
|
|
66
62
|
</h2>
|
|
67
63
|
|
|
68
64
|
<h3 id="meta-order">
|
|
@@ -1113,6 +1109,8 @@ If you prefer shorter URLs, or don't support users who strictly enforce subresou
|
|
|
1113
1109
|
<img height=18 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
|
|
1114
1110
|
<a title="Included in scriptcat config" href="#usage">
|
|
1115
1111
|
<img height=18 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
|
|
1112
|
+
<a title="Included in adguard config" href="#usage">
|
|
1113
|
+
<img height=18 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
|
|
1116
1114
|
<a title="Copy rule URL" target="_blank"
|
|
1117
1115
|
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-update-download-pair">
|
|
1118
1116
|
<img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
|
|
@@ -1275,7 +1273,7 @@ If you use a custom versioning scheme or URLs that aren't standard.
|
|
|
1275
1273
|
|
|
1276
1274
|
---
|
|
1277
1275
|
|
|
1278
|
-
## Shield embed
|
|
1276
|
+
## <img height=30 align="top" src="https://api.iconify.design/boxicons/code-alt-filled.svg?color=%232b2b2a"> Shield embed
|
|
1279
1277
|
|
|
1280
1278
|
<a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/#readme">
|
|
1281
1279
|
<img height=32 alt="[Linted by eslint-plugin-greasemonkey]" src="https://img.shields.io/badge/Linted_by-eslint--plugin--greasemonkey-black?logo=eslint&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
@@ -1295,15 +1293,15 @@ If you use a custom versioning scheme or URLs that aren't standard.
|
|
|
1295
1293
|
|
|
1296
1294
|
---
|
|
1297
1295
|
|
|
1298
|
-
## License
|
|
1296
|
+
## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/baseline-account-balance.svg?color=%232b2b2a"> License
|
|
1299
1297
|
|
|
1300
1298
|
<a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/src/branch/main/docs/LICENSE.md">
|
|
1301
|
-
<img height=
|
|
1299
|
+
<img height=85 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/9e820e5d51/assets/images/logos/mit-license/red-pixelated.png"></a>
|
|
1302
1300
|
<br><br>
|
|
1303
1301
|
|
|
1304
1302
|
<details>
|
|
1305
1303
|
|
|
1306
|
-
<summary>Copyright © 2026 <a target="_blank" href="https://codeberg.org/adamlui"><b>Adam Lui</b></a> under the <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/src/branch/main/docs/LICENSE.md"><b>MIT license</b></a>.</summary><br>
|
|
1304
|
+
<summary>Copyright © 2026 <a target="_blank" href="https://codeberg.org/adamlui"><b>Adam Lui</b></a> & contributors under the <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/src/branch/main/docs/LICENSE.md"><b>MIT license</b></a>.</summary><br>
|
|
1307
1305
|
|
|
1308
1306
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
1309
1307
|
|
|
@@ -1315,7 +1313,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
1315
1313
|
|
|
1316
1314
|
---
|
|
1317
1315
|
|
|
1318
|
-
## Related
|
|
1316
|
+
## <img height=30 width=29 align="top" src="https://api.iconify.design/bxs/package.svg?color=%232b2b2a"> Related
|
|
1319
1317
|
|
|
1320
1318
|
<!-- eslint-plugin-constructors -->
|
|
1321
1319
|
|
package/docs/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🏛️ MIT License
|
|
2
2
|
|
|
3
|
-
**Copyright © 2026 [Adam Lui](https://codeberg.org/adamlui).**
|
|
3
|
+
**Copyright © 2026 [Adam Lui](https://codeberg.org/adamlui) & contributors.**
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
package/package.json
CHANGED
package/src/data/deprecations.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Delete a line to end support
|
|
2
2
|
|
|
3
3
|
export const rules = { // old: new
|
|
4
|
-
'meta-spacing': { 'meta-spacing': { spaces: 3 }},
|
|
5
|
-
'meta-order': { 'meta-order': { order: [] }},
|
|
4
|
+
'meta-spacing': { 'meta-spacing': { spaces: 3 }}, // 2026-9-25 announced possible removal
|
|
5
|
+
'meta-order': { 'meta-order': { order: [] }}, // 2026-9-25 announced possible removal
|
|
6
6
|
'valid-grants': 'no-invalid-grants', // 2026-9-16 announced removal @ v2
|
|
7
7
|
'require-meta-newline': 'require-blank-line-after-meta-block' // 2026-9-13 announced removal @ v2
|
|
8
8
|
}
|
package/src/index.js
CHANGED
|
@@ -78,6 +78,12 @@ plugin.configs = {
|
|
|
78
78
|
strict: {
|
|
79
79
|
plugins: { greasemonkey: plugin },
|
|
80
80
|
rules: Object.fromEntries(Object.keys(plugin.rules).map(ruleId => [`greasemonkey/${ruleId}`, 'error']))
|
|
81
|
+
},
|
|
82
|
+
problem: {
|
|
83
|
+
plugins: { greasemonkey: plugin },
|
|
84
|
+
rules: Object.fromEntries(Object.entries(plugin.rules)
|
|
85
|
+
.filter(([, rule]) => rule.meta.type == 'problem')
|
|
86
|
+
.map(([id]) => [`greasemonkey/${id}`, 'error']))
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
|
|
@@ -34,12 +34,13 @@ export default {
|
|
|
34
34
|
if (!metaEntries.length) return
|
|
35
35
|
let targetCol = metaEntries.reduce((max, entry) => Math.max(max, entry.key.length), 0) + minSpaces +4
|
|
36
36
|
for (const entry of metaEntries)
|
|
37
|
-
if (entry.key == 'resource') {
|
|
37
|
+
if (entry.key == 'resource' && entry.value.trim()) {
|
|
38
38
|
const name = entry.value.trim().split(re.whitespace)[0],
|
|
39
39
|
requiredCol = 4 + entry.key.length +1 + name.length + minSpaces
|
|
40
40
|
if (requiredCol > targetCol) targetCol = requiredCol
|
|
41
41
|
}
|
|
42
42
|
for (const entry of metaEntries) {
|
|
43
|
+
if (!entry.value.trim()) continue
|
|
43
44
|
const commentText = sourceCode.getText(entry.comment),
|
|
44
45
|
keyIdx = commentText.indexOf(entry.key) + entry.key.length,
|
|
45
46
|
parts = entry.value.trim().split(re.whitespace),
|