New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-react-web-api

Package Overview
Dependencies
Maintainers
0
Versions
709
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-react-web-api - npm Package Compare versions

Comparing version

to
1.12.2-next.2

47

dist/index.js

@@ -16,3 +16,3 @@ 'use strict';

var name = "eslint-plugin-react-web-api";
var version = "1.12.2-next.1";
var version = "1.12.2-next.2";
var createRule = shared.createRuleForPlugin("web-api");

@@ -42,2 +42,3 @@ function getTimerID(node, prev) {

}
var EventListenerEntry = tools.Data.taggedEnum();

@@ -157,3 +158,20 @@ // src/rules/no-leaked-event-listener.ts

switch (callKind) {
case "addEventListener":
case "addEventListener": {
tools.O.map(checkInlineFunction(node, callKind), context.report);
const [type, listener, options] = node.arguments;
const [fNode, fKind] = fStack.at(-1) ?? [];
if (!type || !listener || !fNode || !fKind) return;
if (!core.PHASE_RELEVANCE.has(fKind)) break;
const opts = options ? getOptions(options, context.sourceCode.getScope(options)) : defaultOptions;
const callee = node.callee;
aEntries.push(EventListenerEntry.addEventListener({
...opts,
type,
node,
callee,
listener,
phase: fKind
}));
break;
}
case "removeEventListener": {

@@ -164,8 +182,13 @@ tools.O.map(checkInlineFunction(node, callKind), context.report);

if (!type || !listener || !fNode || !fKind) return;
if (core.PHASE_RELEVANCE.has(fKind)) {
const opts = options ? getOptions(options, context.sourceCode.getScope(options)) : defaultOptions;
const callee = node.callee;
const listeners = callKind === "addEventListener" ? aEntries : rEntries;
listeners.push({ ...opts, kind: callKind, type, node, callee, listener, phase: fKind });
}
if (!core.PHASE_RELEVANCE.has(fKind)) break;
const opts = options ? getOptions(options, context.sourceCode.getScope(options)) : defaultOptions;
const callee = node.callee;
rEntries.push(EventListenerEntry.removeEventListener({
...opts,
type,
node,
callee,
listener,
phase: fKind
}));
break;

@@ -260,3 +283,3 @@ }

sEntries.push({
kind: callKind,
kind: "interval",
node,

@@ -276,3 +299,3 @@ callee: node.callee,

cEntries.push({
kind: callKind,
kind: "interval",
node,

@@ -375,3 +398,3 @@ callee: node.callee,

sEntries.push({
kind: callKind,
kind: "timeout",
node,

@@ -391,3 +414,3 @@ callee: node.callee,

rEntries.push({
kind: callKind,
kind: "timeout",
node,

@@ -394,0 +417,0 @@ callee: node.callee,

{
"name": "eslint-plugin-react-web-api",
"version": "1.12.2-next.1",
"version": "1.12.2-next.2",
"description": "ESLint React's ESLint plugin for interacting with Web APIs",

@@ -50,9 +50,9 @@ "keywords": [

"ts-pattern": "^5.3.1",
"@eslint-react/ast": "1.12.2-next.1",
"@eslint-react/jsx": "1.12.2-next.1",
"@eslint-react/shared": "1.12.2-next.1",
"@eslint-react/core": "1.12.2-next.1",
"@eslint-react/types": "1.12.2-next.1",
"@eslint-react/tools": "1.12.2-next.1",
"@eslint-react/var": "1.12.2-next.1"
"@eslint-react/ast": "1.12.2-next.2",
"@eslint-react/jsx": "1.12.2-next.2",
"@eslint-react/core": "1.12.2-next.2",
"@eslint-react/shared": "1.12.2-next.2",
"@eslint-react/tools": "1.12.2-next.2",
"@eslint-react/var": "1.12.2-next.2",
"@eslint-react/types": "1.12.2-next.2"
},

@@ -59,0 +59,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet