Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stylistic/eslint-plugin-jsx

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stylistic/eslint-plugin-jsx - npm Package Compare versions

Comparing version 2.9.0 to 2.10.0

27

dist/rules/jsx-closing-bracket-location.js

@@ -189,22 +189,17 @@ 'use strict';

}
function getOpeningElementId(node) {
return node.range.join(":");
}
const lastAttributeNode = {};
return {
JSXAttribute(node) {
lastAttributeNode[getOpeningElementId(node.parent)] = node;
},
JSXSpreadAttribute(node) {
lastAttributeNode[getOpeningElementId(node.parent)] = node;
},
"JSXOpeningElement:exit": function(node) {
const attributeNode = lastAttributeNode[getOpeningElementId(node)];
const cachedLastAttributeEndPos = attributeNode ? attributeNode.range[1] : null;
const lastAttributeNode = node.attributes.at(-1);
const cachedLastAttributeEndPos = lastAttributeNode ? lastAttributeNode.range[1] : null;
let expectedNextLine;
const tokens = getTokensLocations(node);
const expectedLocation = getExpectedLocation(tokens);
let expectedLocation = getExpectedLocation(tokens);
let usingSameIndentation = true;
if (expectedLocation === "tag-aligned")
usingSameIndentation = tokens.isTab.openTab === tokens.isTab.closeTab;
const lastComment = context.sourceCode.getCommentsInside(node).at(-1);
const hasTrailingComment = lastComment && lastComment.range[0] > (lastAttributeNode ?? node.name).range[1];
if ((expectedLocation === "after-props" || expectedLocation === "after-tag") && !(hasCorrectLocation(tokens, expectedLocation) && usingSameIndentation) && hasTrailingComment) {
expectedLocation = "line-aligned";
}
if (hasCorrectLocation(tokens, expectedLocation) && usingSameIndentation)

@@ -237,5 +232,7 @@ return;

case "tag-aligned":
case "line-aligned":
return fixer.replaceTextRange([cachedLastAttributeEndPos, node.range[1]], `
case "line-aligned": {
const rangeStart = hasTrailingComment ? lastComment.range[1] : cachedLastAttributeEndPos;
return fixer.replaceTextRange([rangeStart, node.range[1]], `
${getIndentation(tokens, expectedLocation, correctColumn)}${closingTag}`);
}
}

@@ -242,0 +239,0 @@ return null;

{
"name": "@stylistic/eslint-plugin-jsx",
"type": "commonjs",
"version": "2.9.0",
"version": "2.10.0",
"author": "Anthony Fu <anthonyfu117@hotmail.com>",

@@ -61,4 +61,4 @@ "license": "MIT",

"dependencies": {
"eslint-visitor-keys": "^4.1.0",
"espree": "^10.2.0",
"eslint-visitor-keys": "^4.2.0",
"espree": "^10.3.0",
"estraverse": "^5.3.0",

@@ -65,0 +65,0 @@ "picomatch": "^4.0.2"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc