Skip to content

Commit 8e3c290

Browse files
authored
fix: type errors (#427)
1 parent 76fc219 commit 8e3c290

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+199
-57
lines changed

lib/rules/callback-return.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"use strict"
66
const { getSourceCode } = require("../util/eslint-compat")
77

8-
/** @type {import('eslint').Rule.RuleModule} */
8+
/**
9+
* @typedef {[string[]?]} RuleOptions
10+
*/
11+
/** @type {import('./rule-module').RuleModule<{RuleOptions: RuleOptions}>} */
912
module.exports = {
1013
meta: {
1114
type: "suggestion",

lib/rules/exports-style.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,13 @@ function fixModuleExports(node, sourceCode, fixer) {
267267
return fixer.replaceText(node.parent, statements.join("\n\n"))
268268
}
269269

270-
/** @type {import('eslint').Rule.RuleModule} */
270+
/**
271+
* @typedef {[
272+
* ("module.exports" | "exports")?,
273+
* {allowBatchAssign?: boolean}?
274+
* ]} RuleOptions
275+
*/
276+
/** @type {import('./rule-module').RuleModule<{RuleOptions: RuleOptions}>} */
271277
module.exports = {
272278
meta: {
273279
docs: {

lib/rules/file-extension-in-import.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ function getExistingExtensions(filePath) {
2929
}
3030
}
3131

32-
/** @type {import('eslint').Rule.RuleModule} */
32+
/**
33+
* @typedef {[
34+
* ("always" | "never")?,
35+
* {[ext in string]?: "always" | "never"}?
36+
* ]} RuleOptions
37+
*/
38+
/** @type {import('./rule-module').RuleModule<{RuleOptions: RuleOptions}>} */
3339
module.exports = {
3440
meta: {
3541
docs: {

lib/rules/global-require.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function isShadowed(scope, node) {
4343
return Boolean(reference?.resolved?.defs?.length)
4444
}
4545

46-
/** @type {import('eslint').Rule.RuleModule} */
46+
/** @type {import('./rule-module').RuleModule} */
4747
module.exports = {
4848
meta: {
4949
type: "suggestion",

lib/rules/handle-callback-err.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
const { getScope } = require("../util/eslint-compat")
88

9-
/** @type {import('eslint').Rule.RuleModule} */
9+
/**
10+
* @typedef {[string?]} RuleOptions
11+
*/
12+
/** @type {import('./rule-module').RuleModule<{RuleOptions: RuleOptions}>} */
1013
module.exports = {
1114
meta: {
1215
type: "suggestion",

lib/rules/hashbang.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ function getShebangInfo(sourceCode) {
7878
}
7979
}
8080

81-
/** @type {import('eslint').Rule.RuleModule} */
81+
/**
82+
* @typedef {[
83+
* {
84+
* convertPath?: import('../util/get-convert-path').ConvertPath;
85+
* ignoreUnpublished?: boolean;
86+
* additionalExecutables?: string[];
87+
* executableMap?: Record<string, string>;
88+
* }?
89+
* ]} RuleOptions
90+
*/
91+
/** @type {import('./rule-module').RuleModule<{RuleOptions: RuleOptions}>} */
8292
module.exports = {
8393
meta: {
8494
docs: {
@@ -146,7 +156,7 @@ module.exports = {
146156
convertedRelativePath
147157
)
148158

149-
/** @type {{ additionalExecutables: string[] }} */
159+
/** @type {{ additionalExecutables?: string[] }} */
150160
const { additionalExecutables = [] } = context.options?.[0] ?? {}
151161

152162
const executable = matcher()

lib/rules/no-callback-literal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
const callbackNames = ["callback", "cb"]
88

9-
/** @type {import('eslint').Rule.RuleModule} */
9+
/** @type {import('./rule-module').RuleModule} */
1010
module.exports = {
1111
meta: {
1212
docs: {

lib/rules/no-deprecated-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ function parseOptions(context) {
749749
return Object.freeze({ version, ignoredGlobalItems, ignoredModuleItems })
750750
}
751751

752-
/** @type {import('eslint').Rule.RuleModule} */
752+
/** @type {import('./rule-module').RuleModule} */
753753
module.exports = {
754754
meta: {
755755
docs: {

lib/rules/no-exports-assign.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function isModuleExports(node, scope) {
4545
)
4646
}
4747

48-
/** @type {import('eslint').Rule.RuleModule} */
48+
/** @type {import('./rule-module').RuleModule} */
4949
module.exports = {
5050
meta: {
5151
docs: {

lib/rules/no-extraneous-import.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const getResolvePaths = require("../util/get-resolve-paths")
1111
const getResolverConfig = require("../util/get-resolver-config")
1212
const visitImport = require("../util/visit-import")
1313

14-
/** @type {import('eslint').Rule.RuleModule} */
14+
/** @type {import('./rule-module').RuleModule} */
1515
module.exports = {
1616
meta: {
1717
docs: {

0 commit comments

Comments
 (0)