eslint-plugin-isaacscript
Advanced tools
Comparing version 3.8.0 to 3.9.0
@@ -43,4 +43,7 @@ "use strict"; | ||
"isaacscript/require-variadic-function-argument": "error", | ||
"isaacscript/strict-array-methods": "error", | ||
"isaacscript/strict-enums": "error", | ||
"isaacscript/strict-undefined-functions": "error", | ||
"isaacscript/strict-void-functions": "error", | ||
}, | ||
}; |
@@ -42,3 +42,6 @@ "use strict"; | ||
const require_variadic_function_argument_1 = require("./rules/require-variadic-function-argument"); | ||
const strict_array_methods_1 = require("./rules/strict-array-methods"); | ||
const strict_enums_1 = require("./rules/strict-enums"); | ||
const strict_undefined_functions_1 = require("./rules/strict-undefined-functions"); | ||
const strict_void_functions_1 = require("./rules/strict-void-functions"); | ||
exports.rules = { | ||
@@ -80,3 +83,6 @@ "complete-sentences-jsdoc": complete_sentences_jsdoc_1.completeSentencesJSDoc, | ||
"require-variadic-function-argument": require_variadic_function_argument_1.requireVariadicFunctionArgument, | ||
"strict-array-methods": strict_array_methods_1.strictArrayMethods, | ||
"strict-enums": strict_enums_1.strictEnums, | ||
"strict-undefined-functions": strict_undefined_functions_1.strictUndefinedFunctions, | ||
"strict-void-functions": strict_void_functions_1.strictVoidFunctions, | ||
}; |
@@ -15,3 +15,3 @@ "use strict"; | ||
docs: { | ||
description: "Enforces complete sentences for multi-line leading line comments", | ||
description: "Requires complete sentences for multi-line leading line comments", | ||
recommended: "recommended", | ||
@@ -18,0 +18,0 @@ }, |
@@ -47,2 +47,3 @@ "use strict"; | ||
(currentCodePath !== null && | ||
// eslint-disable-next-line deprecation/deprecation | ||
currentCodePath.currentSegments.some(utils_1.isReachable))) { | ||
@@ -49,0 +50,0 @@ isFallthrough = true; |
@@ -42,3 +42,5 @@ "use strict"; | ||
*/ | ||
const thisNodeIsReachable = currentCodePath.currentSegments.some(utils_1.isReachable); | ||
const thisNodeIsReachable = | ||
// eslint-disable-next-line deprecation/deprecation | ||
currentCodePath.currentSegments.some(utils_1.isReachable); | ||
const thisNodeIsFinalCase = node.parent.type === types_1.AST_NODE_TYPES.SwitchStatement && | ||
@@ -45,0 +47,0 @@ node === node.parent.cases.at(-1); |
@@ -23,3 +23,14 @@ "use strict"; | ||
} | ||
return type.aliasSymbol?.getName(); | ||
const aliasSymbolName = type.aliasSymbol?.getName(); | ||
if (aliasSymbolName !== undefined) { | ||
return aliasSymbolName; | ||
} | ||
// The above checks do not work with boolean values. | ||
if ("intrinsicName" in type) { | ||
const { intrinsicName } = type; | ||
if (typeof intrinsicName === "string" && intrinsicName !== "") { | ||
return intrinsicName; | ||
} | ||
} | ||
return undefined; | ||
} | ||
@@ -26,0 +37,0 @@ exports.getTypeName = getTypeName; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isReachable = exports.hasURL = exports.getOrdinalSuffix = exports.createRule = exports.areStringsEqualExcludingTrailingSpaces = void 0; | ||
exports.isReachable = exports.hasURL = exports.getParentFunction = exports.getOrdinalSuffix = exports.createRule = exports.areStringsEqualExcludingTrailingSpaces = void 0; | ||
const utils_1 = require("@typescript-eslint/utils"); | ||
@@ -46,2 +46,13 @@ /** Taken from ESLint: https://github.com/eslint/eslint/blob/main/lib/rules/max-len.js */ | ||
exports.getOrdinalSuffix = getOrdinalSuffix; | ||
function getParentFunction(node) { | ||
let parent = node; | ||
while (parent !== undefined) { | ||
parent = parent.parent; // eslint-disable-line @typescript-eslint/prefer-destructuring | ||
if (utils_1.ASTUtils.isFunction(parent)) { | ||
return parent; | ||
} | ||
} | ||
return undefined; | ||
} | ||
exports.getParentFunction = getParentFunction; | ||
function hasURL(text) { | ||
@@ -48,0 +59,0 @@ return URL_REGEXP.test(text); |
{ | ||
"name": "eslint-plugin-isaacscript", | ||
"version": "3.8.0", | ||
"version": "3.9.0", | ||
"description": "An ESLint plugin that contains useful rules.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -43,3 +43,3 @@ # eslint-plugin-isaacscript | ||
| [`isaacscript/complete-sentences-jsdoc`](docs/rules/complete-sentences-jsdoc.md) | Requires complete sentences for JSDoc comments | :white_check_mark: | | | | ||
| [`isaacscript/complete-sentences-line-comments`](docs/rules/complete-sentences-line-comments.md) | Enforces complete sentences for multi-line leading line comments | :white_check_mark: | | | | ||
| [`isaacscript/complete-sentences-line-comments`](docs/rules/complete-sentences-line-comments.md) | Requires complete sentences for multi-line leading line comments | :white_check_mark: | | | | ||
| [`isaacscript/consistent-enum-values`](docs/rules/consistent-enum-values.md) | Requires consistent enum values | :white_check_mark: | | | | ||
@@ -78,3 +78,6 @@ | [`isaacscript/enum-member-number-separation`](docs/rules/enum-member-number-separation.md) | Disallows numbers next to letters in enum members | | | | | ||
| [`isaacscript/require-variadic-function-argument`](docs/rules/require-variadic-function-argument.md) | Requires that variadic functions must be supplied with at least one argument | :white_check_mark: | | :thought_balloon: | | ||
| [`isaacscript/strict-array-methods`](docs/rules/strict-array-methods.md) | Requires boolean return types on array method functions | :white_check_mark: | | :thought_balloon: | | ||
| [`isaacscript/strict-enums`](docs/rules/strict-enums.md) | Disallows the usage of unsafe enum patterns | :white_check_mark: | | :thought_balloon: | | ||
| [`isaacscript/strict-undefined-functions`](docs/rules/strict-undefined-functions.md) | Disallows empty return statements in functions annotated as returning undefined | :white_check_mark: | | :thought_balloon: | | ||
| [`isaacscript/strict-void-functions`](docs/rules/strict-void-functions.md) | Disallows non-empty return statements in functions annotated as returning void | :white_check_mark: | | | | ||
@@ -81,0 +84,0 @@ <!-- /RULES_TABLE --> |
200923
57
4391
138