🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

@typescript-eslint/eslint-plugin

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typescript-eslint/eslint-plugin - npm Package Compare versions

Comparing version

to
8.31.2-alpha.6

@@ -40,2 +40,3 @@ "use strict";

const util_1 = require("../util");
const getWrappedCode_1 = require("../util/getWrappedCode");
const isMemberAccessLike = (0, util_1.isNodeOfTypes)([

@@ -358,3 +359,4 @@ utils_1.AST_NODE_TYPES.ChainExpression,

}
const nullishCoalescingParams = getNullishCoalescingParams(node, getBranchNodes(node, operator).nonNullishBranch, nodesInsideTestExpression, operator);
const { nonNullishBranch, nullishBranch } = getBranchNodes(node, operator);
const nullishCoalescingParams = getNullishCoalescingParams(node, nonNullishBranch, nodesInsideTestExpression, operator);
if (nullishCoalescingParams.isFixable) {

@@ -371,3 +373,7 @@ context.report({

fix(fixer) {
return fixer.replaceText(node, `${(0, util_1.getTextWithParentheses)(context.sourceCode, nullishCoalescingParams.nullishCoalescingLeftNode)} ?? ${(0, util_1.getTextWithParentheses)(context.sourceCode, getBranchNodes(node, operator).nullishBranch)}`);
const nullishBranchText = (0, util_1.getTextWithParentheses)(context.sourceCode, nullishBranch);
const rightOperandReplacement = (0, util_1.isParenthesized)(nullishBranch, context.sourceCode)
? nullishBranchText
: (0, getWrappedCode_1.getWrappedCode)(nullishBranchText, (0, util_1.getOperatorPrecedenceForNode)(nullishBranch), util_1.OperatorPrecedence.Coalesce);
return fixer.replaceText(node, `${(0, util_1.getTextWithParentheses)(context.sourceCode, nullishCoalescingParams.nullishCoalescingLeftNode)} ?? ${rightOperandReplacement}`);
},

@@ -374,0 +380,0 @@ },

{
"name": "@typescript-eslint/eslint-plugin",
"version": "8.31.2-alpha.5",
"version": "8.31.2-alpha.6",
"description": "TypeScript plugin for ESLint",

@@ -65,6 +65,6 @@ "files": [

"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.31.2-alpha.5",
"@typescript-eslint/type-utils": "8.31.2-alpha.5",
"@typescript-eslint/utils": "8.31.2-alpha.5",
"@typescript-eslint/visitor-keys": "8.31.2-alpha.5",
"@typescript-eslint/scope-manager": "8.31.2-alpha.6",
"@typescript-eslint/type-utils": "8.31.2-alpha.6",
"@typescript-eslint/utils": "8.31.2-alpha.6",
"@typescript-eslint/visitor-keys": "8.31.2-alpha.6",
"graphemer": "^1.4.0",

@@ -79,4 +79,4 @@ "ignore": "^5.3.1",

"@types/natural-compare": "*",
"@typescript-eslint/rule-schema-to-typescript-types": "8.31.2-alpha.5",
"@typescript-eslint/rule-tester": "8.31.2-alpha.5",
"@typescript-eslint/rule-schema-to-typescript-types": "8.31.2-alpha.6",
"@typescript-eslint/rule-tester": "8.31.2-alpha.6",
"@vitest/coverage-v8": "^3.1.1",

@@ -83,0 +83,0 @@ "ajv": "^6.12.6",

Sorry, the diff of this file is not supported yet