@rigour-labs/core 3.0.4 → 3.0.6

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.
Files changed (47) hide show
  1. package/dist/gates/deprecated-apis-rules-lang.d.ts +21 -0
  2. package/dist/gates/deprecated-apis-rules-lang.js +311 -0
  3. package/dist/gates/deprecated-apis-rules-node.d.ts +19 -0
  4. package/dist/gates/deprecated-apis-rules-node.js +199 -0
  5. package/dist/gates/deprecated-apis-rules.d.ts +6 -0
  6. package/dist/gates/deprecated-apis-rules.js +6 -0
  7. package/dist/gates/deprecated-apis.js +1 -502
  8. package/dist/gates/hallucinated-imports-lang.d.ts +16 -0
  9. package/dist/gates/hallucinated-imports-lang.js +374 -0
  10. package/dist/gates/hallucinated-imports-stdlib.d.ts +12 -0
  11. package/dist/gates/hallucinated-imports-stdlib.js +228 -0
  12. package/dist/gates/hallucinated-imports.d.ts +0 -98
  13. package/dist/gates/hallucinated-imports.js +10 -678
  14. package/dist/gates/phantom-apis-data.d.ts +33 -0
  15. package/dist/gates/phantom-apis-data.js +398 -0
  16. package/dist/gates/phantom-apis.js +1 -393
  17. package/dist/gates/phantom-apis.test.js +52 -0
  18. package/dist/gates/promise-safety-helpers.d.ts +19 -0
  19. package/dist/gates/promise-safety-helpers.js +101 -0
  20. package/dist/gates/promise-safety-rules.d.ts +7 -0
  21. package/dist/gates/promise-safety-rules.js +19 -0
  22. package/dist/gates/promise-safety.d.ts +1 -21
  23. package/dist/gates/promise-safety.js +51 -257
  24. package/dist/gates/test-quality-lang.d.ts +30 -0
  25. package/dist/gates/test-quality-lang.js +188 -0
  26. package/dist/gates/test-quality.d.ts +0 -14
  27. package/dist/gates/test-quality.js +13 -186
  28. package/dist/pattern-index/indexer-helpers.d.ts +38 -0
  29. package/dist/pattern-index/indexer-helpers.js +111 -0
  30. package/dist/pattern-index/indexer-lang.d.ts +13 -0
  31. package/dist/pattern-index/indexer-lang.js +244 -0
  32. package/dist/pattern-index/indexer-ts.d.ts +22 -0
  33. package/dist/pattern-index/indexer-ts.js +258 -0
  34. package/dist/pattern-index/indexer.d.ts +4 -106
  35. package/dist/pattern-index/indexer.js +58 -707
  36. package/dist/pattern-index/staleness-data.d.ts +6 -0
  37. package/dist/pattern-index/staleness-data.js +262 -0
  38. package/dist/pattern-index/staleness.js +1 -258
  39. package/dist/templates/index.d.ts +12 -16
  40. package/dist/templates/index.js +11 -527
  41. package/dist/templates/paradigms.d.ts +2 -0
  42. package/dist/templates/paradigms.js +46 -0
  43. package/dist/templates/presets.d.ts +14 -0
  44. package/dist/templates/presets.js +227 -0
  45. package/dist/templates/universal-config.d.ts +2 -0
  46. package/dist/templates/universal-config.js +171 -0
  47. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Language-specific deprecated APIs: Python, Go, C#, Java
