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

eslint-plugin-sort-export-all

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort-export-all - npm Package Compare versions

Comparing version

to
1.0.5

9

lib/rules/sort-export-all.js

@@ -86,11 +86,8 @@ "use strict";

if (isValidOrder(thisName, prevName)) {
context.report(Object.assign(Object.assign({ message: "Expected export * order to be in {{natural}}{{insensitive}}{{order}}. '{{thisName}}' should be before '{{prevName}}'.", node }, (node.loc === null ? null : { loc: node.loc })), { data: {
context.report(Object.assign(Object.assign({ message: "\"export * from '{{thisName}}'\" should occur before \"export * from '{{prevName}}'\".", node }, (node.loc === null ? null : { loc: node.loc })), { data: {
thisName,
prevName,
order,
insensitive: insensitive ? "insensitive " : "",
natural: natural ? "natural " : "",
}, fix(fixer) {
if (prevNode == null)
return [];
return null;
const fixes = [];

@@ -104,3 +101,3 @@ const sourceCode = context.getSourceCode();

// @ts-ignore
sourceCode.getText(thisComment) + "\n"));
`${sourceCode.getText(thisComment)}\n`));
// @ts-ignore

@@ -107,0 +104,0 @@ fixes.push(fixer.remove(thisComment));

{
"name": "eslint-plugin-sort-export-all",
"version": "1.0.4",
"version": "1.0.5",
"description": "ESLint rule that helps sort export *",

@@ -14,2 +14,4 @@ "repository": {

"test": "jest",
"prettier": "prettier --write \"**/*.{ts,js,json}\"",
"lint": "eslint --fix \"src/**/*.{ts,js,json}\"",
"prepublish": "npm run clean && npm run build"

@@ -33,5 +35,10 @@ },

"@types/node": "^14.0.19",
"@typescript-eslint/eslint-plugin": "^3.6.0",
"@typescript-eslint/parser": "^3.6.0",
"concurrently": "^5.2.0",
"eslint": "^7.4.0",
"eslint": "7.2.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-typescript": "^3.0.0",
"eslint-plugin-import": "2.21.2",
"jest": "^26.1.0",

@@ -38,0 +45,0 @@ "prettier": "^2.0.5",

@@ -5,2 +5,4 @@ # eslint-plugin-sort-export-all

![Example](./example.gif)
## Installation

@@ -11,2 +13,3 @@

```
$ yarn add eslint --dev
$ npm i eslint --save-dev

@@ -18,2 +21,3 @@ ```

```
$ yarn add eslint-plugin-sort-export-all --dev
$ npm install eslint-plugin-sort-export-all --save-dev

@@ -34,3 +38,3 @@ ```

Then add sort-export-all rule under the rules section.
Then add `sort-export-all` rule under the rules section.

@@ -49,10 +53,11 @@ ```json

{
"plugins": ["sort-export-all"],
"rules": {
// ...
"sort-export-all/sort-export-all": "off"
},
"overrides": [
{
"files": ["src/alphabetical.js", "bin/*.js", "lib/*.js"],
"files": ["src/**/index.{ts,js}"],
"rules": {
"sort-export-all/sort-export-all": "warn"
"sort-export-all/sort-export-all": "error
}

@@ -66,2 +71,33 @@ }

For available config options, see [official sort-keys reference](https://eslint.org/docs/rules/sort-keys#require-object-keys-to-be-sorted-sort-keys). All options supported by `sort-keys`, besides `minKeys`, are supported by `sort-export-all`.
- The 1st option is `"asc"` or `"desc"`.
`"asc"` (default) - enforce properties to be in ascending order.
`"desc"` - enforce properties to be in descending order.
- The 2nd option is an object which has 3 properties.
`caseSensitive` - if `true`, enforce properties to be in case-sensitive order. Default is `true`.
`natural` - if `true`, enforce properties to be in natural order. Default is false. Natural Order compares strings containing combination of letters and numbers in the way a human being would sort. It basically sorts numerically, instead of sorting alphabetically. So the number 10 comes after the number `3` in Natural Sorting.
```
Standard sorting: Natural order sorting:
img1.png img1.png
img10.png img2.png
img12.png img10.png
img2.png img12.png
```
The default config is
```javascript
[
"warn",
"asc",
{
caseSensitive: true,
natural: false,
},
];
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet