@rslint/core 0.5.3 → 0.6.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.
Files changed (74) hide show
  1. package/bin/rslint.cjs +21 -4
  2. package/dist/0~engine.js +406 -0
  3. package/dist/34.js +33 -0
  4. package/dist/browser.d.ts +52 -39
  5. package/dist/browser.js +42 -74
  6. package/dist/cli.d.ts +3 -2
  7. package/dist/cli.js +1051 -93
  8. package/dist/config-loader.d.ts +45 -14
  9. package/dist/config-loader.js +95 -59
  10. package/dist/eslint-plugin/612.js +43 -0
  11. package/dist/eslint-plugin/index.d.ts +892 -0
  12. package/dist/eslint-plugin/index.js +26692 -0
  13. package/dist/eslint-plugin/lint-worker.js +26225 -0
  14. package/dist/eslint-plugin/types.d.ts +23 -0
  15. package/dist/eslint-plugin/types.js +1 -0
  16. package/dist/index.d.ts +626 -19
  17. package/dist/index.js +598 -15
  18. package/dist/service.d.ts +360 -30
  19. package/dist/service.js +19 -34
  20. package/package.json +27 -11
  21. package/dist/browser.d.ts.map +0 -1
  22. package/dist/cli.d.ts.map +0 -1
  23. package/dist/config-loader.d.ts.map +0 -1
  24. package/dist/configs/import.d.ts +0 -6
  25. package/dist/configs/import.d.ts.map +0 -1
  26. package/dist/configs/import.js +0 -7
  27. package/dist/configs/index.d.ts +0 -47
  28. package/dist/configs/index.d.ts.map +0 -1
  29. package/dist/configs/index.js +0 -36
  30. package/dist/configs/javascript.d.ts +0 -6
  31. package/dist/configs/javascript.d.ts.map +0 -1
  32. package/dist/configs/javascript.js +0 -72
  33. package/dist/configs/jest.d.ts +0 -7
  34. package/dist/configs/jest.d.ts.map +0 -1
  35. package/dist/configs/jest.js +0 -35
  36. package/dist/configs/jsx-a11y.d.ts +0 -6
  37. package/dist/configs/jsx-a11y.d.ts.map +0 -1
  38. package/dist/configs/jsx-a11y.js +0 -135
  39. package/dist/configs/promise.d.ts +0 -6
  40. package/dist/configs/promise.d.ts.map +0 -1
  41. package/dist/configs/promise.js +0 -20
  42. package/dist/configs/react-hooks.d.ts +0 -6
  43. package/dist/configs/react-hooks.d.ts.map +0 -1
  44. package/dist/configs/react-hooks.js +0 -24
  45. package/dist/configs/react.d.ts +0 -6
  46. package/dist/configs/react.d.ts.map +0 -1
  47. package/dist/configs/react.js +0 -31
  48. package/dist/configs/typescript.d.ts +0 -9
  49. package/dist/configs/typescript.d.ts.map +0 -1
  50. package/dist/configs/typescript.js +0 -122
  51. package/dist/configs/unicorn.d.ts +0 -8
  52. package/dist/configs/unicorn.d.ts.map +0 -1
  53. package/dist/configs/unicorn.js +0 -161
  54. package/dist/define-config.d.ts +0 -110
  55. package/dist/define-config.d.ts.map +0 -1
  56. package/dist/define-config.js +0 -6
  57. package/dist/index.d.ts.map +0 -1
  58. package/dist/node.d.ts +0 -31
  59. package/dist/node.d.ts.map +0 -1
  60. package/dist/node.js +0 -116
  61. package/dist/service.d.ts.map +0 -1
  62. package/dist/tsconfig.build.tsbuildinfo +0 -1
  63. package/dist/types.d.ts +0 -342
  64. package/dist/types.d.ts.map +0 -1
  65. package/dist/types.js +0 -1
  66. package/dist/utils/args.d.ts +0 -19
  67. package/dist/utils/args.d.ts.map +0 -1
  68. package/dist/utils/args.js +0 -101
  69. package/dist/utils/config-discovery.d.ts +0 -47
  70. package/dist/utils/config-discovery.d.ts.map +0 -1
  71. package/dist/utils/config-discovery.js +0 -238
  72. package/dist/worker.d.ts +0 -2
  73. package/dist/worker.d.ts.map +0 -1
  74. package/dist/worker.js +0 -114
