eslint-plugin-etc-misc 1.1.6 → 1.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.
Files changed (125) hide show
  1. package/README.md +135 -135
  2. package/dist/_internal/casing.js +2 -2
  3. package/dist/_internal/casing.js.map +1 -1
  4. package/dist/_internal/get-core-rule.d.ts.map +1 -1
  5. package/dist/_internal/get-core-rule.js +1 -2
  6. package/dist/_internal/get-core-rule.js.map +1 -1
  7. package/dist/_internal/import-patterns.js +3 -3
  8. package/dist/_internal/import-patterns.js.map +1 -1
  9. package/dist/_internal/rule-catalog.js +4 -4
  10. package/dist/_internal/rule-catalog.js.map +1 -1
  11. package/dist/_internal/rule-deprecation.d.ts +2 -2
  12. package/dist/_internal/rule-deprecation.d.ts.map +1 -1
  13. package/dist/_internal/rule-deprecation.js +10 -12
  14. package/dist/_internal/rule-deprecation.js.map +1 -1
  15. package/dist/_internal/symbol-usage.d.ts +1 -1
  16. package/dist/_internal/symbol-usage.d.ts.map +1 -1
  17. package/dist/_internal/symbol-usage.js +1 -1
  18. package/dist/_internal/symbol-usage.js.map +1 -1
  19. package/dist/plugin.cjs +78 -101
  20. package/dist/plugin.cjs.map +3 -3
  21. package/dist/rules/match-filename.js +2 -2
  22. package/dist/rules/match-filename.js.map +1 -1
  23. package/dist/rules/no-assign-mutated-array.js +3 -3
  24. package/dist/rules/no-assign-mutated-array.js.map +1 -1
  25. package/dist/rules/no-const-enum.js +17 -17
  26. package/dist/rules/no-const-enum.js.map +1 -1
  27. package/dist/rules/no-deprecated.js +3 -3
  28. package/dist/rules/no-deprecated.js.map +1 -1
  29. package/dist/rules/no-foreach.js +2 -2
  30. package/dist/rules/no-foreach.js.map +1 -1
  31. package/dist/rules/no-implicit-any-catch.d.ts.map +1 -1
  32. package/dist/rules/no-implicit-any-catch.js.map +1 -1
  33. package/dist/rules/no-internal.js +3 -3
  34. package/dist/rules/no-internal.js.map +1 -1
  35. package/dist/rules/no-misused-generics.d.ts.map +1 -1
  36. package/dist/rules/no-misused-generics.js +11 -11
  37. package/dist/rules/no-misused-generics.js.map +1 -1
  38. package/dist/rules/no-single-line-comment.d.ts.map +1 -1
  39. package/dist/rules/no-single-line-comment.js +11 -15
  40. package/dist/rules/no-single-line-comment.js.map +1 -1
  41. package/dist/rules/no-use-extend-native.d.ts.map +1 -1
  42. package/dist/rules/no-use-extend-native.js +4 -3
  43. package/dist/rules/no-use-extend-native.js.map +1 -1
  44. package/dist/rules/object-format.js +2 -2
  45. package/dist/rules/object-format.js.map +1 -1
  46. package/dist/rules/sort-array.js +2 -2
  47. package/dist/rules/sort-array.js.map +1 -1
  48. package/dist/rules/sort-class-members.d.ts.map +1 -1
  49. package/dist/rules/sort-class-members.js.map +1 -1
  50. package/dist/rules/sort-export-specifiers.js +2 -2
  51. package/dist/rules/sort-export-specifiers.js.map +1 -1
  52. package/dist/rules/switch-case-spacing.d.ts.map +1 -1
  53. package/dist/rules/switch-case-spacing.js +5 -4
  54. package/dist/rules/switch-case-spacing.js.map +1 -1
  55. package/dist/rules/throw-error.d.ts.map +1 -1
  56. package/dist/rules/throw-error.js +12 -14
  57. package/dist/rules/throw-error.js.map +1 -1
  58. package/dist/rules/typescript-array-callback-return-type.d.ts.map +1 -1
  59. package/dist/rules/typescript-array-callback-return-type.js.map +1 -1
  60. package/dist/rules/typescript-class-methods-use-this.d.ts.map +1 -1
  61. package/dist/rules/typescript-class-methods-use-this.js +3 -3
  62. package/dist/rules/typescript-class-methods-use-this.js.map +1 -1
  63. package/dist/rules/typescript-no-redundant-undefined-const.d.ts.map +1 -1
  64. package/dist/rules/typescript-no-redundant-undefined-const.js +1 -4
  65. package/dist/rules/typescript-no-redundant-undefined-const.js.map +1 -1
  66. package/dist/rules/typescript-no-redundant-undefined-default-parameter.d.ts.map +1 -1
  67. package/dist/rules/typescript-no-redundant-undefined-default-parameter.js +1 -4
  68. package/dist/rules/typescript-no-redundant-undefined-default-parameter.js.map +1 -1
  69. package/dist/rules/typescript-no-redundant-undefined-let.d.ts.map +1 -1
  70. package/dist/rules/typescript-no-redundant-undefined-let.js +2 -5
  71. package/dist/rules/typescript-no-redundant-undefined-let.js.map +1 -1
  72. package/dist/rules/typescript-no-redundant-undefined-promise-return-type.d.ts.map +1 -1
  73. package/dist/rules/typescript-no-redundant-undefined-promise-return-type.js +1 -4
  74. package/dist/rules/typescript-no-redundant-undefined-promise-return-type.js.map +1 -1
  75. package/dist/rules/typescript-no-redundant-undefined-readonly-property.d.ts.map +1 -1
  76. package/dist/rules/typescript-no-redundant-undefined-readonly-property.js +1 -4
  77. package/dist/rules/typescript-no-redundant-undefined-readonly-property.js.map +1 -1
  78. package/dist/rules/typescript-no-redundant-undefined-return-type.d.ts.map +1 -1
  79. package/dist/rules/typescript-no-redundant-undefined-return-type.js +1 -4
  80. package/dist/rules/typescript-no-redundant-undefined-return-type.js.map +1 -1
  81. package/dist/rules/typescript-no-redundant-undefined-var.d.ts.map +1 -1
  82. package/dist/rules/typescript-no-redundant-undefined-var.js +2 -5
  83. package/dist/rules/typescript-no-redundant-undefined-var.js.map +1 -1
  84. package/dist/rules/typescript-prefer-enum.d.ts.map +1 -1
  85. package/dist/rules/typescript-prefer-enum.js.map +1 -1
  86. package/dist/rules/typescript-prefer-named-tuple-members.d.ts.map +1 -1
  87. package/dist/rules/typescript-prefer-named-tuple-members.js +2 -5
  88. package/dist/rules/typescript-prefer-named-tuple-members.js.map +1 -1
  89. package/dist/rules/typescript-prefer-readonly-property.d.ts.map +1 -1
  90. package/dist/rules/typescript-prefer-readonly-property.js +9 -11
  91. package/dist/rules/typescript-prefer-readonly-property.js.map +1 -1
  92. package/dist/rules/typescript-require-prop-type-annotation.d.ts.map +1 -1
  93. package/dist/rules/typescript-require-prop-type-annotation.js +9 -11
  94. package/dist/rules/typescript-require-prop-type-annotation.js.map +1 -1
  95. package/dist/rules/typescript-require-this-void.d.ts.map +1 -1
  96. package/dist/rules/typescript-require-this-void.js +9 -11
  97. package/dist/rules/typescript-require-this-void.js.map +1 -1
  98. package/docs/AGENTS.md +20 -18
  99. package/docs/docusaurus/blog/authors.yml +11 -11
  100. package/docs/docusaurus/docusaurus.config.ts +23 -25
  101. package/docs/docusaurus/package.json +2 -1
  102. package/docs/docusaurus/sidebars.rules.ts +40 -42
  103. package/docs/docusaurus/sidebars.ts +20 -20
  104. package/docs/docusaurus/src/components/GitHubStats.jsx +4 -4
  105. package/docs/docusaurus/src/components/GitHubStats.module.css +18 -3
  106. package/docs/docusaurus/src/js/modernEnhancements.ts +55 -55
  107. package/docs/docusaurus/src/pages/index.jsx +12 -12
  108. package/docs/docusaurus/typedoc-plugins/hashToBangLinksCore.d.mts +4 -2
  109. package/docs/docusaurus/typedoc.config.json +7 -586
  110. package/docs/rules/consistent-enum-members.md +3 -3
  111. package/docs/rules/consistent-filename.md +1 -1
  112. package/docs/rules/getting-started.md +19 -21
  113. package/docs/rules/no-assign-mutated-array.md +5 -25
  114. package/docs/rules/no-expression-empty-lines.md +2 -4
  115. package/docs/rules/no-foreach.md +1 -5
  116. package/docs/rules/no-function-declare-after-return.md +72 -66
  117. package/docs/rules/no-use-extend-native.md +29 -31
  118. package/docs/rules/no-vulnerable.md +32 -34
  119. package/docs/rules/prefer-includes.md +2 -11
  120. package/docs/rules/presets/all.md +1 -1
  121. package/docs/rules/presets/recommended.md +1 -1
  122. package/docs/rules/require-jsdoc.md +1 -7
  123. package/docs/rules/sort-array.md +2 -10
  124. package/docs/rules/typescript-array-callback-return-type.md +5 -17
  125. package/package.json +17 -9
