eslint-plugin-reliability 3.1.6 → 3.1.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-reliability",
3
- "version": "3.1.6",
4
- "description": "ESLint rules for runtime stability, fault tolerance, and type safety.",
3
+ "version": "3.1.8",
4
+ "description": "ESLint plugin for runtime reliability — enforces error handling, network timeouts, null checks, and safe type narrowing.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
7
7
  "types": "./src/index.d.ts",
@@ -22,51 +22,51 @@
22
22
  },
23
23
  "files": [
24
24
  "src/",
25
- "dist/",
26
25
  "README.md",
27
- "LICENSE",
28
- "CHANGELOG.md"
26
+ "LICENSE"
29
27
  ],
30
28
  "keywords": [
31
29
  "eslint",
30
+ "eslintplugin",
32
31
  "eslint-plugin",
32
+ "static-analysis",
33
+ "linting",
34
+ "code-quality",
33
35
  "interlace-quality",
34
36
  "reliability",
35
37
  "error-handling",
38
+ "exception-handling",
39
+ "fault-tolerance",
40
+ "resilience",
36
41
  "type-safety",
37
- "llm-optimized"
42
+ "null-safety",
43
+ "timeout",
44
+ "async",
45
+ "llm-optimized",
46
+ "ai-assistant",
47
+ "typescript"
38
48
  ],
39
49
  "engines": {
40
50
  "node": ">=18.0.0"
41
51
  },
42
52
  "dependencies": {
43
53
  "tslib": "^2.3.0",
44
- "@interlace/eslint-devkit": "*"
45
- },
46
- "devDependencies": {
47
- "@typescript-eslint/parser": "^8.46.2",
48
- "@typescript-eslint/rule-tester": "^8.46.2"
54
+ "@interlace/eslint-devkit": "^1.6.1"
49
55
  },
50
56
  "repository": {
51
57
  "type": "git",
52
- "url": "https://github.com/ofri-peretz/eslint",
58
+ "url": "git+https://github.com/ofri-peretz/eslint.git",
53
59
  "directory": "packages/eslint-plugin-reliability"
54
60
  },
55
61
  "homepage": "https://eslint.interlace.tools/docs/quality/plugin-reliability?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-reliability",
56
62
  "bugs": {
57
63
  "url": "https://github.com/ofri-peretz/eslint/issues"
58
64
  },
59
- "scripts": {
60
- "build": "tsx ../../scripts/build-package.ts",
61
- "test": "vitest run",
62
- "test:coverage": "vitest run --coverage",
63
- "typecheck": "tsc -p tsconfig.lib.json --noEmit"
64
- },
65
65
  "peerDependencies": {
66
66
  "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
67
67
  },
68
68
  "funding": {
69
69
  "type": "github",
70
- "url": "https://github.com/ofri-peretz/eslint"
70
+ "url": "git+https://github.com/ofri-peretz/eslint.git"
71
71
  }
72
72
  }
