eslint-plugin-greasemonkey 1.7.0 → 1.8.1

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 CHANGED
@@ -6,6 +6,7 @@
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
7
  <a href="#license">
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
+ <img src="https://img.shields.io/npm/dm/eslint-plugin-greasemonkey?style=for-the-badge&logo=npm&color=black">
9
10
  <a target="_blank" href="https://eslint.org/">
10
11
  <img alt="[Requires ESLint >=9.0.0]" src="https://img.shields.io/badge/Requires-ESLint_%3E%3D9.0.0-4B32C3?style=for-the-badge&logo=eslint"></a>
11
12
  <br><br>
@@ -16,7 +17,7 @@ ESLint rules for Greasemonkey userscripts.
16
17
 
17
18
  ---
18
19
 
19
- ## Installation
20
+ ## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/sharp-install-desktop.svg?color=%232b2b2a"> Installation
20
21
 
21
22
  From your project root:
22
23
 
@@ -27,10 +28,8 @@ npm i -D eslint-plugin-greasemonkey
27
28
  ---
28
29
 
29
30
  <h2 id="usage">
31
+ <img height=30 width=28 align="top" src="https://api.iconify.design/entypo/power-plug.svg?color=%232b2b2a">
30
32
  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
33
  </h2>
35
34
 
36
35
  Add a bundled config to your `eslint.config.*js`:
@@ -52,17 +51,15 @@ export default [
52
51
  ]
53
52
  ```
54
53
 
55
- Avaialble bundles: `recommended`, `strict`, `tampermonkey`, `violentmonkey`, `greasemonkey`, `scriptcat`, `adguard`
54
+ Available bundles: `recommended`, `strict`, `problem`, `tampermonkey`, `violentmonkey`, `greasemonkey`, `scriptcat`, `adguard`
56
55
 
57
56
  **Note:** Rule config is either a severity string (`'off'`, `'warn'`, `'error'`) or an array `[severity, options]` when the rule accepts options.
58
57
 
59
58
  ---
60
59
 
61
60
  <h2 id="supported-rules">
61
+ <img height=30 width=27 align="top" src="https://api.iconify.design/mdi/format-list-checks.svg?color=%232b2b2a">
62
62
  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
63
  </h2>
67
64
 
68
65
  <h3 id="meta-order">
@@ -1113,6 +1110,8 @@ If you prefer shorter URLs, or don't support users who strictly enforce subresou
1113
1110
  <img height=18 alt="[Tampermonkey]" src="https://img.shields.io/badge/Tampermonkey-00485b?style=flat-square" align="middle"></a>
1114
1111
  <a title="Included in scriptcat config" href="#usage">
1115
1112
  <img height=18 alt="[ScriptCat]" src="https://img.shields.io/badge/ScriptCat-1296dc?style=flat-square" align="middle"></a>
1113
+ <a title="Included in adguard config" href="#usage">
1114
+ <img height=18 alt="[AdGuard]" src="https://img.shields.io/badge/AdGuard-68bd72?style=flat-square" align="middle"></a>
1116
1115
  <a title="Copy rule URL" target="_blank"
1117
1116
  href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-greasemonkey%2F%23require-update-download-pair">
1118
1117
  <img height=16 width=21 alt="[Copy rule URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="middle"></a>
@@ -1141,7 +1140,7 @@ If you prefer shorter URLs, or don't support users who strictly enforce subresou
1141
1140
 
1142
1141
  #### When not to use it
1143
1142
 
1144
- If you don't target Tampermonkey or ScriptCat (where `@updateURL` avoids re-downloading the full script on every update check).
1143
+ If you don't target Tampermonkey, ScriptCat or AdGuard (where `@updateURL` avoids re-downloading the full script on every update check).
1145
1144
 
1146
1145
  #### Introduced in
1147
1146
 
@@ -1275,7 +1274,7 @@ If you use a custom versioning scheme or URLs that aren't standard.
1275
1274
 
1276
1275
  ---
1277
1276
 
1278
- ## Shield embed
1277
+ ## <img height=30 align="top" src="https://api.iconify.design/boxicons/code-alt-filled.svg?color=%232b2b2a"> Shield embed
1279
1278
 
1280
1279
  <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/#readme">
1281
1280
  <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 +1294,15 @@ If you use a custom versioning scheme or URLs that aren't standard.
1295
1294
 
1296
1295
  ---
1297
1296
 
1298
- ## License
1297
+ ## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/baseline-account-balance.svg?color=%232b2b2a"> License
1299
1298
 
1300
1299
  <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-greasemonkey/src/branch/main/docs/LICENSE.md">
1301
- <img height=62 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/9e820e5d51/assets/images/logos/mit-license/red-pixelated.png"></a>
1300
+ <img height=85 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/9e820e5d51/assets/images/logos/mit-license/red-pixelated.png"></a>
1302
1301
  <br><br>
1303
1302
 
1304
1303
  <details>
1305
1304
 
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>
1305
+ <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
1306
 
1308
1307
  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
1308
 
@@ -1315,7 +1314,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1315
1314
 
1316
1315
  ---
1317
1316
 
1318
- ## Related
1317
+ ## <img height=30 width=29 align="top" src="https://api.iconify.design/bxs/package.svg?color=%232b2b2a"> Related
1319
1318
 
1320
1319
  <!-- eslint-plugin-constructors -->
1321
1320
 
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-greasemonkey",
3
- "version": "1.7.0",
3
+ "version": "1.8.1",
4
4
  "description": "ESLint rules for Greasemonkey/Tampermonkey userscripts",
5
5
  "type": "module",
6
6
  "engines": {
@@ -69,16 +69,16 @@
69
69
  "@eslint/markdown": "^8.0.3",
70
70
  "@stylistic/eslint-plugin": "^5.10.0",
71
71
  "eslint": "^10.11.0",
72
- "eslint-plugin-constructors": "^1.3.0",
72
+ "eslint-plugin-constructors": "^1.4.0",
73
73
  "eslint-plugin-eslint-plugin": "^7.6.2",
74
74
  "eslint-plugin-import-x": "^4.17.1",
75
- "eslint-plugin-n": "^18.3.0",
75
+ "eslint-plugin-n": "^18.4.0",
76
76
  "eslint-plugin-no-secrets": "^2.3.3",
77
77
  "eslint-plugin-no-unsanitized": "^4.1.5",
78
78
  "eslint-plugin-promise": "^7.3.0",
79
79
  "eslint-plugin-regexp": "^3.3.1",
80
- "eslint-plugin-security": "^4.0.1",
81
- "globals": "^17.12.0",
80
+ "eslint-plugin-security": "^4.2.0",
81
+ "globals": "^17.13.0",
82
82
  "husky": "^9.1.7",
83
83
  "yamllint-js": "^0.2.4"
84
84
  }
@@ -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(([ruleId]) => [`greasemonkey/${ruleId}`, '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),
@@ -9,7 +9,7 @@ export default {
9
9
  recommended: true
10
10
  },
11
11
  schema: [],
12
- messages: { preferMatch: 'Use @match instead of @include (deprecated in Chrome MV3)' }
12
+ messages: { preferMatch: 'Use @match instead of @include' }
13
13
  },
14
14
 
15
15
  create(context) {