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

eslint-plugin-sort

Package Overview
Dependencies
Maintainers
1
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 2.2.1 to 2.3.0

lib/rules/export-members.js

16

lib/index.js
"use strict";
var _destructuringProperties = _interopRequireDefault(require("./rules/destructuring-properties"));
var _exports = _interopRequireDefault(require("./rules/exports"));
var _exportMembers = _interopRequireDefault(require("./rules/export-members"));
var _imports = _interopRequireDefault(require("./rules/imports"));

@@ -7,4 +13,2 @@

var _destructuringProperties = _interopRequireDefault(require("./rules/destructuring-properties"));
var _objectProperties = _interopRequireDefault(require("./rules/object-properties"));

@@ -22,3 +26,4 @@

"sort/destructuring-properties": "warn",
"sort/import-members": "warn",
"sort/exports": "warn",
"sort/export-members": "warn",
"sort/imports": ["warn", {

@@ -39,2 +44,3 @@ groups: [{

}],
"sort/import-members": "warn",
"sort/object-properties": "warn"

@@ -46,4 +52,6 @@ }

"destructuring-properties": _destructuringProperties.default,
"exports": _exports.default,
"export-members": _exportMembers.default,
"imports": _imports.default,
"import-members": _importMembers.default,
"imports": _imports.default,
"object-properties": _objectProperties.default,

@@ -50,0 +58,0 @@ "type-properties": _typeProperties.default

@@ -14,3 +14,3 @@ "use strict";

ObjectPattern(pattern) {
const nodes = (0, _utils.filterNodes)(pattern.properties, "Property"); // If there are one or fewer properties, there is nothing to sort
const nodes = (0, _utils.filterNodes)(pattern.properties, ["Property"]); // If there are one or fewer properties, there is nothing to sort

@@ -17,0 +17,0 @@ if (nodes.length < 2) {

@@ -14,3 +14,3 @@ "use strict";

ImportDeclaration(decl) {
const nodes = (0, _utils.filterNodes)(decl.specifiers, "ImportSpecifier"); // If there are one or fewer properties, there is nothing to sort
const nodes = (0, _utils.filterNodes)(decl.specifiers, ["ImportSpecifier"]); // If there are one or fewer properties, there is nothing to sort

@@ -17,0 +17,0 @@ if (nodes.length < 2) {

@@ -51,5 +51,6 @@ "use strict";

const groups = context.options[0]?.groups ?? [];
const source = context.getSourceCode();
return {
Program(program) {
const nodes = (0, _utils.filterNodes)(program.body, "ImportDeclaration"); // If there are one or fewer imports, there is nothing to sort
const nodes = (0, _utils.filterNodes)(program.body, ["ImportDeclaration"]); // If there are one or fewer imports, there is nothing to sort

@@ -65,6 +66,5 @@ if (nodes.length < 2) {

if ((0, _utils.isUnsorted)(nodes, sorted)) {
const source = context.getSourceCode(); // When sorting, the comments for the first node are not copied as
// When sorting, the comments for the first node are not copied as
// we cannot determine if they are comments for the entire file or
// just the first import.
const isFirst = node => node === nodes[0];

@@ -71,0 +71,0 @@

@@ -59,3 +59,3 @@ "use strict";

const filterNodes = (nodes, type) => nodes.filter(node => node.type === type);
const filterNodes = (nodes, types) => nodes.filter(node => types.includes(node.type));
/**

@@ -62,0 +62,0 @@ * Function that returns a simple alphanumeric sort function. The return value

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

@@ -6,0 +6,0 @@ "packageManager": "yarn@3.1.1",

@@ -43,5 +43,7 @@ # eslint-plugin-sort

| ✔ | 🔧 | [sort/destructuring-properties](docs/rules/destructuring-properties.md) | Sorts object destructuring properties |
| ✔ | 🔧 | [sort/exports](docs/rules/exports.md) | Sorts exports |
| ✔ | 🔧 | [sort/export-members](docs/rules/export-members.md) | Sorts export members |
| ✔ | 🔧 | [sort/imports](docs/rules/imports.md) | Sorts imports |
| ✔ | 🔧 | [sort/import-members](docs/rules/import-members.md) | Sorts import members |
| ✔ | 🔧 | [sort/imports](docs/rules/imports.md) | Sorts imports |
| ✔ | 🔧 | [sort/object-properties](docs/rules/object-properties.md) | Sorts object properties |
| | 🔧 | [sort/type-properties](docs/rules/type-properties.md) | Sorts TypeScript type properties |
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