package/src/index.d.ts CHANGED
@@ -1,198 +1,17 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- import type { TSESLint } from '@interlace/eslint-devkit';
7
- export declare const rules: {
8
- 'no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
9
- name: string;
10
- };
11
- 'no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
12
- name: string;
13
- };
14
- 'no-missing-error-context': TSESLint.RuleModule<"missingErrorContext" | "addErrorMessage" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
15
- name: string;
16
- };
17
- 'error-message': TSESLint.RuleModule<"addErrorMessage" | "missingErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
18
- name: string;
19
- };
20
- 'no-missing-null-checks': TSESLint.RuleModule<"missingNullCheck" | "useOptionalChaining" | "useNullishCoalescing" | "addExplicitCheck", [(import("./rules/reliability/no-missing-null-checks").Options | undefined)?], unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- 'no-unsafe-type-narrowing': TSESLint.RuleModule<"unsafeTypeNarrowing" | "useTypeGuard" | "useProperNarrowing" | "validateBeforeAssert", [(import("./rules/reliability/no-unsafe-type-narrowing").Options | undefined)?], unknown, TSESLint.RuleListener> & {
24
- name: string;
25
- };
26
- 'require-network-timeout': TSESLint.RuleModule<"violationDetected", [(import("./rules/reliability/require-network-timeout").Options | undefined)?], unknown, TSESLint.RuleListener> & {
27
- name: string;
28
- };
29
- 'no-await-in-loop': TSESLint.RuleModule<"awaitInLoop" | "suggestPromiseAll" | "suggestConcurrent" | "considerSequential" | "asyncLoopPattern", [(import("./rules/reliability/no-await-in-loop").Options | undefined)?], unknown, TSESLint.RuleListener> & {
30
- name: string;
31
- };
32
- 'no-jsdoc-terminator-in-example': TSESLint.RuleModule<"jsdocTerminatorInExample" | "wrapInQuotes", [(import("./rules/reliability/no-jsdoc-terminator-in-example").Options | undefined)?], unknown, TSESLint.RuleListener> & {
33
- name: string;
34
- };
35
- 'error-handling/no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
36
- name: string;
37
- };
38
- 'error-handling/no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
39
- name: string;
40
- };
41
- 'error-handling/no-missing-error-context': TSESLint.RuleModule<"missingErrorContext" | "addErrorMessage" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
42
- name: string;
43
- };
44
- 'error-handling/error-message': TSESLint.RuleModule<"addErrorMessage" | "missingErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
45
- name: string;
46
- };
47
- 'reliability/no-missing-null-checks': TSESLint.RuleModule<"missingNullCheck" | "useOptionalChaining" | "useNullishCoalescing" | "addExplicitCheck", [(import("./rules/reliability/no-missing-null-checks").Options | undefined)?], unknown, TSESLint.RuleListener> & {
48
- name: string;
49
- };
50
- 'reliability/no-unsafe-type-narrowing': TSESLint.RuleModule<"unsafeTypeNarrowing" | "useTypeGuard" | "useProperNarrowing" | "validateBeforeAssert", [(import("./rules/reliability/no-unsafe-type-narrowing").Options | undefined)?], unknown, TSESLint.RuleListener> & {
51
- name: string;
52
- };
53
- 'reliability/require-network-timeout': TSESLint.RuleModule<"violationDetected", [(import("./rules/reliability/require-network-timeout").Options | undefined)?], unknown, TSESLint.RuleListener> & {
54
- name: string;
55
- };
56
- 'reliability/no-await-in-loop': TSESLint.RuleModule<"awaitInLoop" | "suggestPromiseAll" | "suggestConcurrent" | "considerSequential" | "asyncLoopPattern", [(import("./rules/reliability/no-await-in-loop").Options | undefined)?], unknown, TSESLint.RuleListener> & {
57
- name: string;
58
- };
59
- 'reliability/no-jsdoc-terminator-in-example': TSESLint.RuleModule<"jsdocTerminatorInExample" | "wrapInQuotes", [(import("./rules/reliability/no-jsdoc-terminator-in-example").Options | undefined)?], unknown, TSESLint.RuleListener> & {
60
- name: string;
61
- };
62
- };
1
+ // Minimal declaration written by scripts/build-package.ts.
2
+ //
3
+ // tsc's generated entry declaration inlined every inferred rule-option type
4
+ // (up to 166 kB per plugin) for an API no consumer calls directly. This types
5
+ // what a flat config actually touches. Per-rule option types remain available
6
+ // from the "./types" subpath export where a plugin provides one.
7
+ import type { Linter, Rule } from 'eslint';
8
+
9
+ export declare const rules: Record<string, Rule.RuleModule>;
10
+ export declare const configs: Record<string, Linter.Config>;
63
11
  export declare const plugin: {
64
- meta: {
65
- name: string;
66
- version: string;
67
- };
68
- rules: {
69
- 'no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
70
- name: string;
71
- };
72
- 'no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
73
- name: string;
74
- };
75
- 'no-missing-error-context': TSESLint.RuleModule<"missingErrorContext" | "addErrorMessage" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
76
- name: string;
77
- };
78
- 'error-message': TSESLint.RuleModule<"addErrorMessage" | "missingErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
79
- name: string;
80
- };
81
- 'no-missing-null-checks': TSESLint.RuleModule<"missingNullCheck" | "useOptionalChaining" | "useNullishCoalescing" | "addExplicitCheck", [(import("./rules/reliability/no-missing-null-checks").Options | undefined)?], unknown, TSESLint.RuleListener> & {
82
- name: string;
83
- };
84
- 'no-unsafe-type-narrowing': TSESLint.RuleModule<"unsafeTypeNarrowing" | "useTypeGuard" | "useProperNarrowing" | "validateBeforeAssert", [(import("./rules/reliability/no-unsafe-type-narrowing").Options | undefined)?], unknown, TSESLint.RuleListener> & {
85
- name: string;
86
- };
87
- 'require-network-timeout': TSESLint.RuleModule<"violationDetected", [(import("./rules/reliability/require-network-timeout").Options | undefined)?], unknown, TSESLint.RuleListener> & {
88
- name: string;
89
- };
90
- 'no-await-in-loop': TSESLint.RuleModule<"awaitInLoop" | "suggestPromiseAll" | "suggestConcurrent" | "considerSequential" | "asyncLoopPattern", [(import("./rules/reliability/no-await-in-loop").Options | undefined)?], unknown, TSESLint.RuleListener> & {
91
- name: string;
92
- };
93
- 'no-jsdoc-terminator-in-example': TSESLint.RuleModule<"jsdocTerminatorInExample" | "wrapInQuotes", [(import("./rules/reliability/no-jsdoc-terminator-in-example").Options | undefined)?], unknown, TSESLint.RuleListener> & {
94
- name: string;
95
- };
96
- 'error-handling/no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
97
- name: string;
98
- };
99
- 'error-handling/no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
100
- name: string;
101
- };
102
- 'error-handling/no-missing-error-context': TSESLint.RuleModule<"missingErrorContext" | "addErrorMessage" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
103
- name: string;
104
- };
105
- 'error-handling/error-message': TSESLint.RuleModule<"addErrorMessage" | "missingErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
106
- name: string;
107
- };
108
- 'reliability/no-missing-null-checks': TSESLint.RuleModule<"missingNullCheck" | "useOptionalChaining" | "useNullishCoalescing" | "addExplicitCheck", [(import("./rules/reliability/no-missing-null-checks").Options | undefined)?], unknown, TSESLint.RuleListener> & {
109
- name: string;
110
- };
111
- 'reliability/no-unsafe-type-narrowing': TSESLint.RuleModule<"unsafeTypeNarrowing" | "useTypeGuard" | "useProperNarrowing" | "validateBeforeAssert", [(import("./rules/reliability/no-unsafe-type-narrowing").Options | undefined)?], unknown, TSESLint.RuleListener> & {
112
- name: string;
113
- };
114
- 'reliability/require-network-timeout': TSESLint.RuleModule<"violationDetected", [(import("./rules/reliability/require-network-timeout").Options | undefined)?], unknown, TSESLint.RuleListener> & {
115
- name: string;
116
- };
117
- 'reliability/no-await-in-loop': TSESLint.RuleModule<"awaitInLoop" | "suggestPromiseAll" | "suggestConcurrent" | "considerSequential" | "asyncLoopPattern", [(import("./rules/reliability/no-await-in-loop").Options | undefined)?], unknown, TSESLint.RuleListener> & {
118
- name: string;
119
- };
120
- 'reliability/no-jsdoc-terminator-in-example': TSESLint.RuleModule<"jsdocTerminatorInExample" | "wrapInQuotes", [(import("./rules/reliability/no-jsdoc-terminator-in-example").Options | undefined)?], unknown, TSESLint.RuleListener> & {
121
- name: string;
122
- };
123
- };
124
- };
125
- export declare const configs: {
126
- recommended: {
127
- plugins: {
128
- reliability: {
129
- meta: {
130
- name: string;
131
- version: string;
132
- };
133
- rules: {
134
- 'no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
135
- name: string;
136
- };
137
- 'no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
138
- name: string;
139
- };
140
- 'no-missing-error-context': TSESLint.RuleModule<"missingErrorContext" | "addErrorMessage" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
141
- name: string;
142
- };
143
- 'error-message': TSESLint.RuleModule<"addErrorMessage" | "missingErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
144
- name: string;
145
- };
146
- 'no-missing-null-checks': TSESLint.RuleModule<"missingNullCheck" | "useOptionalChaining" | "useNullishCoalescing" | "addExplicitCheck", [(import("./rules/reliability/no-missing-null-checks").Options | undefined)?], unknown, TSESLint.RuleListener> & {
147
- name: string;
148
- };
149
- 'no-unsafe-type-narrowing': TSESLint.RuleModule<"unsafeTypeNarrowing" | "useTypeGuard" | "useProperNarrowing" | "validateBeforeAssert", [(import("./rules/reliability/no-unsafe-type-narrowing").Options | undefined)?], unknown, TSESLint.RuleListener> & {
150
- name: string;
151
- };
152
- 'require-network-timeout': TSESLint.RuleModule<"violationDetected", [(import("./rules/reliability/require-network-timeout").Options | undefined)?], unknown, TSESLint.RuleListener> & {
153
- name: string;
154
- };
155
- 'no-await-in-loop': TSESLint.RuleModule<"awaitInLoop" | "suggestPromiseAll" | "suggestConcurrent" | "considerSequential" | "asyncLoopPattern", [(import("./rules/reliability/no-await-in-loop").Options | undefined)?], unknown, TSESLint.RuleListener> & {
156
- name: string;
157
- };
158
- 'no-jsdoc-terminator-in-example': TSESLint.RuleModule<"jsdocTerminatorInExample" | "wrapInQuotes", [(import("./rules/reliability/no-jsdoc-terminator-in-example").Options | undefined)?], unknown, TSESLint.RuleListener> & {
159
- name: string;
160
- };
161
- 'error-handling/no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
162
- name: string;
163
- };
164
- 'error-handling/no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
165
- name: string;
166
- };
167
- 'error-handling/no-missing-error-context': TSESLint.RuleModule<"missingErrorContext" | "addErrorMessage" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
168
- name: string;
169
- };
170
- 'error-handling/error-message': TSESLint.RuleModule<"addErrorMessage" | "missingErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
171
- name: string;
172
- };
173
- 'reliability/no-missing-null-checks': TSESLint.RuleModule<"missingNullCheck" | "useOptionalChaining" | "useNullishCoalescing" | "addExplicitCheck", [(import("./rules/reliability/no-missing-null-checks").Options | undefined)?], unknown, TSESLint.RuleListener> & {
174
- name: string;
175
- };
176
- 'reliability/no-unsafe-type-narrowing': TSESLint.RuleModule<"unsafeTypeNarrowing" | "useTypeGuard" | "useProperNarrowing" | "validateBeforeAssert", [(import("./rules/reliability/no-unsafe-type-narrowing").Options | undefined)?], unknown, TSESLint.RuleListener> & {
177
- name: string;
178
- };
179
- 'reliability/require-network-timeout': TSESLint.RuleModule<"violationDetected", [(import("./rules/reliability/require-network-timeout").Options | undefined)?], unknown, TSESLint.RuleListener> & {
180
- name: string;
181
- };
182
- 'reliability/no-await-in-loop': TSESLint.RuleModule<"awaitInLoop" | "suggestPromiseAll" | "suggestConcurrent" | "considerSequential" | "asyncLoopPattern", [(import("./rules/reliability/no-await-in-loop").Options | undefined)?], unknown, TSESLint.RuleListener> & {
183
- name: string;
184
- };
185
- 'reliability/no-jsdoc-terminator-in-example': TSESLint.RuleModule<"jsdocTerminatorInExample" | "wrapInQuotes", [(import("./rules/reliability/no-jsdoc-terminator-in-example").Options | undefined)?], unknown, TSESLint.RuleListener> & {
186
- name: string;
187
- };
188
- };
189
- };
190
- };
191
- rules: {
192
- 'reliability/no-silent-errors': "error";
193
- 'reliability/no-missing-null-checks': "warn";
194
- 'reliability/require-network-timeout': "error";
195
- };
196
- };
12
+ meta: { name: string; version: string };
13
+ rules: Record<string, Rule.RuleModule>;
197
14
  };