@@ -31,16 +31,31 @@
31
31
  filter: brightness(1.06);
32
32
  transform: translateY(-1px);
33
33
  }
34
+
35
+ @media screen and (prefers-reduced-motion: reduce) {
36
+ display: inline-flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ padding: 0;
40
+ border: 0;
41
+ border-radius: 0;
42
+ background: transparent;
43
+ transition: none;
44
+
45
+ &:hover,
46
+ &:focus {
47
+ filter: brightness(1.06);
48
+ transform: translateY(-1px);
49
+ }
50
+ }
34
51
  }
35
52
 
36
53
  .liveBadgeImage {
37
54
  display: block;
38
55
  block-size: 20px;
39
56
  inline-size: auto;
40
- }
41
57
 
42
- @media (width <= 640px) {
43
- .liveBadgeImage {
58
+ @media (width <= 640px) {
44
59
  block-size: 18px;
45
60
  }
46
61
  }
@@ -7,9 +7,9 @@
7
7
  type CleanupFunction = () => void;
8
8
 
9
9
  /** Mutable holder used to swap active cleanup handlers between route refreshes. */
10
- type CleanupRef = {
10
+ interface CleanupRef {
11
11
  current: CleanupFunction | null;
12
- };
12
+ }
13
13
 
14
14
  declare global {
15
15
  interface Window {
@@ -21,14 +21,47 @@ declare global {
21
21
  const ROUTE_REFRESH_DELAY_MS = 100;
22
22
 
23
23
  /**
24
- * Check whether a node is an {@link HTMLElement}.
25
- *
26
- * @param element - DOM element candidate.
24
+ * Apply a subtle animation to the theme toggle control.
27
25
  *
28
- * @returns `true` when element is an `HTMLElement` instance.
26
+ * @returns Cleanup callback that removes click listeners and pending timers.
29
27
  */
30
- function isHTMLElement(element: Element | null): element is HTMLElement {
31
- return element instanceof HTMLElement;
28
+ function applyThemeToggleAnimation(): CleanupFunction {
29
+ const themeToggle = document.querySelector(
30
+ '[aria-label*="color mode"], [title*="Switch"]'
31
+ );
32
+
33
+ if (!isHTMLElement(themeToggle)) {
34
+ return (): void => {
35
+ // No-op when theme toggle is not present.
36
+ };
37
+ }
38
+
39
+ let animationTimer: null | ReturnType<typeof setTimeout> = null;
40
+
41
+ const handleClick = (): void => {
42
+ themeToggle.style.transform = "scale(0.94)";
43
+ themeToggle.style.transition = "transform 120ms ease";
44
+
45
+ if (animationTimer) {
46
+ clearTimeout(animationTimer);
47
+ }
48
+
49
+ animationTimer = setTimeout(() => {
50
+ themeToggle.style.transform = "scale(1)";
51
+ animationTimer = null;
52
+ }, 90);
53
+ };
54
+
55
+ themeToggle.addEventListener("click", handleClick);
56
+
57
+ return (): void => {
58
+ if (animationTimer) {
59
+ clearTimeout(animationTimer);
60
+ animationTimer = null;
61
+ }
62
+
63
+ themeToggle.removeEventListener("click", handleClick);
64
+ };
32
65
  }
33
66
 
34
67
  /**
@@ -72,57 +105,13 @@ function createScrollIndicator(): CleanupFunction {
72
105
  };
73
106
  }
74
107
 
75
- /**
76
- * Apply a subtle animation to the theme toggle control.
77
- *
78
- * @returns Cleanup callback that removes click listeners and pending timers.
79
- */
80
- function applyThemeToggleAnimation(): CleanupFunction {
81
- const themeToggle = document.querySelector(
82
- '[aria-label*="color mode"], [title*="Switch"]'
83
- );
84
-
85
- if (!isHTMLElement(themeToggle)) {
86
- return (): void => {
87
- // No-op when theme toggle is not present.
88
- };
89
- }
90
-
91
- let animationTimer: null | ReturnType<typeof setTimeout> = null;
92
-
93
- const handleClick = (): void => {
94
- themeToggle.style.transform = "scale(0.94)";
95
- themeToggle.style.transition = "transform 120ms ease";
96
-
97
- if (animationTimer) {
98
- clearTimeout(animationTimer);
99
- }
100
-
101
- animationTimer = setTimeout(() => {
102
- themeToggle.style.transform = "scale(1)";
103
- animationTimer = null;
104
- }, 90);
105
- };
106
-
107
- themeToggle.addEventListener("click", handleClick);
108
-
109
- return (): void => {
110
- if (animationTimer) {
111
- clearTimeout(animationTimer);
112
- animationTimer = null;
113
- }
114
-
115
- themeToggle.removeEventListener("click", handleClick);
116
- };
117
- }
118
-
119
108
  /**
120
109
  * Initialize modern interaction features and return cleanup hooks.
121
110
  *
122
111
  * @returns Cleanup callback for all registered enhancement handlers.
123
112
  */
124
113
  function initializeAdvancedFeatures(): CleanupFunction {
125
- const prefersReducedMotion = window.matchMedia(
114
+ const prefersReducedMotion = globalThis.matchMedia(
126
115
  "(prefers-reduced-motion: reduce)"
127
116
  ).matches;
128
117
  const cleanupFunctions: CleanupFunction[] = [];
@@ -134,9 +123,9 @@ function initializeAdvancedFeatures(): CleanupFunction {
134
123
  }
135
124
 
136
125
  return (): void => {
137
- cleanupFunctions.forEach((cleanup) => {
126
+ for (const cleanup of cleanupFunctions) {
138
127
  cleanup();
139
- });
128
+ }
140
129
  };
141
130
  }
142
131
 
@@ -210,6 +199,17 @@ function initializeEnhancements(): CleanupFunction {
210
199
  };
211
200
  }
212
201
 
202
+ /**
203
+ * Check whether a node is an {@link HTMLElement}.
204
+ *
205
+ * @param element - DOM element candidate.
206
+ *
207
+ * @returns `true` when element is an `HTMLElement` instance.
208
+ */
209
+ function isHTMLElement(element: Element | null): element is HTMLElement {
210
+ return element instanceof HTMLElement;
211
+ }
212
+
213
213
  if (typeof window !== "undefined" && typeof document !== "undefined") {
214
214
  initializeEnhancements();
215
215
  window.initializeAdvancedFeatures = initializeAdvancedFeatures;
@@ -1,9 +1,9 @@
1
1
  import Link from "@docusaurus/Link";
2
2
  import useBaseUrl from "@docusaurus/useBaseUrl";
3
- import Layout from "@theme/Layout";
4
3
  import Heading from "@theme/Heading";
5
- import GitHubStats from "../components/GitHubStats";
4
+ import Layout from "@theme/Layout";
6
5
 
6
+ import GitHubStats from "../components/GitHubStats";
7
7
  import styles from "./index.module.css";
8
8
 
9
9
  const heroBadges = [
@@ -47,24 +47,24 @@ const heroStats = [
47
47
 
48
48
  const homeCards = [
49
49
  {
50
- icon: "\uf135",
51
- title: "Get Started",
52
50
  description:
53
51
  "Install the plugin, enable a preset, and start enforcing consistent TypeScript-first conventions.",
52
+ icon: "\u{F135}",
53
+ title: "Get Started",
54
54
  to: "/docs/rules/getting-started",
55
55
  },
56
56
  {
57
- icon: "\uf14e",
58
- title: "Presets",
59
57
  description:
60
58
  "Choose between the focused recommended preset and the complete all-rules preset.",
59
+ icon: "\u{F14E}",
60
+ title: "Presets",
61
61
  to: "/docs/rules/presets/all",
62
62
  },
63
63
  {
64
- icon: "\uf02d",
65
- title: "Rule Reference",
66
64
  description:
67
65
  "Browse every rule with concrete incorrect/correct examples and migration guidance.",
66
+ icon: "\u{F02D}",
67
+ title: "Rule Reference",
68
68
  to: "/docs/rules",
69
69
  },
70
70
  ];
@@ -79,8 +79,8 @@ export default function Home() {
79
79
 
80
80
  return (
81
81
  <Layout
82
- title="eslint-plugin-etc-misc docs"
83
82
  description="Documentation for eslint-plugin-etc-misc"
83
+ title="eslint-plugin-etc-misc docs"
84
84
  >
85
85
  <header className={styles.heroBanner}>
86
86
  <div className={`container ${styles.heroContent}`}>
@@ -102,8 +102,8 @@ export default function Home() {
102
102
  <div className={styles.heroBadgeRow}>
103
103
  {heroBadges.map((badge) => (
104
104
  <article
105
- key={badge.label}
106
105
  className={styles.heroBadge}
106
+ key={badge.label}
107
107
  >
108
108
  <p className={styles.heroBadgeLabel}>
109
109
  <span
@@ -159,8 +159,8 @@ export default function Home() {
159
159
  <div className={styles.heroStats}>
160
160
  {heroStats.map((stat) => (
161
161
  <article
162
- key={stat.headline}
163
162
  className={styles.heroStatCard}
163
+ key={stat.headline}
164
164
  >
165
165
  <p className={styles.heroStatHeading}>
166
166
  {stat.headline}
@@ -178,7 +178,7 @@ export default function Home() {
178
178
  <section className="container">
179
179
  <div className={styles.cardGrid}>
180
180
  {homeCards.map((card) => (
181
- <article key={card.title} className={styles.card}>
181
+ <article className={styles.card} key={card.title}>
182
182
  <div className={styles.cardHeader}>
183
183
  <p className={styles.cardIcon}>
184
184
  {card.icon}
@@ -3,7 +3,8 @@
3
3
  */
4
4
 
5
5
  /**
6
- * Rewrites `module#Export` to `module!Export` for module-source-like references.
6
+ * Rewrites `module#Export` to `module!Export` for module-source-like
7
+ * references.
7
8
  *
8
9
  * @param inlineTagText - The inline-tag payload stored by TypeDoc.
9
10
  */
@@ -24,7 +25,8 @@ export declare function convertHashLinksToBangLinksInComment(
24
25
  /**
25
26
  * Mutates an array of TypeDoc comment display parts in-place.
26
27
  *
27
- * @param parts - Display parts collection whose inline-tag text may be rewritten.
28
+ * @param parts - Display parts collection whose inline-tag text may be
29
+ * rewritten.
28
30
  */
29
31
  export declare function convertHashLinksToBangLinksInParts(
30
32
  parts: Array<Record<string, unknown>>