eslint-plugin-reliability 3.1.7 → 3.1.9

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
@@ -1,7 +1,9 @@
1
1
  <p align="center">
2
- <a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-reliability" target="blank"><img src="https://eslint.interlace.tools/icon-light.svg" alt="Interlace" height="90" /></a>
2
+ <a href="https://eslint.interlace.tools/?utm_source=github&utm_medium=referral&utm_campaign=eslint-plugin-reliability" target="blank"><img src="https://eslint.interlace.tools/logos/interlace.svg" alt="Interlace" height="90" /></a>
3
3
  &nbsp;&nbsp;
4
- <a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/eslint-logo.svg" alt="ESLint" height="90" /></a>
4
+ <a href="https://oxc.rs" target="_blank"><img src="https://eslint.interlace.tools/logos/oxlint.svg" alt="oxlint" height="90" /></a>
5
+ &nbsp;&nbsp;
6
+ <a href="https://eslint.org" target="_blank"><img src="https://eslint.interlace.tools/logos/eslint.svg" alt="ESLint" height="90" /></a>
5
7
  </p>
6
8
 
7
9
  <p align="center">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-reliability",
3
- "version": "3.1.7",
3
+ "version": "3.1.9",
4
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",
@@ -22,10 +22,8 @@
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",
@@ -53,32 +51,22 @@
53
51
  },
54
52
  "dependencies": {
55
53
  "tslib": "^2.3.0",
56
- "@interlace/eslint-devkit": "*"
57
- },
58
- "devDependencies": {
59
- "@typescript-eslint/parser": "^8.46.2",
60
- "@typescript-eslint/rule-tester": "^8.46.2"
54
+ "@interlace/eslint-devkit": "^1.6.1"
61
55
  },
62
56
  "repository": {
63
57
  "type": "git",
64
- "url": "https://github.com/ofri-peretz/eslint",
58
+ "url": "git+https://github.com/ofri-peretz/eslint.git",
65
59
  "directory": "packages/eslint-plugin-reliability"
66
60
  },
67
61
  "homepage": "https://eslint.interlace.tools/docs/quality/plugin-reliability?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-reliability",
68
62
  "bugs": {
69
63
  "url": "https://github.com/ofri-peretz/eslint/issues"
70
64
  },
71
- "scripts": {
72
- "build": "tsx ../../scripts/build-package.ts",
73
- "test": "vitest run",
74
- "test:coverage": "vitest run --coverage",
75
- "typecheck": "tsc -p tsconfig.lib.json --noEmit"
76
- },
77
65
  "peerDependencies": {
78
66
  "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
79
67
  },
80
68
  "funding": {
81
69
  "type": "github",
82
- "url": "https://github.com/ofri-peretz/eslint"
70
+ "url": "git+https://github.com/ofri-peretz/eslint.git"
83
71
  }
84
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.7',
36
+ version: '3.1.9',
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',
@@ -1,41 +1,26 @@
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.noSilentErrors = 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 catch block is empty or only has comments
13
- */
14
6
  function isEmptyCatchBlock(catchClause) {
15
7
  const body = catchClause.body;
16
8
  if (!body || body.type !== 'BlockStatement') {
17
9
  return true;
18
10
  }
19
- // Check if body only has comments or is empty
20
11
  const statements = body.body;
21
12
  if (statements.length === 0) {
22
13
  return true;
23
14
  }
24
- // Check if all statements are just comments (not possible in AST, but check for empty statements)
25
15
  const nonEmptyStatements = statements.filter((stmt) => stmt.type !== 'EmptyStatement');
26
16
  return nonEmptyStatements.length === 0;
27
17
  }
28
- /**
29
- * Check if catch block has a comment explaining why it's empty
30
- */
31
18
  function hasExplanatoryComment(catchClause, sourceCode) {
32
- // Check for comments before the catch clause
33
19
  const comments = sourceCode.getAllComments();
34
20
  const catchStart = catchClause.loc?.start;
35
21
  if (!catchStart || !comments.length) {
36
22
  return false;
37
23
  }
38
- // Look for explanatory comments near the catch clause
39
24
  const explanatoryPatterns = [
40
25
  /intentional/i,
41
26
  /expected/i,
@@ -53,7 +38,6 @@ function hasExplanatoryComment(catchClause, sourceCode) {
53
38
  /todo/i,
54
39
  /fixme/i,
55
40
  ];
56
- // Check comments before the catch clause (within 2 lines)
57
41
  for (const comment of comments) {
58
42
  if (comment.loc && catchStart.line - comment.loc.end.line <= 2) {
59
43
  const commentText = comment.value.toLowerCase();
@@ -140,14 +124,10 @@ exports.noSilentErrors = (0, eslint_devkit_2.createRule)({
140
124
  return {};
141
125
  }
142
126
  const sourceCode = context.sourceCode;
143
- /**
144
- * Check catch clauses
145
- */
146
127
  function checkCatchClause(node) {
147
128
  if (!isEmptyCatchBlock(node)) {
148
129
  return;
149
130
  }
150
- // Check if comment explains why it's empty
151
131
  if (allowWithComment && hasExplanatoryComment(node, sourceCode)) {
152
132
  return;
153
133
  }
@@ -157,7 +137,7 @@ exports.noSilentErrors = (0, eslint_devkit_2.createRule)({
157
137
  suggest: [
158
138
  {
159
139
  messageId: 'addErrorLogging',
160
- fix: () => null, // Cannot auto-fix without context
140
+ fix: () => null,
161
141
  },
162
142
  {
163
143
  messageId: 'addErrorHandling',