eslint-plugin-etc-misc 1.1.2 → 1.1.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"no-vulnerable.d.ts","sourceRoot":"","sources":["../../src/rules/no-vulnerable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAK/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,KAAK,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC;AAEnD,KAAK,UAAU,GAAG,cAAc,GAAG,YAAY,CAAC;AAEhD,KAAK,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;AAEtC,KAAK,UAAU,GAAG,QAAQ,CACtB,iBAAiB,GAAG;IAChB,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CAChE,CACJ,CAAC;AAqFF;;GAEG;AACH,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,CAkK5D,CAAC;AAEH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"no-vulnerable.d.ts","sourceRoot":"","sources":["../../src/rules/no-vulnerable.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAS/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,KAAK,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC;AAEnD,KAAK,UAAU,GAAG,cAAc,GAAG,YAAY,CAAC;AAEhD,KAAK,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;AAUtC,KAAK,UAAU,GAAG,QAAQ,CACtB,iBAAiB,GAAG;IAChB,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CAChE,CACJ,CAAC;AA4RF;;GAEG;AACH,QAAA,MAAM,IAAI,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,CAyL5D,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -1,6 +1,123 @@
1
+ import { statSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { basename, dirname, join } from "node:path";
1
4
  import { checkSync } from "recheck";
2
5
  import { arrayFirst, isDefined, keyIn, setHas } from "ts-extras";
3
6
  import { ruleCreator } from "../_internal/rule-creator.js";
7
+ const requireFromWorkingDirectory = createRequire(join(process.cwd(), "package.json"));
8
+ const isUnknownRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
9
+ const isModuleNotFoundError = (error) => {
10
+ if (!isUnknownRecord(error)) {
11
+ return false;
12
+ }
13
+ return keyIn(error, "code") && error["code"] === "MODULE_NOT_FOUND";
14
+ };
15
+ const createRequireFromPluginPackage = () => {
16
+ try {
17
+ return createRequire(requireFromWorkingDirectory.resolve("eslint-plugin-etc-misc/package.json"));
18
+ }
19
+ catch (error) {
20
+ if (isModuleNotFoundError(error)) {
21
+ return requireFromWorkingDirectory;
22
+ }
23
+ throw error;
24
+ }
25
+ };
26
+ const requireFromPluginPackage = createRequireFromPluginPackage();
27
+ const isExistingFile = (filePath) => {
28
+ try {
29
+ return statSync(filePath).isFile();
30
+ }
31
+ catch {
32
+ return false;
33
+ }
34
+ };
35
+ const shouldOverrideRuntimePath = (currentPath) => !isDefined(currentPath) ||
36
+ !isExistingFile(currentPath) ||
37
+ basename(currentPath).toLowerCase() === "package.json";
38
+ const resolvePackageSiblingFile = (packageJsonSpecifier, siblingFileName) => {
39
+ try {
40
+ const packageJsonPath = requireFromPluginPackage.resolve(packageJsonSpecifier);
41
+ return join(dirname(packageJsonPath), siblingFileName);
42
+ }
43
+ catch (error) {
44
+ if (isModuleNotFoundError(error)) {
45
+ return null;
46
+ }
47
+ throw error;
48
+ }
49
+ };
50
+ const resolveRecheckJarPath = () => resolvePackageSiblingFile("recheck-jar/package.json", "recheck.jar");
51
+ const resolveRecheckWindowsBinaryPath = () => {
52
+ if (process.platform !== "win32" || process.arch !== "x64") {
53
+ return null;
54
+ }
55
+ return resolvePackageSiblingFile("recheck-windows-x64/package.json", "recheck.exe");
56
+ };
57
+ const recheckJarPath = process.platform === "win32" ? resolveRecheckJarPath() : null;
58
+ const recheckWindowsBinaryPath = process.platform === "win32" ? resolveRecheckWindowsBinaryPath() : null;
59
+ /* eslint-disable n/no-process-env -- recheck exposes backend runtime paths only through environment variables, so the rule temporarily normalizes them while invoking the analyzer. */
60
+ const deleteRecheckEnvironmentValue = (key) => {
61
+ if (key === "RECHECK_BIN") {
62
+ delete process.env["RECHECK_BIN"];
63
+ return;
64
+ }
65
+ delete process.env["RECHECK_JAR"];
66
+ };
67
+ const getRecheckEnvironmentValue = (key) => key === "RECHECK_BIN"
68
+ ? process.env["RECHECK_BIN"]
69
+ : process.env["RECHECK_JAR"];
70
+ const setRecheckEnvironmentValue = (key, value) => {
71
+ if (key === "RECHECK_BIN") {
72
+ process.env["RECHECK_BIN"] = value;
73
+ return;
74
+ }
75
+ process.env["RECHECK_JAR"] = value;
76
+ };
77
+ const getRecheckEnvironmentOverrides = () => {
78
+ if (process.platform !== "win32") {
79
+ return {};
80
+ }
81
+ const overrides = {};
82
+ if (recheckJarPath !== null &&
83
+ isExistingFile(recheckJarPath) &&
84
+ shouldOverrideRuntimePath(getRecheckEnvironmentValue("RECHECK_JAR"))) {
85
+ overrides.RECHECK_JAR = recheckJarPath;
86
+ }
87
+ if (recheckWindowsBinaryPath !== null &&
88
+ isExistingFile(recheckWindowsBinaryPath) &&
89
+ shouldOverrideRuntimePath(getRecheckEnvironmentValue("RECHECK_BIN"))) {
90
+ overrides.RECHECK_BIN = recheckWindowsBinaryPath;
91
+ }
92
+ return overrides;
93
+ };
94
+ const restoreEnvironmentValue = (key, value) => {
95
+ if (!isDefined(value)) {
96
+ deleteRecheckEnvironmentValue(key);
97
+ return;
98
+ }
99
+ setRecheckEnvironmentValue(key, value);
100
+ };
101
+ const withRecheckEnvironmentOverrides = (callback) => {
102
+ const overrides = getRecheckEnvironmentOverrides();
103
+ const previousBin = getRecheckEnvironmentValue("RECHECK_BIN");
104
+ const previousJar = getRecheckEnvironmentValue("RECHECK_JAR");
105
+ if (isDefined(overrides.RECHECK_BIN)) {
106
+ setRecheckEnvironmentValue("RECHECK_BIN", overrides.RECHECK_BIN);
107
+ }
108
+ if (isDefined(overrides.RECHECK_JAR)) {
109
+ setRecheckEnvironmentValue("RECHECK_JAR", overrides.RECHECK_JAR);
110
+ }
111
+ try {
112
+ return callback();
113
+ }
114
+ finally {
115
+ restoreEnvironmentValue("RECHECK_BIN", previousBin);
116
+ restoreEnvironmentValue("RECHECK_JAR", previousJar);
117
+ }
118
+ };
119
+ const runRecheck = (source, flags, parameters) => withRecheckEnvironmentOverrides(() => checkSync(source, flags, parameters));
120
+ /* eslint-enable n/no-process-env -- Re-enable after the recheck environment wrapper helpers. */
4
121
  const getStaticStringValue = (node) => {
5
122
  if (node.type === "Literal" && typeof node.value === "string") {
6
123
  return node.value;
@@ -52,6 +169,15 @@ const getDiagnosticsErrorMessage = (error) => {
52
169
  }
53
170
  return "No additional details provided.";
54
171
  };
172
+ const getThrownErrorMessage = (error) => {
173
+ if (error instanceof Error && error.message.length > 0) {
174
+ return error.message;
175
+ }
176
+ if (typeof error === "string" && error.length > 0) {
177
+ return error;
178
+ }
179
+ return "No additional details provided.";
180
+ };
55
181
  /**
56
182
  * Detect ReDoS-vulnerable regular expressions using `recheck`.
57
183
  */
@@ -61,7 +187,28 @@ const rule = ruleCreator({
61
187
  const { ignoreErrors = true, permittableComplexities = [], ...recheckParameters } = options;
62
188
  const allowedComplexities = new Set(permittableComplexities);
63
189
  const reportDiagnostics = (node, source, flags) => {
64
- const diagnostics = checkSync(source, flags, recheckParameters);
190
+ const diagnostics = (() => {
191
+ try {
192
+ return runRecheck(source, flags, recheckParameters);
193
+ }
194
+ catch (error) {
195
+ if (ignoreErrors) {
196
+ return null;
197
+ }
198
+ context.report({
199
+ data: {
200
+ kind: "unexpected",
201
+ message: getThrownErrorMessage(error),
202
+ },
203
+ messageId: "checkerError",
204
+ node,
205
+ });
206
+ return null;
207
+ }
208
+ })();
209
+ if (diagnostics === null) {
210
+ return;
211
+ }
65
212
  if (diagnostics.status === "safe") {
66
213
  return;
67
214
  }
@@ -1 +1 @@
1
- {"version":3,"file":"no-vulnerable.js","sourceRoot":"","sources":["../../src/rules/no-vulnerable.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAe3D,MAAM,oBAAoB,GAAG,CAAC,IAA6B,EAAiB,EAAE;IAC1E,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IACI,IAAI,CAAC,IAAI,KAAK,iBAAiB;QAC/B,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAC1B,CAAC;QACC,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC;IACzD,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CACxB,QAA6C,EACV,EAAE,CAAC,QAAQ,CAAC,IAAI,K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: "Codex-Instructions-ESLint-Docs"
3
+ description: "Instructions for writing perfect ESLint rule documentation."
4
+ applyTo: "docs/**"
5
+ ---
6
+
7
+ <instructions>
8
+ <goal>
9
+
10
+ ## Your Goal for ESLint Rule Documentation
11
+
12
+ - Your goal is to make every ESLint rule documentation file (`docs/rules/<rule-id>.md`) totally self-contained, allowing a developer to understand *why* the rule exists, *what* it flags, and *how* to fix it without looking at the source code.
13
+ - For adjacent docs in `docs/rules/` such as guides, preset pages, `overview.md`, or `getting-started.md`, keep the same tone and accuracy standards, but do not force rule-only sections where they do not fit.
14
+ - You adhere strictly to the `typescript-eslint` and standard ESLint documentation style guides.
15
+
16
+ </goal>
17
+
18
+ <structure>
19
+
20
+ ## Documentation Structure
21
+
22
+ Rule documentation files in `docs/rules/<rule-id>.md` should follow this structure closely:
23
+
24
+ 1. **Title:** The bare rule ID as the H1 header (e.g., `# prefer-type-fest-arrayable`).
25
+ 2. **Description:** A short, one-sentence description of what the rule does.
26
+ 3. **Meta Badges (Optional):** Badges for `Recommended`, `Fixable`, or `Type Checked` only if the repository’s current docs pattern uses them.
27
+ 4. **Rule Details:** An explanation of the problem the rule solves. Why is this pattern bad?
28
+ 5. **Examples:**
29
+ - Use `❌ Incorrect` and `✅ Correct` headers.
30
+ - **Crucial:** Always include code blocks with specific comments explaining *why* a line is incorrect.
31
+ - If the rule is configurable, show examples for different configurations.
32
+ 6. **Options (if applicable):**
33
+ - A TypeScript interface definition of the options object.
34
+ - Default values clearly marked.
35
+ - Examples for each option.
36
+ 7. **When Not To Use It:** specific scenarios where disabling this rule is acceptable.
37
+ 8. **Further Reading:** Links to MDN, TypeScript docs, or relevant specs.
38
+
39
+ </structure>
40
+
41
+ <style>
42
+
43
+ ## Style & Tone
44
+
45
+ - **Voice:** Professional, objective, and helpful. Avoid slang.
46
+ - **Clarity:** Use active voice. "This rule reports..." instead of "This rule is used to report...".
47
+ - **Code Blocks:**
48
+ - Always tag code blocks with `ts` or `tsx` (since this is a TypeScript plugin).
49
+ - Use `// eslint-disable-next-line` or specific comments in examples only if necessary to clarify context, but usually, just show the raw code that triggers the error.
50
+ - **Configuration:**
51
+ - Assume **Flat Config** (`eslint.config.mjs`) for all configuration examples.
52
+ - Do not use legacy `.eslintrc` JSON snippets.
53
+
54
+ </style>
55
+
56
+ <guidelines>
57
+
58
+ ## Writing Guidelines
59
+
60
+ - **The "Why":** Never just say "Don't do X." Explain the consequence.
61
+ - *Bad:* "Don't use `any`."
62
+ - *Good:* "Using `any` bypasses the TypeScript type checker, which can lead to runtime errors that strict typing would otherwise catch."
63
+ - **The "Fix":** If the rule is `fixable`, explicitly state what the auto-fixer does (e.g., "The auto-fixer will replace `var` with `let`.").
64
+ - **Type Information:** If the rule requires type information (`parserServices`), add a specific note at the top of the docs:
65
+ > ⚠️ This rule requires type information to run. It will not work without `projectService` (or equivalent typed parser setup) configured.
66
+ - **Preset awareness:** Repository presets such as `etc-misc.configs["recommended-type-checked"]`, `etc-misc.configs.strict`, and `etc-misc.configs.all` already wire the typed parser setup for you; do not imply that users must always configure it manually.
67
+ - **Consistency:** Ensure the examples actually trigger the rule. Do not use hypothetical examples that strictly wouldn't fail the specific AST selector of the rule.
68
+
69
+ </guidelines>
70
+
71
+ <examples>
72
+
73
+ ## Example Doc
74
+
75
+ ```markdown
76
+ # prefer-ts-extras-array-find-last-index
77
+
78
+ Prefer [`arrayFindLastIndex`](https://github.com/sindresorhus/ts-extras/blob/main/source/array-find-last-index.ts) from `ts-extras` over `array.findLastIndex(...)`.
79
+
80
+ `arrayFindLastIndex(...)` improves predicate inference in typed arrays.
81
+
82
+ ## Targeted pattern scope
83
+
84
+ This rule focuses on direct `array.findLastIndex(predicate)` calls that can be migrated to `arrayFindLastIndex(array, predicate)` with deterministic fixes.
85
+
86
+ - `array.findLastIndex(predicate)` call sites that can use `arrayFindLastIndex(array, predicate)`.
87
+
88
+ Alias indirection, wrapper helpers, and non-canonical call shapes are excluded to keep `arrayFindLastIndex(array, predicate)` migrations safe.
89
+
90
+ ## What this rule reports
91
+
92
+ This rule reports `array.findLastIndex(predicate)` call sites when `arrayFindLastIndex(array, predicate)` is the intended replacement.
93
+
94
+ - `array.findLastIndex(predicate)` call sites that can use `arrayFindLastIndex(array, predicate)`.
95
+
96
+ ## Why this rule exists
97
+
98
+ `arrayFindLastIndex` standardizes reverse index lookup and keeps call signatures aligned with other `ts-extras` search helpers.
99
+
100
+ - Reverse index scans are explicit at the call site.
101
+ - Search code avoids mixed native/helper patterns.
102
+ - Index-based follow-up logic stays uniform across modules.
103
+
104
+ ## ❌ Incorrect
105
+
106
+ ```ts
107
+ const index = monitors.findLastIndex((entry) => entry.id === targetId);
108
+ ```
109
+
110
+ ## ✅ Correct
111
+
112
+ ```ts
113
+ const index = arrayFindLastIndex(monitors, (entry) => entry.id === targetId);
114
+ ```
115
+
116
+ ## Behavior and migration notes
117
+
118
+ - Runtime behavior matches native `Array.prototype.findLastIndex`.
119
+ - Search still proceeds from right to left.
120
+ - If no element matches, the result is `-1`.
121
+
122
+ ## Additional examples
123
+
124
+ ### ❌ Incorrect — Additional example
125
+
126
+ ```ts
127
+ const index = logs.findLastIndex((entry) => entry.level === "warn");
128
+ ```
129
+
130
+ ### ✅ Correct — Additional example
131
+
132
+ ```ts
133
+ const index = arrayFindLastIndex(logs, (entry) => entry.level === "warn");
134
+ ```
135
+
136
+ ### ✅ Correct — Repository-wide usage
137
+
138
+ ```ts
139
+ const retryIndex = arrayFindLastIndex(attempts, (attempt) => !attempt.success);
140
+ ```
141
+
142
+ ## ESLint flat config example
143
+
144
+ ```ts
145
+ import etc-misc from "eslint-plugin-etc-misc";
146
+
147
+ export default [
148
+ {
149
+ plugins: { etc-misc },
150
+ rules: {
151
+ "etc-misc/prefer-ts-extras-array-find-last-index": "error",
152
+ },
153
+ },
154
+ ];
155
+ ```
156
+
157
+ ## When not to use it
158
+
159
+ Disable this rule if your codebase has standardized on native `.findLastIndex()`.
160
+
161
+ ## Package documentation
162
+
163
+ ts-extras package documentation:
164
+
165
+ `ts-extras@0.17.x` does not currently expose `arrayFindLastIndex` in its published API, so there is no canonical `source/*.ts` link for this helper yet.
166
+
167
+ Reference links:
168
+
169
+ - [`ts-extras` API list (README)](https://github.com/sindresorhus/ts-extras/blob/main/readme.md#api)
170
+ - [`ts-extras` source directory](https://github.com/sindresorhus/ts-extras/tree/main/source)
171
+
172
+ > **Rule catalog ID:** R005
173
+
174
+ ## Further reading
175
+
176
+ - [`ts-extras` README](https://github.com/sindresorhus/ts-extras)
177
+ - [`ts-extras` package reference](https://www.npmjs.com/package/ts-extras)
178
+ - [TypeScript Handbook: Narrowing](https://www.typescriptlang.org/docs/handbook/2/narrowing.html)
179
+
180
+ ## Adoption resources
181
+
182
+ - [Rule adoption checklist](https://nick2bad4u.github.io/eslint-plugin-etc-misc/docs/rules/guides/adoption-checklist)
183
+ - [Rollout and fix safety](https://nick2bad4u.github.io/eslint-plugin-etc-misc/docs/rules/guides/rollout-and-fix-safety)
184
+
185
+ </examples>
186
+ </instructions>
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: "Docusaurus-Typedoc-Folder-Guidelines"
3
+ description: "Guidance for the Docusaurus + TypeDoc documentation app under docs/docusaurus/."
4
+ applyTo: "docs/docusaurus/**"
5
+ ---
6
+
7
+ # Docusaurus + TypeDoc (docs/docusaurus/) Guidelines
8
+
9
+ - Treat `docs/docusaurus/` as a self-contained Docusaurus website project that serves as the documentation hub for the repository.
10
+ - Docusaurus configuration, theme, and pages live here.
11
+ - TypeDoc integration is configured via `docs/docusaurus/typedoc.config.json` and related TS configs (for example `tsconfig.typedoc.json`).
12
+ - TypeDoc generates to `docs/docusaurus/site-docs/developer/api`, while hand-authored documents and pages live in tracked locations such as `docs/docusaurus/src/pages`, `docs/docusaurus/site-docs/developer`, and `docs/rules`. Docusaurus connects the root docs to the site via configuration.
13
+ - Website and build setup:
14
+ - From the repository root, prefer the `docs:*` npm scripts (for example `npm run docs:start`, `npm run docs:build`, `npm run docs:api`) or the workspace scripts via `npm run --workspace docs/docusaurus <script>`.
15
+ - There are no root-level `docusaurus:*` scripts in this repo; use the `docs:*` root scripts unless you are intentionally running inside the docs workspace.
16
+ - Do not hand-edit generated TypeDoc output under `docs/docusaurus`; adjust source code or TypeDoc config instead.
17
+ - `docs/docusaurus/site-docs/developer/api/**` is generated by TypeDoc, cleaned on rebuild, and gitignored. Never place manual Markdown there.
18
+ - When you need a hand-authored explainer for generated API content, create it in a tracked docs location such as `docs/docusaurus/site-docs/developer/**`, then link to the generated API page with a normal Markdown link.
19
+ - If a Docusaurus build fails because a `developer/api/...` sidebar id no longer exists, regenerate the API docs with `npm run docs:api`, inspect the current generated ids, and update `docs/docusaurus/sidebars.ts`. Do not create placeholder docs under the generated API folder to satisfy stale sidebar entries.
20
+ - ESLint Config Inspector integration:
21
+ - The ESLint configuration inspector is built from the repository root via `npm run build:eslint-inspector`, which writes to `docs/docusaurus/static/eslint-inspector` with base path `/eslint-plugin-sdl-2/eslint-inspector/`.
22
+ - For local inspection, use `npm run build:eslint-inspector:local`.
23
+ - Do not modify the generated files in `static/eslint-inspector` by hand
24
+ - Configuration alignment:
25
+ - Keep Docusaurus `docusaurus.config.ts` and TypeScript configs (`tsconfig.typedoc.json`, etc.) in sync with root TS/Vite settings and path aliases.
26
+ - Content:
27
+ - Keep examples and snippets up to date with current code.
@@ -174,7 +174,7 @@ const createRuleItems = (ruleDocIds: readonly string[]): SidebarDocItem[] =>
174
174
  return ruleDocId;
175
175
  }
176
176
 
177
- return `${entry.catalogId} · ${entry.ruleName}`;
177
+ return entry.ruleName;
178
178
  })(),
179
179
  type: "doc",
180
180
  }));
@@ -23,7 +23,9 @@ formatting noise.
23
23
  ## ❌ Incorrect
24
24
 
25
25
  ```ts
26
- someCall(1);
26
+ someCall(
27
+
28
+ 1);
27
29
  ```
28
30
 
29
31
  ## ✅ Correct
@@ -2,6 +2,12 @@
2
2
 
3
3
  Disallow function declarations that appear after a `return` statement in the same block scope.
4
4
 
5
+ ## Why this rule is included here
6
+
7
+ This rule was integrated into `eslint-plugin-etc-misc` to avoid requiring a separate single-rule plugin dependency.
8
+
9
+ Original plugin source: [`eslint-plugin-no-function-declare-after-return`](https://github.com/bhumijgupta/eslint-plugin-no-function-declare-after-return).
10
+
5
11
  ## Rule details
6
12
 
7
13
  JavaScript hoists `function` declarations to the top of their enclosing scope,
@@ -2,6 +2,12 @@
2
2
 
3
3
  Disallow usage of non-native members on built-in JavaScript objects.
4
4
 
5
+ ## Why this rule is included here
6
+
7
+ This rule was integrated into `eslint-plugin-etc-misc` to avoid requiring a separate single-rule plugin dependency.
8
+
9
+ Original plugin source: [`eslint-plugin-no-use-extend-native`](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native).
10
+
5
11
  ## Rule details
6
12
 
7
13
  This rule helps prevent implicit reliance on monkey-patched native prototypes (for example from legacy libraries that add methods like `String.prototype.green`).
@@ -2,6 +2,12 @@
2
2
 
3
3
  Disallow regular expressions that are potentially vulnerable to ReDoS (Regular Expression Denial of Service).
4
4
 
5
+ ## Why this rule is included here
6
+
7
+ This rule was integrated into `eslint-plugin-etc-misc` to avoid requiring a separate single-rule plugin dependency.
8
+
9
+ Original plugin source: [`eslint-plugin-redos-detector`](https://github.com/tjenkinson/eslint-plugin-redos-detector).
10
+
5
11
  ## Rule details
6
12
 
7
13
  This rule analyzes regular expression literals and statically-resolvable `RegExp(...)` constructor calls using [`recheck`](https://www.npmjs.com/package/recheck).
@@ -70,6 +76,12 @@ type Options = [
70
76
  When `true` (default), analysis failures from `recheck` are ignored.
71
77
  When `false`, analysis failures are reported.
72
78
 
79
+ Analyzer failures include invalid regular expression syntax and backend startup
80
+ errors from the `recheck` runtime. On Windows, this rule normalizes the
81
+ temporary `RECHECK_JAR` and `RECHECK_BIN` values while invoking `recheck` so an
82
+ upstream path-separator bug cannot make Java execute `package.json` instead of
83
+ `recheck.jar`.
84
+
73
85
  ### `permittableComplexities`
74
86
 
75
87
  Allows selected vulnerable complexity classes to pass.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package.json",
3
3
  "name": "eslint-plugin-etc-misc",
4
- "version": "1.1.2",
4
+ "version": "1.1.4",
5
5
  "private": false,
6
6
  "description": "ESLint Plugin combining eslint-plugin-etc and eslint-plugin-misc!",
7
7
  "keywords": [