3
+ * Extracted to keep deprecated-apis.ts under 500 lines.
4
+ */
5
+ import { DeprecatedRule } from './deprecated-apis-rules-node.js';
6
+ /**
7
+ * Python deprecated APIs — sourced from Python 3.12+ deprecation notices
8
+ */
9
+ export declare const PYTHON_DEPRECATED_RULES: DeprecatedRule[];
10
+ /**
11
+ * Go deprecated APIs — sourced from Go official deprecation notices
12
+ */
13
+ export declare const GO_DEPRECATED_RULES: DeprecatedRule[];
14
+ /**
15
+ * C# deprecated APIs — sourced from .NET deprecation notices
16
+ */
17
+ export declare const CSHARP_DEPRECATED_RULES: DeprecatedRule[];
18
+ /**
19
+ * Java deprecated APIs — sourced from JDK deprecation notices
20
+ */
21
+ export declare const JAVA_DEPRECATED_RULES: DeprecatedRule[];
@@ -0,0 +1,311 @@
1
+ /**
2
+ * Language-specific deprecated APIs: Python, Go, C#, Java
3
+ * Extracted to keep deprecated-apis.ts under 500 lines.
4
+ */
5
+ /**
6
+ * Python deprecated APIs — sourced from Python 3.12+ deprecation notices
7
+ */
8
+ export const PYTHON_DEPRECATED_RULES = [
9
+ // Security-deprecated
10
+ {
11
+ pattern: /\bmd5\s*\(|\.md5\s*\(/,
12
+ api: 'hashlib.md5() for passwords',
13
+ reason: 'MD5 is cryptographically broken — collision attacks proven since 2004',
14
+ replacement: 'hashlib.sha256(), hashlib.blake2b(), or bcrypt/argon2 for passwords',
15
+ category: 'security',
16
+ },
17
+ {
18
+ pattern: /\bsha1\s*\(|\.sha1\s*\(/,
19
+ api: 'hashlib.sha1() for security',
20
+ reason: 'SHA-1 is cryptographically broken — SHAttered attack (2017)',
21
+ replacement: 'hashlib.sha256() or hashlib.sha3_256()',
22
+ category: 'security',
23
+ },
24
+ {
25
+ pattern: /\bpickle\.loads?\s*\(/,
26
+ api: 'pickle.load()/loads()',
27
+ reason: 'Arbitrary code execution vulnerability when loading untrusted data',
28
+ replacement: 'json.loads() for data, or use restricted_loads with allowlists',
29
+ category: 'security',
30
+ },
31
+ {
32
+ pattern: /\byaml\.load\s*\([^)]*(?!\bLoader\b)[^)]*\)/,
33
+ api: 'yaml.load() without Loader',
34
+ reason: 'Arbitrary code execution when loading untrusted YAML',
35
+ replacement: 'yaml.safe_load() or yaml.load(data, Loader=yaml.SafeLoader)',
36
+ category: 'security',
37
+ },
38
+ {
39
+ pattern: /\bexec\s*\(\s*(?:input|request|f['"])/,
40
+ api: 'exec() with user input',
41
+ reason: 'Code injection vulnerability',
42
+ replacement: 'ast.literal_eval() for data, structured parsing for expressions',
43
+ category: 'security',
44
+ },
45
+ {
46
+ pattern: /\bos\.system\s*\(/,
47
+ api: 'os.system()',
48
+ reason: 'Shell injection vulnerability, no output capture',
49
+ replacement: 'subprocess.run() with shell=False',
50
+ category: 'security',
51
+ },
52
+ {
53
+ pattern: /subprocess\.(?:call|run|Popen)\s*\([^)]*shell\s*=\s*True/,
54
+ api: 'subprocess with shell=True',
55
+ reason: 'Shell injection vulnerability when args contain user input',
56
+ replacement: 'subprocess.run() with shell=False and list args',
57
+ category: 'security',
58
+ },
59
+ // Removed modules (Python 3.12+)
60
+ {
61
+ pattern: /\bimport\s+imp\b/,
62
+ api: 'import imp',
63
+ reason: 'Removed in Python 3.12 (PEP 594)',
64
+ replacement: 'importlib',
65
+ category: 'removed',
66
+ },
67
+ {
68
+ pattern: /\bimport\s+(?:aifc|audioop|cgi|cgitb|chunk|crypt|imghdr|mailcap|msilib|nis|nntplib|ossaudiodev|pipes|sndhdr|spwd|sunau|telnetlib|uu|xdrlib)\b/,
69
+ api: 'Dead batteries module',
70
+ reason: 'Removed in Python 3.13 (PEP 594 — dead batteries)',
71
+ replacement: 'PyPI equivalents (see PEP 594 for specific replacements)',
72
+ category: 'removed',
73
+ },
74
+ {
75
+ pattern: /\bfrom\s+distutils\b/,
76
+ api: 'distutils',
77
+ reason: 'Removed in Python 3.12 (PEP 632)',
78
+ replacement: 'setuptools or build',
79
+ category: 'removed',
80
+ },
81
+ {
82
+ pattern: /\bimport\s+formatter\b/,
83
+ api: 'import formatter',
84
+ reason: 'Removed in Python 3.10',
85
+ replacement: 'No direct replacement — use string formatting',
86
+ category: 'removed',
87
+ },
88
+ // Superseded
89
+ {
90
+ pattern: /\bfrom\s+collections\s+import\s+(?:Mapping|MutableMapping|Sequence|MutableSequence|Set|MutableSet|Callable|Iterable|Iterator|Generator|Coroutine|Awaitable|AsyncIterable|AsyncIterator|AsyncGenerator|Hashable|Sized|Container|Collection|Reversible|MappingView|KeysView|ItemsView|ValuesView|ByteString)\b/,
91
+ api: 'collections ABCs',
92
+ reason: 'Removed in Python 3.10 — moved to collections.abc',
93
+ replacement: 'from collections.abc import ...',
94
+ category: 'removed',
95
+ },
96
+ {
97
+ pattern: /\boptparse\b/,
98
+ api: 'optparse',
99
+ reason: 'Superseded since Python 3.2',
100
+ replacement: 'argparse',
101
+ category: 'superseded',
102
+ },
103
+ {
104
+ pattern: /\bfrom\s+typing\s+import\s+(?:Dict|List|Set|Tuple|FrozenSet|Type|Deque|DefaultDict|OrderedDict|Counter|ChainMap|Awaitable|Coroutine|AsyncIterable|AsyncIterator|AsyncGenerator|Iterable|Iterator|Generator|Reversible|Container|Collection|Callable|AbstractSet|MutableSet|Mapping|MutableMapping|Sequence|MutableSequence|ByteString|MappingView|KeysView|ItemsView|ValuesView|ContextManager|AsyncContextManager|Pattern|Match)\b/,
105
+ api: 'typing generics (Dict, List, etc.)',
106
+ reason: 'Deprecated since Python 3.9 — use built-in generics (PEP 585)',
107
+ replacement: 'dict[], list[], set[], tuple[] (lowercase built-in types)',
108
+ category: 'superseded',
109
+ },
110
+ {
111
+ pattern: /\bfrom\s+typing\s+import\s+(?:Optional|Union)\b/,
112
+ api: 'typing.Optional / typing.Union',
113
+ reason: 'Superseded in Python 3.10 — use X | Y syntax (PEP 604)',
114
+ replacement: 'X | None instead of Optional[X], X | Y instead of Union[X, Y]',
115
+ category: 'superseded',
116
+ },
117
+ {
118
+ pattern: /\basyncio\.get_event_loop\s*\(\s*\)/,
119
+ api: 'asyncio.get_event_loop()',
120
+ reason: 'Deprecated in Python 3.10 — may create new loop unexpectedly',
121
+ replacement: 'asyncio.get_running_loop() or asyncio.run()',
122
+ category: 'superseded',
123
+ },
124
+ {
125
+ pattern: /\bsetup\s*\(\s*[^)]*\buse_2to3\s*=/,
126
+ api: 'setup(use_2to3=True)',
127
+ reason: 'Removed in setuptools 58+ — Python 2 support dropped',
128
+ replacement: 'Write Python 3 only code',
129
+ category: 'removed',
130
+ },
131
+ ];
132
+ /**
133
+ * Go deprecated APIs — sourced from Go official deprecation notices
134
+ */
135
+ export const GO_DEPRECATED_RULES = [
136
+ {
137
+ pattern: /\bioutil\.ReadFile\s*\(/,
138
+ api: 'ioutil.ReadFile()', reason: 'Deprecated since Go 1.16 — io/ioutil package deprecated',
139
+ replacement: 'os.ReadFile()', category: 'superseded',
140
+ },
141
+ {
142
+ pattern: /\bioutil\.WriteFile\s*\(/,
143
+ api: 'ioutil.WriteFile()', reason: 'Deprecated since Go 1.16',
144
+ replacement: 'os.WriteFile()', category: 'superseded',
145
+ },
146
+ {
147
+ pattern: /\bioutil\.ReadAll\s*\(/,
148
+ api: 'ioutil.ReadAll()', reason: 'Deprecated since Go 1.16',
149
+ replacement: 'io.ReadAll()', category: 'superseded',
150
+ },
151
+ {
152
+ pattern: /\bioutil\.ReadDir\s*\(/,
153
+ api: 'ioutil.ReadDir()', reason: 'Deprecated since Go 1.16',
154
+ replacement: 'os.ReadDir()', category: 'superseded',
155
+ },
156
+ {
157
+ pattern: /\bioutil\.TempDir\s*\(/,
158
+ api: 'ioutil.TempDir()', reason: 'Deprecated since Go 1.17',
159
+ replacement: 'os.MkdirTemp()', category: 'superseded',
160
+ },
161
+ {
162
+ pattern: /\bioutil\.TempFile\s*\(/,
163
+ api: 'ioutil.TempFile()', reason: 'Deprecated since Go 1.17',
164
+ replacement: 'os.CreateTemp()', category: 'superseded',
165
+ },
166
+ {
167
+ pattern: /\bioutil\.NopCloser\s*\(/,
168
+ api: 'ioutil.NopCloser()', reason: 'Deprecated since Go 1.16',
169
+ replacement: 'io.NopCloser()', category: 'superseded',
170
+ },
171
+ {
172
+ pattern: /\b"io\/ioutil"/,
173
+ api: 'import "io/ioutil"', reason: 'Entire io/ioutil package deprecated since Go 1.16',
174
+ replacement: 'Use os and io packages instead', category: 'superseded',
175
+ },
176
+ {
177
+ pattern: /\bsort\.IntSlice\b|sort\.Float64Slice\b|sort\.StringSlice\b/,
178
+ api: 'sort.*Slice types', reason: 'Superseded since Go 1.21',
179
+ replacement: 'slices.Sort() or sort.Slice()', category: 'superseded',
180
+ },
181
+ {
182
+ pattern: /\bmath\/rand"[\s\S]*?rand\.(Seed|Read)\s*\(/,
183
+ api: 'rand.Seed() / rand.Read()', reason: 'Deprecated in Go 1.20+',
184
+ replacement: 'Auto-seeded in Go 1.20+; use crypto/rand.Read()', category: 'superseded',
185
+ },
186
+ {
187
+ pattern: /\bstrings\.Title\s*\(/,
188
+ api: 'strings.Title()', reason: 'Deprecated since Go 1.18 — broken for Unicode',
189
+ replacement: 'golang.org/x/text/cases.Title()', category: 'superseded',
190
+ },
191
+ ];
192
+ /**
193
+ * C# deprecated APIs — sourced from .NET deprecation notices
194
+ */
195
+ export const CSHARP_DEPRECATED_RULES = [
196
+ {
197
+ pattern: /\bnew\s+WebClient\s*\(/,
198
+ api: 'WebClient', reason: 'Deprecated in .NET 6+ — poor async support',
199
+ replacement: 'HttpClient', category: 'superseded',
200
+ },
201
+ {
202
+ pattern: /\bBinaryFormatter\b/,
203
+ api: 'BinaryFormatter', reason: 'Security vulnerability — arbitrary code execution on deserialization',
204
+ replacement: 'System.Text.Json or JsonSerializer', category: 'security',
205
+ },
206
+ {
207
+ pattern: /\bJavaScriptSerializer\b/,
208
+ api: 'JavaScriptSerializer', reason: 'Deprecated — poor performance and limited features',
209
+ replacement: 'System.Text.Json.JsonSerializer', category: 'superseded',
210
+ },
211
+ {
212
+ pattern: /\bThread\.Abort\s*\(/,
213
+ api: 'Thread.Abort()', reason: 'Throws PlatformNotSupportedException in .NET 5+',
214
+ replacement: 'CancellationToken for cooperative cancellation', category: 'removed',
215
+ },
216
+ {
217
+ pattern: /\bThread\.Suspend\s*\(|Thread\.Resume\s*\(/,
218
+ api: 'Thread.Suspend/Resume()', reason: 'Deprecated — causes deadlocks',
219
+ replacement: 'ManualResetEvent or SemaphoreSlim', category: 'removed',
220
+ },
221
+ {
222
+ pattern: /\bAppDomain\.CreateDomain\s*\(/,
223
+ api: 'AppDomain.CreateDomain()', reason: 'Not supported in .NET Core/5+',
224
+ replacement: 'AssemblyLoadContext', category: 'removed',
225
+ },
226
+ {
227
+ pattern: /\bRemoting\b.*\bChannel\b/,
228
+ api: '.NET Remoting', reason: 'Removed in .NET Core/5+',
229
+ replacement: 'gRPC, REST APIs, or SignalR', category: 'removed',
230
+ },
231
+ {
232
+ pattern: /\bnew\s+SHA1(?:Managed|CryptoServiceProvider)\s*\(/,
233
+ api: 'SHA1Managed/CryptoServiceProvider', reason: 'SHA-1 cryptographically broken',
234
+ replacement: 'SHA256.Create() or SHA512.Create()', category: 'security',
235
+ },
236
+ {
237
+ pattern: /\bnew\s+MD5CryptoServiceProvider\s*\(/,
238
+ api: 'MD5CryptoServiceProvider', reason: 'MD5 cryptographically broken',
239
+ replacement: 'SHA256.Create() or SHA512.Create()', category: 'security',
240
+ },
241
+ {
242
+ pattern: /\bnew\s+(?:RijndaelManaged|DESCryptoServiceProvider|RC2CryptoServiceProvider|TripleDESCryptoServiceProvider)\s*\(/,
243
+ api: 'Legacy crypto providers', reason: 'Weak encryption algorithms',
244
+ replacement: 'Aes.Create()', category: 'security',
245
+ },
246
+ ];
247
+ /**
248
+ * Java deprecated APIs — sourced from JDK deprecation notices
249
+ */
250
+ export const JAVA_DEPRECATED_RULES = [
251
+ {
252
+ pattern: /\bnew\s+Date\s*\(\s*\d/,
253
+ api: 'new Date(year, month, ...)', reason: 'Deprecated since JDK 1.1',
254
+ replacement: 'java.time.LocalDate, LocalDateTime, ZonedDateTime', category: 'superseded',
255
+ },
256
+ {
257
+ pattern: /\bnew\s+Vector\s*[<(]/,
258
+ api: 'Vector', reason: 'Legacy synchronized collection — poor performance',
259
+ replacement: 'ArrayList (or Collections.synchronizedList())', category: 'superseded',
260
+ },
261
+ {
262
+ pattern: /\bnew\s+Hashtable\s*[<(]/,
263
+ api: 'Hashtable', reason: 'Legacy synchronized map — poor performance',
264
+ replacement: 'HashMap (or ConcurrentHashMap)', category: 'superseded',
265
+ },
266
+ {
267
+ pattern: /\bnew\s+Stack\s*[<(]/,
268
+ api: 'Stack', reason: 'Legacy class — extends Vector unnecessarily',
269
+ replacement: 'Deque<> (ArrayDeque) with push/pop', category: 'superseded',
270
+ },
271
+ {
272
+ pattern: /\bnew\s+StringBuffer\s*\(/,
273
+ api: 'StringBuffer', reason: 'Unnecessarily synchronized — slower than StringBuilder',
274
+ replacement: 'StringBuilder (unless thread safety needed)', category: 'superseded',
275
+ },
276
+ {
277
+ pattern: /\.getYear\s*\(\s*\)(?!.*java\.time)/,
278
+ api: 'Date.getYear()', reason: 'Deprecated since JDK 1.1 — returns year - 1900',
279
+ replacement: 'LocalDate.now().getYear()', category: 'superseded',
280
+ },
281
+ {
282
+ pattern: /Thread\.stop\s*\(/i,
283
+ api: 'Thread.stop()', reason: 'Deprecated — unsafe, can corrupt objects',
284
+ replacement: 'Thread.interrupt() with cooperative checking', category: 'security',
285
+ },
286
+ {
287
+ pattern: /Thread\.destroy\s*\(|Thread\.suspend\s*\(|Thread\.resume\s*\(/,
288
+ api: 'Thread.destroy/suspend/resume()', reason: 'Deprecated — deadlock-prone',
289
+ replacement: 'Thread.interrupt() and wait/notify', category: 'removed',
290
+ },
291
+ {
292
+ pattern: /Runtime\.runFinalizersOnExit\s*\(/,
293
+ api: 'Runtime.runFinalizersOnExit()', reason: 'Deprecated — inherently unsafe',
294
+ replacement: 'Runtime shutdown hooks or try-with-resources', category: 'removed',
295
+ },
296
+ {
297
+ pattern: /\bfinalize\s*\(\s*\)\s*(?:throws|\{)/,
298
+ api: 'finalize()', reason: 'Deprecated since Java 9 (JEP 421) — for removal',
299
+ replacement: 'Cleaner or try-with-resources (AutoCloseable)', category: 'superseded',
300
+ },
301
+ {
302
+ pattern: /\bnew\s+Integer\s*\(|new\s+Long\s*\(|new\s+Double\s*\(|new\s+Boolean\s*\(|new\s+Float\s*\(/,
303
+ api: 'new Integer/Long/Double/Boolean/Float()', reason: 'Deprecated since Java 9 — valueOf preferred',
304
+ replacement: 'Integer.valueOf(), autoboxing, or parse methods', category: 'superseded',
305
+ },
306
+ {
307
+ pattern: /\bSecurityManager\b/,
308
+ api: 'SecurityManager', reason: 'Deprecated for removal since Java 17 (JEP 411)',
309
+ replacement: 'No direct replacement — use OS-level security', category: 'removed',
310
+ },
311
+ ];
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Rule data for deprecated-apis gate.
3
+ * Node.js and Web API deprecation rules extracted to keep deprecated-apis.ts under 500 lines.
4
+ */
5
+ export interface DeprecatedRule {
6
+ pattern: RegExp;
7
+ api: string;
8
+ reason: string;
9
+ replacement: string;
10
+ category: 'security' | 'removed' | 'superseded';
11
+ }
12
+ /**
13
+ * Node.js deprecated APIs — sourced from official Node.js deprecation list
14
+ */
15
+ export declare const NODE_DEPRECATED_RULES: DeprecatedRule[];
16
+ /**
17
+ * Web API deprecated patterns
18
+ */
19
+ export declare const WEB_DEPRECATED_RULES: DeprecatedRule[];
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Rule data for deprecated-apis gate.
3
+ * Node.js and Web API deprecation rules extracted to keep deprecated-apis.ts under 500 lines.
4
+ */
5
+ /**
6
+ * Node.js deprecated APIs — sourced from official Node.js deprecation list
7
+ */
8
+ export const NODE_DEPRECATED_RULES = [
9
+ // Security-deprecated
10
+ {
11
+ pattern: /new\s+Buffer\s*\(/,
12
+ api: 'new Buffer()',
13
+ reason: 'DEP0005: Security vulnerability — uninitialized memory exposure',
14
+ replacement: 'Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe()',
15
+ category: 'security',
16
+ },
17
+ {
18
+ pattern: /Buffer\s*\(\s*(?:\d|['"])/,
19
+ api: 'Buffer() constructor',
20
+ reason: 'DEP0005: Security vulnerability — uninitialized memory exposure',
21
+ replacement: 'Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe()',
22
+ category: 'security',
23
+ },
24
+ {
25
+ pattern: /createCipher\s*\(/,
26
+ api: 'crypto.createCipher()',
27
+ reason: 'DEP0106: Uses weak key derivation (no IV, no salt)',
28
+ replacement: 'crypto.createCipheriv() with explicit IV',
29
+ category: 'security',
30
+ },
31
+ {
32
+ pattern: /createDecipher\s*\(/,
33
+ api: 'crypto.createDecipher()',
34
+ reason: 'DEP0106: Uses weak key derivation (no IV, no salt)',
35
+ replacement: 'crypto.createDecipheriv() with explicit IV',
36
+ category: 'security',
37
+ },
38
+ // Removed
39
+ {
40
+ pattern: /\brequire\s*\(\s*['"]domain['"]\s*\)/,
41
+ api: "require('domain')",
42
+ reason: 'DEP0032: domain module is deprecated (error handling issues)',
43
+ replacement: 'async_hooks, try/catch, or Promise error handling',
44
+ category: 'removed',
45
+ },
46
+ {
47
+ pattern: /\brequire\s*\(\s*['"]punycode['"]\s*\)/,
48
+ api: "require('punycode')",
49
+ reason: 'DEP0040: punycode module removed from Node.js core',
50
+ replacement: 'npm package: punycode (userland)',
51
+ category: 'removed',
52
+ },
53
+ {
54
+ pattern: /\brequire\s*\(\s*['"]sys['"]\s*\)/,
55
+ api: "require('sys')",
56
+ reason: 'DEP0025: sys module was renamed to util',
57
+ replacement: "require('util')",
58
+ category: 'removed',
59
+ },
60
+ {
61
+ pattern: /\brequire\s*\(\s*['"]_linklist['"]\s*\)/,
62
+ api: "require('_linklist')",
63
+ reason: 'DEP0037: _linklist module removed',
64
+ replacement: 'npm userland linked list package',
65
+ category: 'removed',
66
+ },
67
+ // Superseded
68
+ {
69
+ pattern: /url\.parse\s*\(/,
70
+ api: 'url.parse()',
71
+ reason: 'DEP0169: Legacy URL parser has known vulnerabilities',
72
+ replacement: 'new URL() (WHATWG URL API)',
73
+ category: 'superseded',
74
+ },
75
+ {
76
+ pattern: /url\.resolve\s*\(/,
77
+ api: 'url.resolve()',
78
+ reason: 'DEP0169: Legacy URL API',
79
+ replacement: 'new URL(relative, base)',
80
+ category: 'superseded',
81
+ },
82
+ {
83
+ pattern: /url\.format\s*\(\s*(?:url\.parse|{)/,
84
+ api: 'url.format(urlObject)',
85
+ reason: 'DEP0169: Legacy URL API with url.parse objects',
86
+ replacement: 'new URL().toString() or url.format(new URL(...))',
87
+ category: 'superseded',
88
+ },
89
+ {
90
+ pattern: /\.send\s*\(\s*new\s+Buffer\b/,
91
+ api: 'Sending raw Buffer',
92
+ reason: 'Potential uninitialized memory leak when Buffer() used without alloc',
93
+ replacement: 'Buffer.from() or Buffer.alloc()',
94
+ category: 'security',
95
+ },
96
+ {
97
+ pattern: /fs\.exists\s*\(/,
98
+ api: 'fs.exists()',
99
+ reason: 'DEP0103: fs.exists() is deprecated (race condition issues)',
100
+ replacement: 'fs.access() or fs.stat()',
101
+ category: 'superseded',
102
+ },
103
+ {
104
+ pattern: /util\.inherits\s*\(/,
105
+ api: 'util.inherits()',
106
+ reason: 'DEP0: Superseded by ES6 class extends',
107
+ replacement: 'class Child extends Parent {}',
108
+ category: 'superseded',
109
+ },
110
+ {
111
+ pattern: /util\.pump\s*\(/,
112
+ api: 'util.pump()',
113
+ reason: 'DEP0004: Removed — use stream.pipeline()',
114
+ replacement: 'stream.pipeline() or pipe()',
115
+ category: 'removed',
116
+ },
117
+ {
118
+ pattern: /util\.puts\s*\(|util\.print\s*\(|util\.debug\s*\(/,
119
+ api: 'util.puts/print/debug()',
120
+ reason: 'DEP0027/28/29: Removed console wrappers',
121
+ replacement: 'console.log() / console.error()',
122
+ category: 'removed',
123
+ },
124
+ {
125
+ pattern: /SlowBuffer\s*\(/,
126
+ api: 'SlowBuffer',
127
+ reason: 'DEP0030: Deprecated class',
128
+ replacement: 'Buffer.allocUnsafeSlow()',
129
+ category: 'superseded',
130
+ },
131
+ {
132
+ pattern: /\.setEncoding\s*\(\s*['"]binary['"]\s*\)/,
133
+ api: "setEncoding('binary')",
134
+ reason: "DEP0040: 'binary' encoding is deprecated",
135
+ replacement: "'latin1' encoding",
136
+ category: 'superseded',
137
+ },
138
+ {
139
+ pattern: /process\.(?:assert|binding)\s*\(/,
140
+ api: 'process.assert()/binding()',
141
+ reason: 'DEP0064/0098: Internal APIs removed',
142
+ replacement: 'assert module / public APIs',
143
+ category: 'removed',
144
+ },
145
+ ];
146
+ /**
147
+ * Web API deprecated patterns
148
+ */
149
+ export const WEB_DEPRECATED_RULES = [
150
+ {
151
+ pattern: /document\.write\s*\(/,
152
+ api: 'document.write()',
153
+ reason: 'Blocks parsing, security risk (XSS vector), removed in strict mode',
154
+ replacement: 'DOM manipulation (createElement, appendChild, innerHTML)',
155
+ category: 'security',
156
+ },
157
+ {
158
+ pattern: /\.innerHTML\s*=\s*[`'"]/,
159
+ api: 'innerHTML assignment with strings',
160
+ reason: 'XSS vulnerability when used with user-supplied content',
161
+ replacement: 'textContent, createElement + appendChild, or DOMPurify.sanitize()',
162
+ category: 'security',
163
+ },
164
+ {
165
+ pattern: /eval\s*\(\s*[^)]/,
166
+ api: 'eval()',
167
+ reason: 'Code injection vulnerability, prevents optimization',
168
+ replacement: 'JSON.parse(), Function constructor (if absolutely needed), or structured approach',
169
+ category: 'security',
170
+ },
171
+ {
172
+ pattern: /with\s*\(\s*\w/,
173
+ api: 'with statement',
174
+ reason: 'Removed in strict mode, creates ambiguous scope, security risk',
175
+ replacement: 'Destructuring or explicit property access',
176
+ category: 'removed',
177
+ },
178
+ {
179
+ pattern: /document\.all\b/,
180
+ api: 'document.all',
181
+ reason: 'Legacy IE API, falsy object (quirks mode artifact)',
182
+ replacement: 'document.getElementById(), document.querySelector()',
183
+ category: 'superseded',
184
+ },
185
+ {
186
+ pattern: /escape\s*\(\s*['"]/,
187
+ api: 'escape()',
188
+ reason: 'Deprecated — does not handle Unicode correctly',
189
+ replacement: 'encodeURIComponent() or encodeURI()',
190
+ category: 'superseded',
191
+ },
192
+ {
193
+ pattern: /unescape\s*\(/,
194
+ api: 'unescape()',
195
+ reason: 'Deprecated — does not handle Unicode correctly',
196
+ replacement: 'decodeURIComponent() or decodeURI()',
197
+ category: 'superseded',
198
+ },
199
+ ];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Barrel file: re-exports all deprecated API rules.
3
+ * Individual rules extracted to separate files for maintainability.
4
+ */
5
+ export { DeprecatedRule, NODE_DEPRECATED_RULES, WEB_DEPRECATED_RULES } from './deprecated-apis-rules-node.js';
6
+ export { PYTHON_DEPRECATED_RULES, GO_DEPRECATED_RULES, CSHARP_DEPRECATED_RULES, JAVA_DEPRECATED_RULES } from './deprecated-apis-rules-lang.js';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Barrel file: re-exports all deprecated API rules.
3
+ * Individual rules extracted to separate files for maintainability.
4
+ */
5
+ export { NODE_DEPRECATED_RULES, WEB_DEPRECATED_RULES } from './deprecated-apis-rules-node.js';
6
+ export { PYTHON_DEPRECATED_RULES, GO_DEPRECATED_RULES, CSHARP_DEPRECATED_RULES, JAVA_DEPRECATED_RULES } from './deprecated-apis-rules-lang.js';