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

eslint-plugin-sort

Package Overview
Dependencies
Maintainers
0
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort - npm Package Compare versions

Comparing version 3.1.1 to 4.0.0

46

dist/index.js

@@ -150,3 +150,3 @@ // src/utils.ts

return true;
} catch (e) {
} catch {
resolveCache.set(source, false);

@@ -292,3 +292,5 @@ return false;

}
const sorted = nodes.slice().sort((nodeA, nodeB) => sorter(nodeA.local.name, nodeB.local.name));
const sorted = nodes.slice().sort(
(nodeA, nodeB) => sorter(getName(nodeA.local), getName(nodeB.local))
);
report(context, nodes, sorted);

@@ -330,3 +332,3 @@ }

AST_NODE_TYPES
} from "@typescript-eslint/experimental-utils";
} from "@typescript-eslint/utils";
function getName2(node) {

@@ -564,3 +566,3 @@ switch (node?.type) {

const sorted = nodes.slice().sort(
(nodeA, nodeB) => sorter(nodeA.imported.name, nodeB.imported.name)
(nodeA, nodeB) => sorter(getName(nodeA.imported), getName(nodeB.imported))
);

@@ -660,3 +662,3 @@ report(context, nodes, sorted);

ESLintUtils
} from "@typescript-eslint/experimental-utils";
} from "@typescript-eslint/utils";
function getWeight(node) {

@@ -684,8 +686,7 @@ const weights = {

create(context) {
const source = context.getSourceCode();
const options = context.options[0];
const sorter = getSorter(options);
function getRangeWithoutDelimiter(node) {
const range2 = getNodeRange2(source, node);
return isDelimiter(source.getLastToken(node)) ? [range2[0], range2[1] - 1] : range2;
const range2 = getNodeRange2(context.sourceCode, node);
return isDelimiter(context.sourceCode.getLastToken(node)) ? [range2[0], range2[1] - 1] : range2;
}

@@ -712,3 +713,3 @@ function sort(nodes) {

getRangeWithoutDelimiter(node),
getNodeText2(source, complement).replace(/[;,]$/, "")
getNodeText2(context.sourceCode, complement).replace(/[;,]$/, "")
);

@@ -731,3 +732,2 @@ }

docs: {
recommended: false,
url: docsURL("type-properties"),

@@ -763,6 +763,3 @@ description: `Sorts TypeScript type properties alphabetically and case insensitive in ascending order.`

// src/rules/string-unions.ts
import {
ESLintUtils as ESLintUtils2,
TSESTree as TSESTree3
} from "@typescript-eslint/experimental-utils";
import { ESLintUtils as ESLintUtils2, TSESTree as TSESTree3 } from "@typescript-eslint/utils";
function getSortValue4(node) {

@@ -773,3 +770,2 @@ return node.type === TSESTree3.AST_NODE_TYPES.TSLiteralType && node.literal.type === TSESTree3.AST_NODE_TYPES.Literal && typeof node.literal.value === "string" ? node.literal.value : null;

create(context) {
const source = context.getSourceCode();
const options = context.options[0];

@@ -792,3 +788,6 @@ const sorter = getSorter(options);

for (const [node2, complement] of enumerate(nodes, sorted)) {
yield fixer.replaceText(node2, getNodeText2(source, complement));
yield fixer.replaceText(
node2,
getNodeText2(context.sourceCode, complement)
);
}

@@ -803,3 +802,2 @@ }

docs: {
recommended: false,
url: docsURL("string-unions"),

@@ -835,6 +833,3 @@ description: `Sorts TypeScript string unions alphabetically and case insensitive in ascending order.`

// src/rules/string-enums.ts
import {
ESLintUtils as ESLintUtils3,
TSESTree as TSESTree4
} from "@typescript-eslint/experimental-utils";
import { ESLintUtils as ESLintUtils3, TSESTree as TSESTree4 } from "@typescript-eslint/utils";
function getSortValue5(node) {

@@ -845,3 +840,2 @@ return node.initializer?.type === TSESTree4.AST_NODE_TYPES.Literal && typeof node.initializer.value === "string" ? node.initializer.value : null;

create(context) {
const source = context.getSourceCode();
const options = context.options[0];

@@ -851,3 +845,3 @@ const sorter = getSorter(options);

TSEnumDeclaration(node) {
const nodes = node.members;
const nodes = node.body.members ?? node.members;
if (nodes.length < 2)

@@ -865,3 +859,6 @@ return;

for (const [node2, complement] of enumerate(nodes, sorted)) {
yield fixer.replaceText(node2, getNodeText2(source, complement));
yield fixer.replaceText(
node2,
getNodeText2(context.sourceCode, complement)
);
}

@@ -876,3 +873,2 @@ }

docs: {
recommended: false,
url: docsURL("string-enums"),

@@ -879,0 +875,0 @@ description: `Sorts TypeScript string enums alphabetically and case insensitive in ascending order.`

{
"name": "eslint-plugin-sort",
"description": "Auto-fixable sort rules for ESLint.",
"version": "3.1.1",
"version": "4.0.0",
"author": "Mark Skelton",

@@ -21,3 +21,3 @@ "repository": "github:mskelton/eslint-plugin-sort",

"format": "prettier --write .",
"lint": "eslint . --ext .ts",
"lint": "eslint .",
"test": "vitest",

@@ -42,6 +42,6 @@ "test:watch": "vitest --reporter=dot",

"peerDependencies": {
"eslint": ">=8"
"eslint": ">=8.56.0"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "^5.54.1",
"@typescript-eslint/utils": "^8.11.0",
"isomorphic-resolve": "^1.0.0",

@@ -51,21 +51,19 @@ "natural-compare": "^1.4.0"

"devDependencies": {
"@babel/core": "^7.21.0",
"@mskelton/semantic-release-config": "^1.0.1",
"@mskelton/tsconfig": "^2.0.0",
"@types/dedent": "^0.7.0",
"@types/eslint": "^8.21.1",
"@types/estree": "^1.0.0",
"@types/estree": "^1.0.6",
"@types/natural-compare": "^1.4.1",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"@typescript-eslint/rule-tester": "^8.11.0",
"bun-types": "^1.0.1",
"dedent": "^0.7.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"prettier": "^2.8.4",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.3",
"semantic-release": "^23.0.2",
"tsup": "^6.6.3",
"typescript": "^4.9.5",
"typescript": "^5.6.3",
"typescript-eslint": "^8.11.0",
"vitest": "^0.29.2"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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