eslint-plugin-neverthrow
Advanced tools
Comparing version 1.1.1 to 1.1.2
"use strict"; | ||
const tsutils_1 = require("tsutils"); | ||
const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); | ||
const utils_1 = require("../utils"); | ||
@@ -9,5 +8,5 @@ function matchAny(nodeTypes) { | ||
const resultSelector = matchAny([ | ||
// AST_NODE_TYPES.Identifier, | ||
experimental_utils_1.AST_NODE_TYPES.CallExpression, | ||
experimental_utils_1.AST_NODE_TYPES.NewExpression, | ||
// 'Identifier', | ||
'CallExpression', | ||
'NewExpression', | ||
]); | ||
@@ -47,3 +46,3 @@ const resultProperties = [ | ||
return null; | ||
if (node.property.type !== experimental_utils_1.AST_NODE_TYPES.Identifier) | ||
if (node.property.type !== 'Identifier') | ||
return null; | ||
@@ -54,3 +53,3 @@ return node.property.name; | ||
var _a; | ||
if (((_a = node === null || node === void 0 ? void 0 : node.parent) === null || _a === void 0 ? void 0 : _a.type) !== experimental_utils_1.AST_NODE_TYPES.CallExpression) | ||
if (((_a = node === null || node === void 0 ? void 0 : node.parent) === null || _a === void 0 ? void 0 : _a.type) !== 'CallExpression') | ||
return false; | ||
@@ -62,3 +61,3 @@ return node.parent.callee === node; | ||
const memberExpresion = node.parent; | ||
if ((memberExpresion === null || memberExpresion === void 0 ? void 0 : memberExpresion.type) === experimental_utils_1.AST_NODE_TYPES.MemberExpression) { | ||
if ((memberExpresion === null || memberExpresion === void 0 ? void 0 : memberExpresion.type) === 'MemberExpression') { | ||
const methodName = findMemberName(memberExpresion); | ||
@@ -70,3 +69,3 @@ const methodIsCalled = isMemberCalledFn(memberExpresion); | ||
const parent = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent; // search for chain method .map().handler | ||
if (parent && (parent === null || parent === void 0 ? void 0 : parent.type) !== experimental_utils_1.AST_NODE_TYPES.ExpressionStatement) { | ||
if (parent && (parent === null || parent === void 0 ? void 0 : parent.type) !== 'ExpressionStatement') { | ||
return isHandledResult(parent); | ||
@@ -77,7 +76,7 @@ } | ||
} | ||
const endTransverse = [experimental_utils_1.AST_NODE_TYPES.BlockStatement, experimental_utils_1.AST_NODE_TYPES.Program]; | ||
const endTransverse = ['BlockStatement', 'Program']; | ||
function getAssignation(checker, parserServices, node) { | ||
if (node.type === experimental_utils_1.AST_NODE_TYPES.VariableDeclarator && | ||
if (node.type === 'VariableDeclarator' && | ||
isResultLike(checker, parserServices, node.init) && | ||
node.id.type === experimental_utils_1.AST_NODE_TYPES.Identifier) { | ||
node.id.type === 'Identifier') { | ||
return node.id; | ||
@@ -91,9 +90,9 @@ } | ||
function isReturned(checker, parserServices, node) { | ||
if (node.type === experimental_utils_1.AST_NODE_TYPES.ReturnStatement) { | ||
if (node.type === 'ReturnStatement') { | ||
return true; | ||
} | ||
if (node.type === experimental_utils_1.AST_NODE_TYPES.BlockStatement) { | ||
if (node.type === 'BlockStatement') { | ||
return false; | ||
} | ||
if (node.type === experimental_utils_1.AST_NODE_TYPES.Program) { | ||
if (node.type === 'Program') { | ||
return false; | ||
@@ -107,6 +106,6 @@ } | ||
const ignoreParents = [ | ||
experimental_utils_1.AST_NODE_TYPES.ClassDeclaration, | ||
experimental_utils_1.AST_NODE_TYPES.FunctionDeclaration, | ||
experimental_utils_1.AST_NODE_TYPES.MethodDefinition, | ||
experimental_utils_1.AST_NODE_TYPES.ClassProperty, | ||
'ClassDeclaration', | ||
'FunctionDeclaration', | ||
'MethodDefinition', | ||
'ClassProperty', | ||
]; | ||
@@ -151,4 +150,4 @@ function processSelector(context, checker, parserServices, node, reportAs = node) { | ||
description: 'Not handling neverthrow result is a possible error because errors could remain unhandleds.', | ||
recommended: 'error', | ||
category: 'Possible Errors', | ||
recommended: 'error', | ||
url: '', | ||
@@ -155,0 +154,0 @@ }, |
{ | ||
"name": "eslint-plugin-neverthrow", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "", | ||
@@ -38,3 +38,2 @@ "engines": { | ||
"@types/eslint-utils": "^3.0.0", | ||
"@typescript-eslint/experimental-utils": "^4.20.0", | ||
"eslint-utils": "3.0.0", | ||
@@ -44,2 +43,3 @@ "tsutils": "3.21.0" | ||
"devDependencies": { | ||
"@typescript-eslint/experimental-utils": "^4.0.0", | ||
"@types/eslint": "^7.2.8", | ||
@@ -46,0 +46,0 @@ "@typescript-eslint/eslint-plugin": "^4.20.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5
18096
17
341
- Removed@typescript-eslint/experimental-utils@4.33.0(transitive)
- Removed@typescript-eslint/scope-manager@4.33.0(transitive)
- Removed@typescript-eslint/types@4.33.0(transitive)
- Removed@typescript-eslint/typescript-estree@4.33.0(transitive)
- Removed@typescript-eslint/visitor-keys@4.33.0(transitive)
- Removedarray-union@2.1.0(transitive)
- Removeddir-glob@3.0.1(transitive)
- Removedeslint-scope@5.1.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedglobby@11.1.0(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedslash@3.0.0(transitive)