package/dist/browser.js CHANGED
@@ -1,7 +1,4 @@
1
- /**
2
- * Browser implementation of RslintService using web workers
3
- */
4
- export class BrowserRslintService {
1
+ class BrowserRslintService {
5
2
  nextMessageId;
6
3
  pendingMessages;
7
4
  worker;
@@ -9,139 +6,110 @@ export class BrowserRslintService {
9
6
  chunks;
10
7
  chunkSize;
11
8
  expectedSize;
12
- constructor(options) {
9
+ constructor(options){
13
10
  this.nextMessageId = 1;
14
11
  this.pendingMessages = new Map();
15
12
  this.chunks = [];
16
13
  this.chunkSize = 0;
17
14
  this.expectedSize = null;
18
- // In browser, we need to use a web worker that can run the rslint binary
19
- // This would typically be a WASM version or a worker that can spawn processes
20
15
  this.workerUrl = options.workerUrl;
21
16
  this.ensureWorker(options.wasmUrl);
22
17
  }
23
- /**
24
- * Initialize the web worker
25
- */
26
18
  async ensureWorker(wasmUrl) {
27
19
  if (!this.worker) {
28
- this.worker = new Worker(this.workerUrl, { name: 'rslint-worker.js' });
29
- this.worker.onmessage = (event) => {
20
+ this.worker = new Worker(this.workerUrl, {
21
+ name: 'rslint-worker.js'
22
+ });
23
+ this.worker.onmessage = (event)=>{
30
24
  this.handlePacket(event.data);
31
25
  };
32
- this.worker.onerror = (error) => {
26
+ this.worker.onerror = (error)=>{
33
27
  console.error('Worker error:', error);
34
- // Reject all pending messages
35
- for (const [, pending] of this.pendingMessages) {
36
- pending.reject(new Error(`Worker error: ${error.message}`));
37
- }
28
+ for (const [, pending] of this.pendingMessages)pending.reject(new Error(`Worker error: ${error.message}`));
38
29
  this.pendingMessages.clear();
39
30
  };
40
31
  this.worker.postMessage({
41
32
  kind: 'init',
42
- data: { version: '1.0.0', wasmURL: wasmUrl },
33
+ data: {
34
+ version: '1.0.0',
35
+ wasmURL: wasmUrl
36
+ }
43
37
  });
44
38
  }
45
39
  return this.worker;
46
40
  }
47
- /**
48
- * Handle incoming binary data chunks
49
- */
50
41
  handlePacket(chunk) {
51
42
  this.chunks.push(chunk);
52
43
  this.chunkSize += chunk.length;
53
- // Process complete messages
54
- while (true) {
55
- // Read message length if we don't have it yet
56
- if (this.expectedSize === null) {
57
- if (this.chunkSize < 4)
58
- return;
59
- // Combine chunks to read the message length
44
+ while(true){
45
+ if (null === this.expectedSize) {
46
+ if (this.chunkSize < 4) return;
60
47
  const combined = this.combineChunks();
61
48
  const dataView = new DataView(combined.buffer, combined.byteOffset, combined.byteLength);
62
- this.expectedSize = dataView.getUint32(0, true); // true for little-endian
63
- // Remove length bytes from buffer
64
- this.chunks = [combined.slice(4)];
49
+ this.expectedSize = dataView.getUint32(0, true);
50
+ this.chunks = [
51
+ combined.slice(4)
52
+ ];
65
53
  this.chunkSize -= 4;
66
54
  }
67
- // Check if we have the full message
68
- if (this.chunkSize < this.expectedSize)
69
- return;
70
- // Read the message content
55
+ if (this.chunkSize < this.expectedSize) return;
71
56
  const combined = this.combineChunks();
72
57
  const messageBytes = combined.slice(0, this.expectedSize);
73
58
  const message = new TextDecoder().decode(messageBytes);
74
- // Handle the message
75
59
  try {
76
60
  const parsed = JSON.parse(message);
77
61
  this.handleResponse(parsed);
78
- }
79
- catch (err) {
62
+ } catch (err) {
80
63
  console.error('Error parsing message:', err);
81
64
  }
82
- // Reset for next message
83
- this.chunks = [combined.slice(this.expectedSize)];
65
+ this.chunks = [
66
+ combined.slice(this.expectedSize)
67
+ ];
84
68
  this.chunkSize = this.chunks[0].length;
85
69
  this.expectedSize = null;
86
70
  }
87
71
  }
88
- /**
89
- * Combine multiple Uint8Array chunks into a single Uint8Array
90
- */
91
72
  combineChunks() {
92
- if (this.chunks.length === 1) {
93
- return this.chunks[0];
94
- }
95
- const totalLength = this.chunks.reduce((sum, chunk) => sum + chunk.length, 0);
73
+ if (1 === this.chunks.length) return this.chunks[0];
74
+ const totalLength = this.chunks.reduce((sum, chunk)=>sum + chunk.length, 0);
96
75
  const combined = new Uint8Array(totalLength);
97
76
  let offset = 0;
98
- for (const chunk of this.chunks) {
77
+ for (const chunk of this.chunks){
99
78
  combined.set(chunk, offset);
100
79
  offset += chunk.length;
101
80
  }
102
81
  return combined;
103
82
  }
104
- /**
105
- * Send a message to the worker
106
- */
107
83
  async sendMessage(kind, data) {
108
- return new Promise((resolve, reject) => {
84
+ return new Promise((resolve, reject)=>{
109
85
  const id = this.nextMessageId++;
110
- const message = { id, kind, data };
111
- // Register promise callbacks
112
- this.pendingMessages.set(id, { resolve, reject });
113
- // Send message to worker
86
+ const message = {
87
+ id,
88
+ kind,
89
+ data
90
+ };
91
+ this.pendingMessages.set(id, {
92
+ resolve,
93
+ reject
94
+ });
114
95
  this.worker.postMessage(message);
115
96
  });
116
97
  }
117
- /**
118
- * Handle messages from the worker
119
- */
120
98
  handleResponse(message) {
121
99
  const { id, kind, data } = message;
122
100
  const pending = this.pendingMessages.get(id);
123
- if (!pending)
124
- return;
101
+ if (!pending) return;
125
102
  this.pendingMessages.delete(id);
126
- if (kind === 'error') {
127
- pending.reject(new Error(data.message));
128
- }
129
- else {
130
- pending.resolve(data);
131
- }
103
+ if ('error' === kind) pending.reject(new Error(data.message));
104
+ else pending.resolve(data);
132
105
  }
133
- /**
134
- * Terminate the worker
135
- */
136
106
  terminate() {
137
107
  if (this.worker) {
138
- // Reject all pending messages
139
- for (const [, pending] of this.pendingMessages) {
140
- pending.reject(new Error('Service terminated'));
141
- }
108
+ for (const [, pending] of this.pendingMessages)pending.reject(new Error('Service terminated'));
142
109
  this.pendingMessages.clear();
143
110
  this.worker.terminate();
144
111
  this.worker = null;
145
112
  }
146
113
  }
147
114
  }
115
+ export { BrowserRslintService };
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export declare function run(binPath: string, argv: string[], startTime: number): Promise<number>;
2
- //# sourceMappingURL=cli.d.ts.map
1
+ export declare function run(binPath: string, argv: string[], startTime: number): Promise<number>;
2
+
3
+ export { }