eslint-plugin-sort
Advanced tools
Comparing version 2.10.0 to 2.11.0
@@ -7,3 +7,3 @@ // src/utils.ts | ||
function enumerate(a, b) { | ||
return a.map((val, index) => [val, b[index]]).filter((x) => x[0] !== x[1]); | ||
return a.map((val, index2) => [val, b[index2]]).filter((x) => x[0] !== x[1]); | ||
} | ||
@@ -139,2 +139,5 @@ function getName(node) { | ||
function isResolved(source) { | ||
if (globalThis.resolver) { | ||
return globalThis.resolver(source); | ||
} | ||
if (resolveCache.has(source)) { | ||
@@ -872,37 +875,4 @@ return resolveCache.get(source); | ||
// src/index.ts | ||
var config = { | ||
configs: { | ||
recommended: { | ||
plugins: ["sort"], | ||
rules: { | ||
"sort/destructuring-properties": "warn", | ||
"sort/exports": [ | ||
"warn", | ||
{ | ||
groups: [ | ||
{ type: "default", order: 5 }, | ||
{ type: "sourceless", order: 4 }, | ||
{ regex: "^\\.+\\/", order: 3 }, | ||
{ type: "dependency", order: 1 }, | ||
{ type: "other", order: 2 } | ||
] | ||
} | ||
], | ||
"sort/export-members": "warn", | ||
"sort/imports": [ | ||
"warn", | ||
{ | ||
groups: [ | ||
{ type: "side-effect", order: 1 }, | ||
{ regex: "^\\.+\\/", order: 4 }, | ||
{ type: "dependency", order: 2 }, | ||
{ type: "other", order: 3 } | ||
] | ||
} | ||
], | ||
"sort/import-members": "warn", | ||
"sort/object-properties": "warn" | ||
} | ||
} | ||
}, | ||
var index = { | ||
configs: {}, | ||
rules: { | ||
@@ -920,5 +890,41 @@ "destructuring-properties": destructuring_properties_default, | ||
}; | ||
var src_default = config; | ||
var createConfig = (flat) => ({ | ||
plugins: flat ? { sort: index } : ["sort"], | ||
rules: { | ||
"sort/destructuring-properties": "warn", | ||
"sort/exports": [ | ||
"warn", | ||
{ | ||
groups: [ | ||
{ type: "default", order: 50 }, | ||
{ type: "sourceless", order: 40 }, | ||
{ regex: "^\\.+\\/", order: 30 }, | ||
{ type: "dependency", order: 10 }, | ||
{ type: "other", order: 20 } | ||
] | ||
} | ||
], | ||
"sort/export-members": "warn", | ||
"sort/imports": [ | ||
"warn", | ||
{ | ||
groups: [ | ||
{ type: "side-effect", order: 10 }, | ||
{ regex: "^\\.+\\/", order: 40 }, | ||
{ type: "dependency", order: 20 }, | ||
{ type: "other", order: 30 } | ||
] | ||
} | ||
], | ||
"sort/import-members": "warn", | ||
"sort/object-properties": "warn" | ||
} | ||
}); | ||
index.configs = { | ||
"recommended": createConfig(false), | ||
"flat/recommended": createConfig(true) | ||
}; | ||
var src_default = index; | ||
export { | ||
src_default as default | ||
}; |
{ | ||
"name": "eslint-plugin-sort", | ||
"description": "Auto-fixable sort rules for ESLint.", | ||
"version": "2.10.0", | ||
"version": "2.11.0", | ||
"author": "Mark Skelton", | ||
"packageManager": "pnpm@7.29.1", | ||
"repository": "github:mskelton/eslint-plugin-sort", | ||
@@ -50,5 +49,5 @@ "homepage": "https://github.com/mskelton/eslint-plugin-sort#readme", | ||
"@types/natural-compare": "^1.4.1", | ||
"@types/node": "^18.15.0", | ||
"@typescript-eslint/eslint-plugin": "^5.54.1", | ||
"@typescript-eslint/parser": "^5.54.1", | ||
"bun-types": "^1.0.1", | ||
"dedent": "^0.7.0", | ||
@@ -55,0 +54,0 @@ "eslint": "^8.36.0", |
@@ -29,2 +29,8 @@ # eslint-plugin-sort | ||
### bun | ||
```bash | ||
bun add -d eslint-plugin-sort | ||
``` | ||
## Usage | ||
@@ -35,2 +41,21 @@ | ||
[Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new) | ||
(**eslint.config.js**) | ||
```javascript | ||
import sort from "eslint-plugin-sort" | ||
export default [ | ||
sort.configs["flat/recommended"], | ||
{ | ||
rules: { | ||
// Customize rules... | ||
}, | ||
}, | ||
] | ||
``` | ||
[Legacy config](https://eslint.org/docs/latest/use/configure/configuration-files) | ||
(**.eslintrc**) | ||
```json | ||
@@ -37,0 +62,0 @@ { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59114
1848
82