198
- export default plugin;
15
+
16
+ declare const _default: typeof plugin;
17
+ export default _default;
package/src/index.js CHANGED
@@ -1,17 +1,10 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2025 Ofri Peretz
4
- * Licensed under the MIT License. Use of this source code is governed by the
5
- * MIT license that can be found in the LICENSE file.
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.configs = exports.plugin = exports.rules = void 0;
9
- // Error handling rules
10
4
  const no_unhandled_promise_1 = require("./rules/error-handling/no-unhandled-promise");
11
5
  const no_silent_errors_1 = require("./rules/error-handling/no-silent-errors");
12
6
  const no_missing_error_context_1 = require("./rules/error-handling/no-missing-error-context");
13
7
  const error_message_1 = require("./rules/error-handling/error-message");
14
- // Reliability rules
15
8
  const no_missing_null_checks_1 = require("./rules/reliability/no-missing-null-checks");
16
9
  const no_unsafe_type_narrowing_1 = require("./rules/reliability/no-unsafe-type-narrowing");
17
10
  const require_network_timeout_1 = require("./rules/reliability/require-network-timeout");
@@ -27,7 +20,6 @@ exports.rules = {
27
20
  'require-network-timeout': require_network_timeout_1.requireNetworkTimeout,
28
21
  'no-await-in-loop': no_await_in_loop_1.noAwaitInLoop,
29
22
  'no-jsdoc-terminator-in-example': no_jsdoc_terminator_in_example_1.noJsdocTerminatorInExample,
30
- // Categorized names
31
23
  'error-handling/no-unhandled-promise': no_unhandled_promise_1.noUnhandledPromise,
32
24
  'error-handling/no-silent-errors': no_silent_errors_1.noSilentErrors,
33
25
  'error-handling/no-missing-error-context': no_missing_error_context_1.noMissingErrorContext,
@@ -41,7 +33,7 @@ exports.rules = {
41
33
  exports.plugin = {
42
34
  meta: {
43
35
  name: 'eslint-plugin-reliability',
44
- version: '3.1.6',
36
+ version: '3.1.8',
45
37
  },
46
38
  rules: exports.rules,
47
39
  };
package/src/oxlint.d.ts CHANGED
@@ -1,20 +1,17 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * oxlint sub-export.
8
- *
9
- * Consumers wire oxlint to this entry via:
10
- * { "jsPlugins": ["eslint-plugin-reliability/oxlint"] }
11
- *
12
- * oxlint's JS plugin loader does `require('eslint-plugin-reliability/oxlint')` and reads
13
- * `.rules` off the result. The compiled output of `export = plugin` is
14
- * `module.exports = plugin`, which gives oxlint the plugin object directly
15
- * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
16
- *
17
- * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
18
- */
19
- import { plugin } from './index';
20
- export = plugin;
1
+ // Minimal declaration written by scripts/build-package.ts.
2
+ //
3
+ // tsc's generated entry declaration inlined every inferred rule-option type
4
+ // (up to 166 kB per plugin) for an API no consumer calls directly. This types
5
+ // what a flat config actually touches. Per-rule option types remain available
6
+ // from the "./types" subpath export where a plugin provides one.
7
+ import type { Linter, Rule } from 'eslint';
8
+
9
+ export declare const rules: Record<string, Rule.RuleModule>;
10
+ export declare const configs: Record<string, Linter.Config>;
11
+ export declare const plugin: {
12
+ meta: { name: string; version: string };
13
+ rules: Record<string, Rule.RuleModule>;
14
+ };
15
+
16
+ declare const _default: typeof plugin;
17
+ export default _default;
package/src/oxlint.js CHANGED
@@ -1,21 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2025 Ofri Peretz
4
- * Licensed under the MIT License. Use of this source code is governed by the
5
- * MIT license that can be found in the LICENSE file.
6
- */
7
- /**
8
- * oxlint sub-export.
9
- *
10
- * Consumers wire oxlint to this entry via:
11
- * { "jsPlugins": ["eslint-plugin-reliability/oxlint"] }
12
- *
13
- * oxlint's JS plugin loader does `require('eslint-plugin-reliability/oxlint')` and reads
14
- * `.rules` off the result. The compiled output of `export = plugin` is
15
- * `module.exports = plugin`, which gives oxlint the plugin object directly
16
- * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
17
- *
18
- * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
19
- */
20
2
  const index_1 = require("./index");
21
3
  module.exports = index_1.plugin;
@@ -1,9 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2025 Ofri Peretz
4
- * Licensed under the MIT License. Use of this source code is governed by the
5
- * MIT license that can be found in the LICENSE file.
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.errorMessage = void 0;
9
4
  const eslint_devkit_1 = require("@interlace/eslint-devkit");
@@ -52,7 +47,6 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
52
47
  create(context) {
53
48
  const [options] = context.options;
54
49
  const { allowEmptyCatch = false } = options || {};
55
- // Built-in Error constructors that should have messages
56
50
  const errorConstructors = new Set([
57
51
  'Error',
58
52
  'TypeError',
@@ -65,19 +59,14 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
65
59
  function isErrorConstructor(name) {
66
60
  return errorConstructors.has(name);
67
61
  }
68
- // oxlint-disable-next-line consistent-function-scoping
69
62
  function hasMessageArgument(node) {
70
- // Check if there are arguments
71
63
  if (!node.arguments || node.arguments.length === 0) {
72
64
  return false;
73
65
  }
74
- // Check if first argument is a non-empty string or expression
75
66
  const firstArg = node.arguments[0];
76
67
  if (firstArg.type === 'Literal') {
77
- // Allow non-empty strings
78
68
  return (typeof firstArg.value === 'string' && firstArg.value.trim().length > 0);
79
69
  }
80
- // Allow any expression (variable, function call, etc.) as it might be dynamic
81
70
  return true;
82
71
  }
83
72
  function isInCatchClause(node) {
@@ -93,13 +82,11 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
93
82
  function checkErrorCreation(node) {
94
83
  let constructorName = null;
95
84
  if (node.type === 'NewExpression') {
96
- // new Error(...)
97
85
  if (node.callee.type === 'Identifier') {
98
86
  constructorName = node.callee.name;
99
87
  }
100
88
  }
101
89
  else if (node.type === 'CallExpression') {
102
- // Error(...) - function call style
103
90
  if (node.callee.type === 'Identifier') {
104
91
  constructorName = node.callee.name;
105
92
  }
@@ -107,11 +94,9 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
107
94
  if (!constructorName || !isErrorConstructor(constructorName)) {
108
95
  return;
109
96
  }
110
- // Allow empty catch if option is enabled
111
97
  if (allowEmptyCatch && isInCatchClause(node)) {
112
98
  return;
113
99
  }
114
- // Check if message is provided
115
100
  if (!hasMessageArgument(node)) {
116
101
  context.report({
117
102
  node,
@@ -125,13 +110,11 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
125
110
  data: { constructor: constructorName },
126
111
  fix(fixer) {
127
112
  if (node.arguments.length === 0) {
128
- // No arguments: replace the empty parentheses with ("Error message")
129
113
  const parenStart = node.callee.range[1];
130
114
  const parenEnd = node.range[1];
131
115
  return fixer.replaceTextRange([parenStart, parenEnd], '("Error message")');
132
116
  }
133
117
  else {
134
- // Has arguments: replace the first argument with "Error message"
135
118
  return fixer.replaceText(node.arguments[0], '"Error message"');
136
119
  }
137
120
  },
@@ -1,39 +1,22 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) 2025 Ofri Peretz
4
- * Licensed under the MIT License. Use of this source code is governed by the
5
- * MIT license that can be found in the LICENSE file.
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.noMissingErrorContext = void 0;
9
4
  const eslint_devkit_1 = require("@interlace/eslint-devkit");
10
5
  const eslint_devkit_2 = require("@interlace/eslint-devkit");
11
- /**
12
- * Check if error has a message
13
- */
14
6
  function hasErrorMessage(node) {
15
7
  if (!node.argument) {
16
8
  return false;
17
9
  }
18
- // `throw error;` — re-throwing a caught/named identifier. The original
19
- // error already carries its own message + stack; demanding context on the
20
- // re-throw is an FP. Same for `throw err`, `throw cause`, etc. Excludes
21
- // the literal-like `undefined` / `NaN` / `Infinity` identifiers, which
22
- // are typed as global constants but carry no diagnostic value.
23
10
  if (node.argument.type === 'Identifier' &&
24
11
  node.argument.name !== 'undefined' &&
25
12
  node.argument.name !== 'NaN' &&
26
13
  node.argument.name !== 'Infinity') {
27
14
  return true;
28
15
  }
29
- // Check if it's a new Error() with message (includes TypeError, ReferenceError, etc.)
30
16
  if (node.argument.type === 'NewExpression' &&
31
17
  node.argument.callee.type === 'Identifier' &&
32
18
  (node.argument.callee.name === 'Error' ||
33
19
  node.argument.callee.name.endsWith('Error'))) {
34
- // Check if first argument is a string (message) OR ANY expression — a
35
- // custom error class like `new UserNotFoundError(userId)` builds its
36
- // own message internally; the constructor argument IS the context.
37
20
  if (node.argument.arguments.length > 0) {
38
21
  const firstArg = node.argument.arguments[0];
39
22
  if (firstArg.type === 'Literal' && typeof firstArg.value === 'string') {
@@ -42,47 +25,34 @@ function hasErrorMessage(node) {
42
25
  if (firstArg.type === 'TemplateLiteral') {
43
26
  return true;
44
27
  }
45
- // Non-string argument to a custom *Error class — accept as context.
46
- // The rule's purpose is "throws should carry information"; passing an
47
- // identifier/object to the error constructor carries information.
48
28
  if (node.argument.callee.name !== 'Error' &&
49
29
  node.argument.callee.name.endsWith('Error')) {
50
30
  return true;
51
31
  }
52
32
  }
53
33
  }
54
- // Check if it's a string literal
55
34
  if (node.argument.type === 'Literal' &&
56
35
  typeof node.argument.value === 'string') {
57
36
  return node.argument.value.length > 0;
58
37
  }
59
- // Check if it's a template literal
60
38
  if (node.argument.type === 'TemplateLiteral') {
61
39
  return true;
62
40
  }
63
41
  return false;
64
42
  }
65
- /**
66
- * Check if error is an Error instance (has stack trace)
67
- */
68
43
  function hasErrorStack(node) {
69
44
  if (!node.argument) {
70
45
  return false;
71
46
  }
72
- // `throw error;` — caught/named identifier already has a stack from the
73
- // place where it was first thrown. Re-throws preserve the stack. Excludes
74
- // `undefined` / `NaN` / `Infinity` global-constant identifiers.
75
47
  if (node.argument.type === 'Identifier' &&
76
48
  node.argument.name !== 'undefined' &&
77
49
  node.argument.name !== 'NaN' &&
78
50
  node.argument.name !== 'Infinity') {
79
51
  return true;
80
52
  }
81
- // Check if it's a new Error() instance
82
53
  if (node.argument.type === 'NewExpression' &&
83
54
  node.argument.callee.type === 'Identifier') {
84
55
  const calleeName = node.argument.callee.name;
85
- // Error, TypeError, ReferenceError, etc. all have stack traces
86
56
  if (calleeName === 'Error' || calleeName.endsWith('Error')) {
87
57
  return true;
88
58
  }
@@ -170,9 +140,6 @@ exports.noMissingErrorContext = (0, eslint_devkit_2.createRule)({
170
140
  if (isTestFile) {
171
141
  return {};
172
142
  }
173
- /**
174
- * Check throw statements
175
- */
176
143
  function checkThrowStatement(node) {
177
144
  const missing = [];
178
145
  if (requireMessage && !hasErrorMessage(node)) {
@@ -193,7 +160,7 @@ exports.noMissingErrorContext = (0, eslint_devkit_2.createRule)({
193
160
  suggest: [
194
161
  {
195
162
  messageId: 'addErrorMessage',
196
- fix: () => null, // Cannot auto-fix without context
163
+ fix: () => null,
197
164
  },
198
165
  {
199
166
  messageId: 'addErrorStack',