eslint-plugin-wyrm 0.0.7 → 0.0.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/CHANGELOG.md +15 -0
- package/README.md +9 -1
- package/dist/configs/{index.js → index.mjs} +3 -3
- package/dist/{index.d.ts → index.d.mts} +2 -2
- package/dist/index.mjs +12 -0
- package/dist/{plugin.js → plugin.mjs} +1 -1
- package/dist/rules/distribute-boolean-casts.d.mts +7 -0
- package/dist/rules/{distribute-boolean-casts.js → distribute-boolean-casts.mjs} +15 -7
- package/dist/rules/index.d.mts +31 -0
- package/dist/rules/index.mjs +56 -0
- package/dist/rules/{no-constant-template-expression.d.ts → no-constant-template-expression.d.mts} +1 -1
- package/dist/rules/{no-constant-template-expression.js → no-constant-template-expression.mjs} +29 -7
- package/dist/rules/no-duplicated-return.d.mts +7 -0
- package/dist/rules/no-duplicated-return.mjs +96 -0
- package/dist/rules/no-else-break.d.mts +7 -0
- package/dist/rules/{no-else-break.js → no-else-break.mjs} +2 -1
- package/dist/rules/no-else-continue.d.mts +7 -0
- package/dist/rules/{no-else-continue.js → no-else-continue.mjs} +2 -1
- package/dist/rules/no-else-throw.d.mts +7 -0
- package/dist/rules/{no-else-throw.js → no-else-throw.mjs} +2 -1
- package/dist/rules/no-empty-comment.d.mts +9 -0
- package/dist/rules/{no-empty-comment.js → no-empty-comment.mjs} +7 -7
- package/dist/rules/no-empty-jsx-expression.d.mts +7 -0
- package/dist/rules/{no-empty-jsx-expression.js → no-empty-jsx-expression.mjs} +1 -1
- package/dist/rules/no-extra-false-fallback.d.mts +8 -0
- package/dist/rules/no-extra-false-fallback.mjs +170 -0
- package/dist/rules/no-extra-nested-boolean-cast.d.mts +8 -0
- package/dist/rules/{no-extra-nested-boolean-cast.js → no-extra-nested-boolean-cast.mjs} +24 -1
- package/dist/rules/{no-empty-jsx-expression.d.ts → no-invalid-date-literal.d.mts} +3 -3
- package/dist/rules/{no-invalid-date-literal.js → no-invalid-date-literal.mjs} +1 -1
- package/dist/rules/no-jsx-statement.d.mts +7 -0
- package/dist/rules/{no-jsx-statement.js → no-jsx-statement.mjs} +3 -2
- package/dist/rules/no-optional-type-guard-param.d.mts +7 -0
- package/dist/rules/no-optional-type-guard-param.mjs +43 -0
- package/dist/rules/no-return-to-void.d.mts +7 -0
- package/dist/rules/no-return-to-void.mjs +87 -0
- package/dist/rules/no-suspicious-jsx-semicolon.d.mts +8 -0
- package/dist/rules/{no-suspicious-jsx-semicolon.js → no-suspicious-jsx-semicolon.mjs} +7 -2
- package/dist/rules/no-ternary-return.d.mts +10 -0
- package/dist/rules/{no-ternary-return.js → no-ternary-return.mjs} +10 -3
- package/dist/rules/no-useless-iife.d.mts +7 -0
- package/dist/rules/{no-useless-iife.js → no-useless-iife.mjs} +1 -1
- package/dist/rules/no-useless-logical-fallback.d.mts +8 -0
- package/dist/rules/no-useless-logical-fallback.mjs +255 -0
- package/dist/rules/no-useless-return-undefined.d.mts +7 -0
- package/dist/rules/no-useless-return-undefined.mjs +105 -0
- package/dist/rules/no-whitespace-property.d.mts +7 -0
- package/dist/rules/no-whitespace-property.mjs +42 -0
- package/dist/rules/prefer-catch-method.d.mts +7 -0
- package/dist/rules/{prefer-catch-method.js → prefer-catch-method.mjs} +19 -8
- package/dist/rules/prefer-early-return.d.mts +7 -0
- package/dist/rules/prefer-early-return.mjs +121 -0
- package/dist/rules/prefer-repeat.d.mts +7 -0
- package/dist/rules/{prefer-repeat.js → prefer-repeat.mjs} +8 -5
- package/dist/rules/{unsafe-asserted-chain.d.ts → unsafe-asserted-chain.d.mts} +1 -1
- package/dist/rules/{unsafe-asserted-chain.js → unsafe-asserted-chain.mjs} +23 -7
- package/package.json +35 -22
- package/dist/index.js +0 -12
- package/dist/rules/distribute-boolean-casts.d.ts +0 -7
- package/dist/rules/index.d.ts +0 -23
- package/dist/rules/index.js +0 -40
- package/dist/rules/no-else-break.d.ts +0 -7
- package/dist/rules/no-else-continue.d.ts +0 -7
- package/dist/rules/no-else-throw.d.ts +0 -7
- package/dist/rules/no-empty-comment.d.ts +0 -9
- package/dist/rules/no-extra-nested-boolean-cast.d.ts +0 -8
- package/dist/rules/no-invalid-date-literal.d.ts +0 -7
- package/dist/rules/no-jsx-statement.d.ts +0 -7
- package/dist/rules/no-suspicious-jsx-semicolon.d.ts +0 -8
- package/dist/rules/no-ternary-return.d.ts +0 -10
- package/dist/rules/no-useless-iife.d.ts +0 -7
- package/dist/rules/prefer-catch-method.d.ts +0 -7
- package/dist/rules/prefer-repeat.d.ts +0 -7
- /package/dist/_virtual/{rolldown_runtime.js → rolldown_runtime.mjs} +0 -0
- /package/dist/configs/{index.d.ts → index.d.mts} +0 -0
- /package/dist/utils/{createRule.d.ts → createRule.d.mts} +0 -0
- /package/dist/utils/{createRule.js → createRule.mjs} +0 -0
- /package/dist/utils/{option.js → option.mjs} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.8](https://github.com/mchevestrier/eslint-plugin-wyrm/compare/eslint-plugin-wyrm-v0.0.7...eslint-plugin-wyrm-v0.0.8) (2025-11-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* add no-duplicated-return & prefer-early-return ([41372c9](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/41372c9d1d147e9597259b22bc4fe29d8f6873e1))
|
|
9
|
+
* add no-extra-false-fallback ([f2e2bcd](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/f2e2bcd9f5aae66535f159c2d6fb1ca51ba3176f))
|
|
10
|
+
* add no-optional-type-guard-param ([6b3d9a1](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/6b3d9a1be37da3e4104de462bcf27dc1147741db))
|
|
11
|
+
* add no-return-to-void & no-useless-return-undefined ([5b5da17](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/5b5da17a778bf23c4b29bd44ddbea7d3919c9d0e))
|
|
12
|
+
* add no-useless-logical-fallback ([129eaea](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/129eaea5ec6db9b07cf3478fd42f7d766ada2e82))
|
|
13
|
+
* add no-whitespace-property ([6aab31a](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/6aab31a2e61e6b68bad909420ea845aee281e184))
|
|
14
|
+
* improve no-duplicated-return ([60ed1d8](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/60ed1d8e09154d3e1fd45bd409bfbdef644857ac))
|
|
15
|
+
* improve no-useless-logical-fallback ([c770119](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/c7701199ee0486494a8a5b688540725113aca17c))
|
|
16
|
+
* improve rules ([68cb444](https://github.com/mchevestrier/eslint-plugin-wyrm/commit/68cb4442a9436b39fe739ea5cdfe85ba2b6ed897))
|
|
17
|
+
|
|
3
18
|
## [0.0.7](https://github.com/mchevestrier/eslint-plugin-wyrm/compare/eslint-plugin-wyrm-v0.0.6...eslint-plugin-wyrm-v0.0.7) (2025-11-05)
|
|
4
19
|
|
|
5
20
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/eslint-plugin-wyrm)
|
|
4
4
|
[](https://github.com/mchevestrier/eslint-plugin-wyrm/releases/latest)
|
|
5
|
-
[](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/
|
|
5
|
+
[](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/LICENSE.md)
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -53,18 +53,26 @@ export default defineConfig([
|
|
|
53
53
|
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ | :---------- | :-- | :-- | :-- |
|
|
54
54
|
| [distribute-boolean-casts](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/distribute-boolean-casts.md) | Enforce that boolean casts are distributed over logical expressions | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
|
|
55
55
|
| [no-constant-template-expression](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-constant-template-expression.md) | Disallow constant string expressions in template literals | ☑️ | | 💡 | 💭 |
|
|
56
|
+
| [no-duplicated-return](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-duplicated-return.md) | Forbid duplicated branches with early returns | 🟩 ✅ 🟪 ☑️ | | | |
|
|
56
57
|
| [no-else-break](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-else-break.md) | Forbid unnecessary `else` block after a `break` statement | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
|
|
57
58
|
| [no-else-continue](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-else-continue.md) | Forbid unnecessary `else` block after a `continue` statement | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
|
|
58
59
|
| [no-else-throw](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-else-throw.md) | Forbid unnecessary `else` block after a `throw` statement | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
|
|
59
60
|
| [no-empty-comment](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-empty-comment.md) | Forbid empty comments | 🟪 ☑️ | | | |
|
|
60
61
|
| [no-empty-jsx-expression](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-empty-jsx-expression.md) | Forbid empty JSX expression containers | 🟩 ✅ 🟪 ☑️ | | | |
|
|
62
|
+
| [no-extra-false-fallback](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-extra-false-fallback.md) | Forbid extra `?? false` in conditions and predicates | 🟪 ☑️ | | 💡 | |
|
|
61
63
|
| [no-extra-nested-boolean-cast](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-extra-nested-boolean-cast.md) | Forbid extra boolean casts in conditions and predicates | 🟪 ☑️ | | | |
|
|
62
64
|
| [no-invalid-date-literal](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-invalid-date-literal.md) | Disallow invalid date literals | 🟩 ✅ 🟪 ☑️ | | | |
|
|
63
65
|
| [no-jsx-statement](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-jsx-statement.md) | Forbid JSX expression statements | 🟩 ✅ 🟪 ☑️ | | | |
|
|
66
|
+
| [no-optional-type-guard-param](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-optional-type-guard-param.md) | Forbid optional parameters in type guards | 🟩 ✅ 🟪 ☑️ | | | |
|
|
67
|
+
| [no-return-to-void](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-return-to-void.md) | Forbid returning values in void-returning callbacks | ☑️ | | | 💭 |
|
|
64
68
|
| [no-suspicious-jsx-semicolon](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-suspicious-jsx-semicolon.md) | Forbid suspicious semicolons in JSX | 🟩 ✅ 🟪 ☑️ | | | |
|
|
65
69
|
| [no-ternary-return](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-ternary-return.md) | Disallow ternary conditions in return statements | 🟪 ☑️ | 🔧 | | |
|
|
66
70
|
| [no-useless-iife](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-iife.md) | Forbid useless IIFEs | 🟩 ✅ 🟪 ☑️ | | 💡 | |
|
|
71
|
+
| [no-useless-logical-fallback](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-logical-fallback.md) | Forbid useless fallback values for logical expressions | ✅ ☑️ | | 💡 | 💭 |
|
|
72
|
+
| [no-useless-return-undefined](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-useless-return-undefined.md) | Forbid returning `undefined` in void-returning callbacks | ☑️ | | | 💭 |
|
|
73
|
+
| [no-whitespace-property](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/no-whitespace-property.md) | Forbid leading or trailing whitespace in object keys | 🟪 ☑️ | | | |
|
|
67
74
|
| [prefer-catch-method](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-catch-method.md) | Enforce usage of `Promise.prototype.catch()` when it improves readability | 🟩 ✅ 🟪 ☑️ | | 💡 | |
|
|
75
|
+
| [prefer-early-return](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-early-return.md) | Require early returns when possible | 🟩 ✅ 🟪 ☑️ | 🔧 | | |
|
|
68
76
|
| [prefer-repeat](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/prefer-repeat.md) | Enforce usage of `String.prototype.repeat` | 🟩 ✅ 🟪 ☑️ | | 💡 | |
|
|
69
77
|
| [unsafe-asserted-chain](https://github.com/mchevestrier/eslint-plugin-wyrm/blob/master/packages/eslint-plugin-wyrm/docs/rules/unsafe-asserted-chain.md) | Disallow unsafe type assertions on optional chained expressions | ☑️ | | | 💭 |
|
|
70
78
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __export } from "../_virtual/rolldown_runtime.
|
|
2
|
-
import { rules_exports } from "../rules/index.
|
|
3
|
-
import { plugin } from "../plugin.
|
|
1
|
+
import { __export } from "../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
import { rules_exports } from "../rules/index.mjs";
|
|
3
|
+
import { plugin } from "../plugin.mjs";
|
|
4
4
|
|
|
5
5
|
//#region lib/configs/index.ts
|
|
6
6
|
var configs_exports = /* @__PURE__ */ __export({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { index_d_exports } from "./configs/index.
|
|
2
|
-
import { index_d_exports as index_d_exports$1 } from "./rules/index.
|
|
1
|
+
import { index_d_exports } from "./configs/index.mjs";
|
|
2
|
+
import { index_d_exports as index_d_exports$1 } from "./rules/index.mjs";
|
|
3
3
|
|
|
4
4
|
//#region lib/index.d.ts
|
|
5
5
|
interface CompatibleConfig {
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { rules_exports } from "./rules/index.mjs";
|
|
2
|
+
import { configs_exports } from "./configs/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region lib/index.ts
|
|
5
|
+
const plugin = {
|
|
6
|
+
rules: rules_exports,
|
|
7
|
+
configs: configs_exports
|
|
8
|
+
};
|
|
9
|
+
var lib_default = plugin;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { lib_default as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WyrmPluginDocs } from "../utils/createRule.mjs";
|
|
2
|
+
import * as _typescript_eslint_utils_ts_eslint0 from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
|
|
4
|
+
//#region lib/rules/distribute-boolean-casts.d.ts
|
|
5
|
+
declare const _default: _typescript_eslint_utils_ts_eslint0.RuleModule<"distributeBooleanCast", [], WyrmPluginDocs, _typescript_eslint_utils_ts_eslint0.RuleListener>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createRule } from "../utils/createRule.
|
|
2
|
-
import { None, Some } from "../utils/option.
|
|
1
|
+
import { createRule } from "../utils/createRule.mjs";
|
|
2
|
+
import { None, Some } from "../utils/option.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
5
5
|
|
|
@@ -29,13 +29,22 @@ var distribute_boolean_casts_default = createRule({
|
|
|
29
29
|
fix(fixer) {
|
|
30
30
|
const left = maybeWrapInBooleanCast(node.left);
|
|
31
31
|
const right = maybeWrapInBooleanCast(node.right);
|
|
32
|
-
const newText =
|
|
32
|
+
const newText = `(${left} ${node.operator} ${right})`;
|
|
33
33
|
return fixer.replaceText(parentCast.value, newText);
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
} };
|
|
37
|
+
function getTextWithPreviousComments(node) {
|
|
38
|
+
const txt = context.sourceCode.getText(node);
|
|
39
|
+
const prev = context.sourceCode.getTokenBefore(node);
|
|
40
|
+
/* v8 ignore if -- @preserve */
|
|
41
|
+
if (!prev) return txt;
|
|
42
|
+
const previousComments = context.sourceCode.getAllComments().filter((comment) => comment.range[0] >= prev.range[1] && comment.range[1] <= node.range[0]);
|
|
43
|
+
if (!previousComments.length) return txt;
|
|
44
|
+
return `\n${previousComments.map((comment) => context.sourceCode.getText(comment)).join("\n")}\n${txt}`;
|
|
45
|
+
}
|
|
37
46
|
function maybeWrapInBooleanCast(expr) {
|
|
38
|
-
const txt =
|
|
47
|
+
const txt = getTextWithPreviousComments(expr);
|
|
39
48
|
if (isBooleanLike(expr)) return txt;
|
|
40
49
|
return `!!(${txt})`;
|
|
41
50
|
}
|
|
@@ -44,8 +53,8 @@ var distribute_boolean_casts_default = createRule({
|
|
|
44
53
|
function isBooleanLike(expr) {
|
|
45
54
|
if (expr.type === AST_NODE_TYPES.UnaryExpression) return expr.operator === "!";
|
|
46
55
|
if (expr.type === AST_NODE_TYPES.BinaryExpression) switch (expr.operator) {
|
|
47
|
-
case "&&":
|
|
48
|
-
case "||":
|
|
56
|
+
case "&&": return true;
|
|
57
|
+
case "||": return true;
|
|
49
58
|
case "!=":
|
|
50
59
|
case "!==":
|
|
51
60
|
case "==":
|
|
@@ -62,7 +71,6 @@ function isBooleanLike(expr) {
|
|
|
62
71
|
return false;
|
|
63
72
|
}
|
|
64
73
|
function getParentBooleanCast(node) {
|
|
65
|
-
if (!node.parent) return None;
|
|
66
74
|
if (node.parent.type === AST_NODE_TYPES.UnaryExpression && isDoubleNegation(node.parent)) return Some(node.parent.parent);
|
|
67
75
|
if (node.parent.type === AST_NODE_TYPES.CallExpression && isBooleanCall(node.parent)) return Some(node.parent);
|
|
68
76
|
return None;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { _default } from "./distribute-boolean-casts.mjs";
|
|
2
|
+
import { _default as _default$1 } from "./no-constant-template-expression.mjs";
|
|
3
|
+
import { _default as _default$2 } from "./no-duplicated-return.mjs";
|
|
4
|
+
import { _default as _default$3 } from "./no-else-break.mjs";
|
|
5
|
+
import { _default as _default$4 } from "./no-else-continue.mjs";
|
|
6
|
+
import { _default as _default$5 } from "./no-else-throw.mjs";
|
|
7
|
+
import { _default as _default$6 } from "./no-empty-comment.mjs";
|
|
8
|
+
import { _default as _default$7 } from "./no-empty-jsx-expression.mjs";
|
|
9
|
+
import { _default as _default$8 } from "./no-extra-false-fallback.mjs";
|
|
10
|
+
import { _default as _default$9 } from "./no-extra-nested-boolean-cast.mjs";
|
|
11
|
+
import { _default as _default$10 } from "./no-invalid-date-literal.mjs";
|
|
12
|
+
import { _default as _default$11 } from "./no-jsx-statement.mjs";
|
|
13
|
+
import { _default as _default$12 } from "./no-optional-type-guard-param.mjs";
|
|
14
|
+
import { _default as _default$13 } from "./no-return-to-void.mjs";
|
|
15
|
+
import { _default as _default$14 } from "./no-suspicious-jsx-semicolon.mjs";
|
|
16
|
+
import { _default as _default$15 } from "./no-ternary-return.mjs";
|
|
17
|
+
import { _default as _default$16 } from "./no-useless-iife.mjs";
|
|
18
|
+
import { _default as _default$17 } from "./no-useless-logical-fallback.mjs";
|
|
19
|
+
import { _default as _default$18 } from "./no-useless-return-undefined.mjs";
|
|
20
|
+
import { _default as _default$19 } from "./no-whitespace-property.mjs";
|
|
21
|
+
import { _default as _default$20 } from "./prefer-catch-method.mjs";
|
|
22
|
+
import { _default as _default$21 } from "./prefer-early-return.mjs";
|
|
23
|
+
import { _default as _default$22 } from "./prefer-repeat.mjs";
|
|
24
|
+
import { _default as _default$23 } from "./unsafe-asserted-chain.mjs";
|
|
25
|
+
|
|
26
|
+
//#region lib/rules/index.d.ts
|
|
27
|
+
declare namespace index_d_exports {
|
|
28
|
+
export { _default as "distribute-boolean-casts", _default$1 as "no-constant-template-expression", _default$2 as "no-duplicated-return", _default$3 as "no-else-break", _default$4 as "no-else-continue", _default$5 as "no-else-throw", _default$6 as "no-empty-comment", _default$7 as "no-empty-jsx-expression", _default$8 as "no-extra-false-fallback", _default$9 as "no-extra-nested-boolean-cast", _default$10 as "no-invalid-date-literal", _default$11 as "no-jsx-statement", _default$12 as "no-optional-type-guard-param", _default$13 as "no-return-to-void", _default$14 as "no-suspicious-jsx-semicolon", _default$15 as "no-ternary-return", _default$16 as "no-useless-iife", _default$17 as "no-useless-logical-fallback", _default$18 as "no-useless-return-undefined", _default$19 as "no-whitespace-property", _default$20 as "prefer-catch-method", _default$21 as "prefer-early-return", _default$22 as "prefer-repeat", _default$23 as "unsafe-asserted-chain" };
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __export } from "../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
import distribute_boolean_casts_default from "./distribute-boolean-casts.mjs";
|
|
3
|
+
import no_constant_template_expression_default from "./no-constant-template-expression.mjs";
|
|
4
|
+
import no_duplicated_return_default from "./no-duplicated-return.mjs";
|
|
5
|
+
import no_else_break_default from "./no-else-break.mjs";
|
|
6
|
+
import no_else_continue_default from "./no-else-continue.mjs";
|
|
7
|
+
import no_else_throw_default from "./no-else-throw.mjs";
|
|
8
|
+
import no_empty_comment_default from "./no-empty-comment.mjs";
|
|
9
|
+
import no_empty_jsx_expression_default from "./no-empty-jsx-expression.mjs";
|
|
10
|
+
import no_extra_false_fallback_default from "./no-extra-false-fallback.mjs";
|
|
11
|
+
import no_extra_nested_boolean_cast_default from "./no-extra-nested-boolean-cast.mjs";
|
|
12
|
+
import no_invalid_date_literal_default from "./no-invalid-date-literal.mjs";
|
|
13
|
+
import no_jsx_statement_default from "./no-jsx-statement.mjs";
|
|
14
|
+
import no_optional_type_guard_param_default from "./no-optional-type-guard-param.mjs";
|
|
15
|
+
import no_return_to_void_default from "./no-return-to-void.mjs";
|
|
16
|
+
import no_suspicious_jsx_semicolon_default from "./no-suspicious-jsx-semicolon.mjs";
|
|
17
|
+
import no_ternary_return_default from "./no-ternary-return.mjs";
|
|
18
|
+
import no_useless_iife_default from "./no-useless-iife.mjs";
|
|
19
|
+
import no_useless_logical_fallback_default from "./no-useless-logical-fallback.mjs";
|
|
20
|
+
import no_useless_return_undefined_default from "./no-useless-return-undefined.mjs";
|
|
21
|
+
import no_whitespace_property_default from "./no-whitespace-property.mjs";
|
|
22
|
+
import prefer_catch_method_default from "./prefer-catch-method.mjs";
|
|
23
|
+
import prefer_early_return_default from "./prefer-early-return.mjs";
|
|
24
|
+
import prefer_repeat_default from "./prefer-repeat.mjs";
|
|
25
|
+
import unsafe_asserted_chain_default from "./unsafe-asserted-chain.mjs";
|
|
26
|
+
|
|
27
|
+
//#region lib/rules/index.ts
|
|
28
|
+
var rules_exports = /* @__PURE__ */ __export({
|
|
29
|
+
"distribute-boolean-casts": () => distribute_boolean_casts_default,
|
|
30
|
+
"no-constant-template-expression": () => no_constant_template_expression_default,
|
|
31
|
+
"no-duplicated-return": () => no_duplicated_return_default,
|
|
32
|
+
"no-else-break": () => no_else_break_default,
|
|
33
|
+
"no-else-continue": () => no_else_continue_default,
|
|
34
|
+
"no-else-throw": () => no_else_throw_default,
|
|
35
|
+
"no-empty-comment": () => no_empty_comment_default,
|
|
36
|
+
"no-empty-jsx-expression": () => no_empty_jsx_expression_default,
|
|
37
|
+
"no-extra-false-fallback": () => no_extra_false_fallback_default,
|
|
38
|
+
"no-extra-nested-boolean-cast": () => no_extra_nested_boolean_cast_default,
|
|
39
|
+
"no-invalid-date-literal": () => no_invalid_date_literal_default,
|
|
40
|
+
"no-jsx-statement": () => no_jsx_statement_default,
|
|
41
|
+
"no-optional-type-guard-param": () => no_optional_type_guard_param_default,
|
|
42
|
+
"no-return-to-void": () => no_return_to_void_default,
|
|
43
|
+
"no-suspicious-jsx-semicolon": () => no_suspicious_jsx_semicolon_default,
|
|
44
|
+
"no-ternary-return": () => no_ternary_return_default,
|
|
45
|
+
"no-useless-iife": () => no_useless_iife_default,
|
|
46
|
+
"no-useless-logical-fallback": () => no_useless_logical_fallback_default,
|
|
47
|
+
"no-useless-return-undefined": () => no_useless_return_undefined_default,
|
|
48
|
+
"no-whitespace-property": () => no_whitespace_property_default,
|
|
49
|
+
"prefer-catch-method": () => prefer_catch_method_default,
|
|
50
|
+
"prefer-early-return": () => prefer_early_return_default,
|
|
51
|
+
"prefer-repeat": () => prefer_repeat_default,
|
|
52
|
+
"unsafe-asserted-chain": () => unsafe_asserted_chain_default
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { rules_exports };
|
package/dist/rules/{no-constant-template-expression.js → no-constant-template-expression.mjs}
RENAMED
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import { createRule } from "../utils/createRule.
|
|
1
|
+
import { createRule } from "../utils/createRule.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { ASTUtils, AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
4
4
|
|
|
5
5
|
//#region lib/rules/no-constant-template-expression.ts
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview
|
|
8
|
+
*
|
|
9
|
+
* It is sometimes clearer to inline interpolated expressions when their values are constant:
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const foo = 'foobar';
|
|
14
|
+
* const str = `${foo}_baz`;
|
|
15
|
+
* // This would be clearer as:
|
|
16
|
+
* const str = 'foobar_baz';
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* By default, this rule allows constant values when they take up at least 10 characters.
|
|
20
|
+
* This can be configured with the `minAllowedLength` option.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
6
23
|
const { name } = path.parse(import.meta.filename);
|
|
7
24
|
const DEFAULT_MIN_ALLOWED_LENGTH = 10;
|
|
8
25
|
var no_constant_template_expression_default = createRule({
|
|
@@ -30,8 +47,6 @@ var no_constant_template_expression_default = createRule({
|
|
|
30
47
|
defaultOptions: [{ minAllowedLength: DEFAULT_MIN_ALLOWED_LENGTH }],
|
|
31
48
|
create(context, [options]) {
|
|
32
49
|
return { TemplateLiteral(node) {
|
|
33
|
-
const services = ESLintUtils.getParserServices(context);
|
|
34
|
-
const checker = services.program.getTypeChecker();
|
|
35
50
|
const { expressions, quasis } = node;
|
|
36
51
|
if (quasis.some((quasi) => quasi.value.cooked.includes(" "))) return;
|
|
37
52
|
const scope = context.sourceCode.getScope(node);
|
|
@@ -45,6 +60,8 @@ var no_constant_template_expression_default = createRule({
|
|
|
45
60
|
if (def?.parent?.type === AST_NODE_TYPES.VariableDeclaration && (def.parent.parent.type === AST_NODE_TYPES.ExportNamedDeclaration || def.parent.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration)) continue;
|
|
46
61
|
}
|
|
47
62
|
}
|
|
63
|
+
const services = ESLintUtils.getParserServices(context);
|
|
64
|
+
const checker = services.program.getTypeChecker();
|
|
48
65
|
const value = getLiteralValue(services.getTypeAtLocation(expr), checker);
|
|
49
66
|
if (value === null) continue;
|
|
50
67
|
if (value.length >= options.minAllowedLength) return;
|
|
@@ -55,14 +72,19 @@ var no_constant_template_expression_default = createRule({
|
|
|
55
72
|
suggest: [{
|
|
56
73
|
messageId: "replaceByString",
|
|
57
74
|
data: { value },
|
|
58
|
-
fix(fixer) {
|
|
75
|
+
*fix(fixer) {
|
|
59
76
|
const [identStart, identEnd] = expr.range;
|
|
60
77
|
const previousQuasi = quasis.toReversed().find((quasi) => quasi.range[1] <= identStart);
|
|
61
78
|
const nextQuasi = quasis.find((quasi) => quasi.range[0] >= identEnd);
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
/* v8 ignore if -- @preserve */
|
|
80
|
+
if (!previousQuasi || !nextQuasi) {
|
|
81
|
+
console.error("No previous/next quasi found. This should never happen.");
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const start = previousQuasi.range[1];
|
|
85
|
+
const end = nextQuasi.range[0];
|
|
64
86
|
const range = [start - 2, end + 1];
|
|
65
|
-
|
|
87
|
+
yield fixer.replaceTextRange(range, value);
|
|
66
88
|
}
|
|
67
89
|
}]
|
|
68
90
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WyrmPluginDocs } from "../utils/createRule.mjs";
|
|
2
|
+
import * as _typescript_eslint_utils_ts_eslint3 from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
|
|
4
|
+
//#region lib/rules/no-duplicated-return.d.ts
|
|
5
|
+
declare const _default: _typescript_eslint_utils_ts_eslint3.RuleModule<"noDuplicatedReturn", [], WyrmPluginDocs, _typescript_eslint_utils_ts_eslint3.RuleListener>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createRule } from "../utils/createRule.mjs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { AST_NODE_TYPES, AST_TOKEN_TYPES } from "@typescript-eslint/utils";
|
|
4
|
+
|
|
5
|
+
//#region lib/rules/no-duplicated-return.ts
|
|
6
|
+
const { name } = path.parse(import.meta.filename);
|
|
7
|
+
var no_duplicated_return_default = createRule({
|
|
8
|
+
name,
|
|
9
|
+
meta: {
|
|
10
|
+
type: "suggestion",
|
|
11
|
+
docs: {
|
|
12
|
+
description: "Forbid duplicated branches with early returns",
|
|
13
|
+
recommended: true
|
|
14
|
+
},
|
|
15
|
+
schema: [],
|
|
16
|
+
messages: { noDuplicatedReturn: "Both branches do the same thing" }
|
|
17
|
+
},
|
|
18
|
+
defaultOptions: [],
|
|
19
|
+
create(context) {
|
|
20
|
+
function getTokensForStatements(stmts) {
|
|
21
|
+
return normalizeStatements(stmts).flatMap((stmt) => context.sourceCode.getTokens(stmt));
|
|
22
|
+
}
|
|
23
|
+
function compareStatementLists(a, b) {
|
|
24
|
+
return compareTokens(getTokensForStatements(a), getTokensForStatements(b));
|
|
25
|
+
}
|
|
26
|
+
function compareStatements(a, b) {
|
|
27
|
+
return compareStatementLists(getStatements(a), getStatements(b));
|
|
28
|
+
}
|
|
29
|
+
function checkStatements(ifStatement, subsequentStatements) {
|
|
30
|
+
if (ifStatement.alternate) return;
|
|
31
|
+
if (!alwaysReturns(ifStatement.consequent)) return;
|
|
32
|
+
if (!compareStatements(ifStatement.consequent, subsequentStatements)) return;
|
|
33
|
+
context.report({
|
|
34
|
+
node: ifStatement,
|
|
35
|
+
messageId: "noDuplicatedReturn"
|
|
36
|
+
});
|
|
37
|
+
const lastStatement = subsequentStatements.at(-1);
|
|
38
|
+
/* v8 ignore else -- @preserve */
|
|
39
|
+
if (lastStatement) context.report({
|
|
40
|
+
node: lastStatement,
|
|
41
|
+
messageId: "noDuplicatedReturn"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function checkBody(node) {
|
|
45
|
+
if (node.body.type !== AST_NODE_TYPES.BlockStatement) return;
|
|
46
|
+
const { body } = node.body;
|
|
47
|
+
for (const stmt of body) {
|
|
48
|
+
if (stmt.type !== AST_NODE_TYPES.IfStatement) continue;
|
|
49
|
+
checkStatements(stmt, body.slice(body.indexOf(stmt) + 1));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
FunctionDeclaration: checkBody,
|
|
54
|
+
FunctionExpression: checkBody,
|
|
55
|
+
ArrowFunctionExpression: checkBody
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
function compareTokens(tokensA, tokensB) {
|
|
60
|
+
const [a, ...restA] = tokensA;
|
|
61
|
+
const [b, ...restB] = tokensB;
|
|
62
|
+
if (a === void 0 && b === void 0) return true;
|
|
63
|
+
if (a === void 0) return false;
|
|
64
|
+
if (b === void 0) return false;
|
|
65
|
+
if (!areTokensEqual(a, b)) return false;
|
|
66
|
+
return compareTokens(restA, restB);
|
|
67
|
+
}
|
|
68
|
+
function areTokensEqual(a, b) {
|
|
69
|
+
if (a.type !== b.type) return false;
|
|
70
|
+
if (a.type === AST_TOKEN_TYPES.String) return a.value.slice(1, -1) === b.value.slice(1, -1);
|
|
71
|
+
return a.value === b.value;
|
|
72
|
+
}
|
|
73
|
+
function normalizeStatements(stmts) {
|
|
74
|
+
return stmts.flatMap((stmt) => {
|
|
75
|
+
if (stmt.type === AST_NODE_TYPES.ReturnStatement && stmt.argument === null) return [];
|
|
76
|
+
return [stmt];
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function getStatements(stmt) {
|
|
80
|
+
if (Array.isArray(stmt)) return stmt;
|
|
81
|
+
if (stmt.type === AST_NODE_TYPES.BlockStatement) return stmt.body;
|
|
82
|
+
return [stmt];
|
|
83
|
+
}
|
|
84
|
+
function alwaysReturns(stmt) {
|
|
85
|
+
if (stmt == null) return true;
|
|
86
|
+
if (stmt.type === AST_NODE_TYPES.ReturnStatement) return true;
|
|
87
|
+
if (stmt.type === AST_NODE_TYPES.BlockStatement) return stmt.body.some((s) => alwaysReturns(s));
|
|
88
|
+
if (stmt.type === AST_NODE_TYPES.IfStatement) return alwaysReturns(stmt.consequent) && alwaysReturns(stmt.alternate);
|
|
89
|
+
if (stmt.type !== AST_NODE_TYPES.TryStatement) return false;
|
|
90
|
+
if (!stmt.finalizer) return alwaysReturns(stmt.block) && alwaysReturns(stmt.handler?.body);
|
|
91
|
+
if (alwaysReturns(stmt.finalizer)) return true;
|
|
92
|
+
return alwaysReturns(stmt.block) && alwaysReturns(stmt.handler?.body);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { no_duplicated_return_default as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WyrmPluginDocs } from "../utils/createRule.mjs";
|
|
2
|
+
import * as _typescript_eslint_utils_ts_eslint5 from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
|
|
4
|
+
//#region lib/rules/no-else-break.d.ts
|
|
5
|
+
declare const _default: _typescript_eslint_utils_ts_eslint5.RuleModule<"noElseBreak", [], WyrmPluginDocs, _typescript_eslint_utils_ts_eslint5.RuleListener>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRule } from "../utils/createRule.
|
|
1
|
+
import { createRule } from "../utils/createRule.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
4
|
|
|
@@ -28,6 +28,7 @@ var no_else_break_default = createRule({
|
|
|
28
28
|
messageId: "noElseBreak",
|
|
29
29
|
*fix(fixer) {
|
|
30
30
|
const firstToken = context.sourceCode.getTokenBefore(alternate);
|
|
31
|
+
/* v8 ignore else -- @preserve */
|
|
31
32
|
if (firstToken) yield fixer.remove(firstToken);
|
|
32
33
|
yield fixer.remove(alternate);
|
|
33
34
|
if (alternate.type === AST_NODE_TYPES.BlockStatement) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WyrmPluginDocs } from "../utils/createRule.mjs";
|
|
2
|
+
import * as _typescript_eslint_utils_ts_eslint7 from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
|
|
4
|
+
//#region lib/rules/no-else-continue.d.ts
|
|
5
|
+
declare const _default: _typescript_eslint_utils_ts_eslint7.RuleModule<"noElseContinue", [], WyrmPluginDocs, _typescript_eslint_utils_ts_eslint7.RuleListener>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRule } from "../utils/createRule.
|
|
1
|
+
import { createRule } from "../utils/createRule.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
4
|
|
|
@@ -28,6 +28,7 @@ var no_else_continue_default = createRule({
|
|
|
28
28
|
messageId: "noElseContinue",
|
|
29
29
|
*fix(fixer) {
|
|
30
30
|
const firstToken = context.sourceCode.getTokenBefore(alternate);
|
|
31
|
+
/* v8 ignore else -- @preserve */
|
|
31
32
|
if (firstToken) yield fixer.remove(firstToken);
|
|
32
33
|
yield fixer.remove(alternate);
|
|
33
34
|
if (alternate.type === AST_NODE_TYPES.BlockStatement) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WyrmPluginDocs } from "../utils/createRule.mjs";
|
|
2
|
+
import * as _typescript_eslint_utils_ts_eslint1 from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
|
|
4
|
+
//#region lib/rules/no-else-throw.d.ts
|
|
5
|
+
declare const _default: _typescript_eslint_utils_ts_eslint1.RuleModule<"noElseThrow", [], WyrmPluginDocs, _typescript_eslint_utils_ts_eslint1.RuleListener>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRule } from "../utils/createRule.
|
|
1
|
+
import { createRule } from "../utils/createRule.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
4
4
|
|
|
@@ -28,6 +28,7 @@ var no_else_throw_default = createRule({
|
|
|
28
28
|
messageId: "noElseThrow",
|
|
29
29
|
*fix(fixer) {
|
|
30
30
|
const firstToken = context.sourceCode.getTokenBefore(alternate);
|
|
31
|
+
/* v8 ignore else -- @preserve */
|
|
31
32
|
if (firstToken) yield fixer.remove(firstToken);
|
|
32
33
|
yield fixer.remove(alternate);
|
|
33
34
|
if (alternate.type === AST_NODE_TYPES.BlockStatement) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WyrmPluginDocs } from "../utils/createRule.mjs";
|
|
2
|
+
import * as _typescript_eslint_utils_ts_eslint13 from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
|
|
4
|
+
//#region lib/rules/no-empty-comment.d.ts
|
|
5
|
+
declare const _default: _typescript_eslint_utils_ts_eslint13.RuleModule<"noEmptyComment", [{
|
|
6
|
+
allowPadding: boolean;
|
|
7
|
+
}], WyrmPluginDocs, _typescript_eslint_utils_ts_eslint13.RuleListener>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { _default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createRule } from "../utils/createRule.
|
|
1
|
+
import { createRule } from "../utils/createRule.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { AST_TOKEN_TYPES } from "@typescript-eslint/utils";
|
|
4
4
|
|
|
5
5
|
//#region lib/rules/no-empty-comment.ts
|
|
6
6
|
const { name } = path.parse(import.meta.filename);
|
|
7
|
-
const
|
|
7
|
+
const DEFAULT_ALLOW_PADDING = true;
|
|
8
8
|
var no_empty_comment_default = createRule({
|
|
9
9
|
name,
|
|
10
10
|
meta: {
|
|
@@ -16,20 +16,20 @@ var no_empty_comment_default = createRule({
|
|
|
16
16
|
schema: [{
|
|
17
17
|
type: "object",
|
|
18
18
|
additionalProperties: false,
|
|
19
|
-
properties: {
|
|
19
|
+
properties: { allowPadding: {
|
|
20
20
|
type: "boolean",
|
|
21
|
-
description: `Whether to allow empty comments stacked next to non-empty comments. Default: \`${
|
|
21
|
+
description: `Whether to allow empty padding comments stacked next to non-empty comments. Default: \`${DEFAULT_ALLOW_PADDING}\``
|
|
22
22
|
} }
|
|
23
23
|
}],
|
|
24
24
|
messages: { noEmptyComment: "Remove this empty comment" }
|
|
25
25
|
},
|
|
26
|
-
defaultOptions: [{
|
|
26
|
+
defaultOptions: [{ allowPadding: DEFAULT_ALLOW_PADDING }],
|
|
27
27
|
create(context, [options]) {
|
|
28
28
|
if (typeof context.sourceCode.getAllComments === "undefined") return {};
|
|
29
29
|
const comments = context.sourceCode.getAllComments();
|
|
30
30
|
for (const comment of comments) {
|
|
31
31
|
if (!isEmptyComment(comment)) continue;
|
|
32
|
-
if (options.
|
|
32
|
+
if (options.allowPadding && isPaddingComment(comment, comments)) continue;
|
|
33
33
|
context.report({
|
|
34
34
|
node: comment,
|
|
35
35
|
messageId: "noEmptyComment"
|
|
@@ -41,7 +41,7 @@ var no_empty_comment_default = createRule({
|
|
|
41
41
|
function isEmptyComment(comment) {
|
|
42
42
|
return !comment.value.replace(/^\*/u, "").replaceAll("*\n", "").trim();
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function isPaddingComment(comment, comments) {
|
|
45
45
|
if (comment.type !== AST_TOKEN_TYPES.Line) return false;
|
|
46
46
|
return comments.some((otherComment) => {
|
|
47
47
|
if (otherComment === comment) return false;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WyrmPluginDocs } from "../utils/createRule.mjs";
|
|
2
|
+
import * as _typescript_eslint_utils_ts_eslint19 from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
|
|
4
|
+
//#region lib/rules/no-empty-jsx-expression.d.ts
|
|
5
|
+
declare const _default: _typescript_eslint_utils_ts_eslint19.RuleModule<"noEmptyJsxExpression", [], WyrmPluginDocs, _typescript_eslint_utils_ts_eslint19.RuleListener>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { _default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WyrmPluginDocs } from "../utils/createRule.mjs";
|
|
2
|
+
import * as _typescript_eslint_utils_ts_eslint21 from "@typescript-eslint/utils/ts-eslint";
|
|
3
|
+
|
|
4
|
+
//#region lib/rules/no-extra-false-fallback.d.ts
|
|
5
|
+
|
|
6
|
+
declare const _default: _typescript_eslint_utils_ts_eslint21.RuleModule<"noExtraFalseFallbackInCondition" | "noExtraFalseFallbackInPredicate" | "noExtraFalseFallbackInsideBooleanCast" | "removeFalseFallback", [], WyrmPluginDocs, _typescript_eslint_utils_ts_eslint21.RuleListener>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { _default };
|