eslint-plugin-perfectionist 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +389 -216
- package/license +20 -0
- package/package.json +1 -1
- package/readme.md +9 -7
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const f=require("@typescript-eslint/types"),Y=require("@typescript-eslint/utils"),L=require("natural-compare-lite"),j="eslint-plugin-perfectionist",C="azat-io/eslint-plugin-perfectionist";let y=Y.ESLintUtils.RuleCreator(r=>`https://github.com/${C}/blob/main/docs/rules/${r}.md`),E=r=>{let[o,l]=r;return l-o};var n=(r=>(r.natural="natural",r["line-length"]="line-length",r))(n||{}),d=(r=>(r.asc="asc",r.desc="desc",r))(d||{});let m=(r,o,l)=>(l.order==="asc"?1:-1)*(l.type===n.natural?L(r.name,o.name):r.size-o.size)>0,S=(r,o,l,p)=>{let s=[...l].sort((t,a)=>Number(m(t,a,p))||-1);p.spreadLast&&s.forEach((t,a)=>{t.node.type===f.AST_NODE_TYPES.SpreadElement&&s.push(s.splice(a,1).at(0))});let e=t=>[t.range.at(0),t.range.at(1)];return l.map(({node:t},a)=>r.replaceTextRange(e(t),o.slice(...e(s[a].node))))},T=(r={},o)=>Object.assign(o,r);const _="sort-array-includes",M=y({name:_,meta:{type:"suggestion",docs:{description:"Enforce sorted arrays before include method",recommended:!1},fixable:"code",schema:[{type:"object",properties:{type:{enum:[n.natural,n["line-length"]],default:n.natural},order:{enum:[d.asc,d.desc],default:d.asc},spreadLast:{type:"boolean",default:!1}},additionalProperties:!1}],messages:{unexpectedArrayIncludesOrder:'Expected "{{second}}" to come before "{{first}}"'}},defaultOptions:[{type:n.natural,order:d.asc}],create:r=>({MemberExpression:o=>{if((o.object.type===f.AST_NODE_TYPES.ArrayExpression||o.object.type===f.AST_NODE_TYPES.NewExpression)&&o.property.type===f.AST_NODE_TYPES.Identifier&&o.property.name==="includes"){let l=T(r.options.at(0),{type:n.natural,order:d.asc,spreadLast:!1}),p=o.object.type===f.AST_NODE_TYPES.ArrayExpression?o.object.elements:o.object.arguments;if(p.length>1){let s=r.getSourceCode().text,e=p.reduce((t,a)=>(a===null||t.at(0).push({name:a.type===f.AST_NODE_TYPES.Literal?a.raw:s.slice(...a.range),size:E(a.range),type:a.type,node:a}),t),[[],[]]).flat();for(let t=1;t<e.length;t++){let a=e.at(t-1),i=e.at(t),c;l.spreadLast&&a.node.type===f.AST_NODE_TYPES.Literal&&i.node.type===f.AST_NODE_TYPES.SpreadElement?c=!1:l.spreadLast&&a.node.type===f.AST_NODE_TYPES.SpreadElement&&i.node.type===f.AST_NODE_TYPES.Literal?c=!0:c=m(a,i,l),c&&r.report({messageId:"unexpectedArrayIncludesOrder",data:{first:a.name,second:i.name},node:i.node,fix:u=>{let g=r.getSourceCode(),{text:x}=g;return S(u,x,e,l)}})}}}}})}),N="sort-interfaces",R=y({name:N,meta:{type:"suggestion",docs:{description:"Enforce sorted interface properties",recommended:!1},fixable:"code",schema:[{type:"object",properties:{type:{enum:[n.natural,n["line-length"]],default:n.natural},order:{enum:[d.asc,d.desc],default:d.asc}},additionalProperties:!1}],messages:{unexpectedInterfacePropertiesOrder:'Expected "{{second}}" to come before "{{first}}"'}},defaultOptions:[{type:n.natural,order:d.asc}],create:r=>({TSInterfaceBody:o=>{let l=T(r.options.at(0),{type:n.natural,order:d.asc});if(o.body.length>1){let p=r.getSourceCode().text,s=o.body.map(e=>{var a,i,c;let t;if(e.type===f.AST_NODE_TYPES.TSPropertySignature)if(e.key.type===f.AST_NODE_TYPES.Identifier)({name:t}=e.key);else if(e.key.type===f.AST_NODE_TYPES.Literal)t=`${e.key.value}`;else{let u;if((a=e.typeAnnotation)!=null&&a.range.at(0))u=e.typeAnnotation.range.at(0);else{let g=e.optional?1:0;u=e.range.at(1)-g}t=p.slice(e.range.at(0),u)}else e.type===f.AST_NODE_TYPES.TSIndexSignature?t=p.slice(e.range.at(0),((i=e.typeAnnotation)==null?void 0:i.range.at(0))??e.range.at(1)):t=p.slice(e.range.at(0),((c=e.returnType)==null?void 0:c.range.at(0))??e.range.at(1));return{size:E(e.range),node:e,name:t}});for(let e=1;e<s.length;e++){let t=s.at(e-1),a=s.at(e);if(m(t,a,l)){let i=o.body[e];r.report({messageId:"unexpectedInterfacePropertiesOrder",data:{first:t.name,second:a.name},node:i,fix:c=>S(c,p,s,l)})}}}}})}),O="sort-jsx-props",U=y({name:O,meta:{type:"suggestion",docs:{description:"Enforce sorted JSX props",recommended:!1},fixable:"code",schema:[{type:"object",properties:{type:{enum:[n.natural,n["line-length"]],default:n.natural},order:{enum:[d.asc,d.desc],default:d.asc}},additionalProperties:!1}],messages:{unexpectedJSXPropsOrder:'Expected "{{second}}" to come before "{{first}}"'}},defaultOptions:[{type:n.natural,order:d.asc}],create:r=>({JSXElement:o=>{let l=T(r.options.at(0),{type:n.natural,order:d.asc});o.openingElement.attributes.reduce((s,e)=>(e.type==="JSXAttribute"?s.at(-1).push(e):s.push([]),s),[[]]).forEach(s=>{let e=s.map(t=>({name:t.name.type===f.AST_NODE_TYPES.JSXNamespacedName?`${t.name.namespace.name}:${t.name.name.name}`:t.name.name,size:E(t.range),node:t}));for(let t=1;t<e.length;t++){let a=e.at(t-1),i=e.at(t);m(a,i,l)&&r.report({messageId:"unexpectedJSXPropsOrder",data:{first:a.name,second:i.name},node:i.node,fix:c=>{let u=r.getSourceCode().text;return S(c,u,e,l)}})}})}})}),h="sort-map-elements",$=y({name:h,meta:{type:"suggestion",docs:{description:"Enforce sorted Map elements",recommended:!1},fixable:"code",schema:[{type:"object",properties:{type:{enum:[n.natural,n["line-length"]],default:n.natural},order:{enum:[d.asc,d.desc],default:d.asc}},additionalProperties:!1}],messages:{unexpectedMapElementsOrder:'Expected "{{second}}" to come before "{{first}}"'}},defaultOptions:[{type:n.natural,order:d.asc}],create:r=>({NewExpression:o=>{if(o.callee.type===f.AST_NODE_TYPES.Identifier&&o.callee.name==="Map"&&o.arguments[0].type===f.AST_NODE_TYPES.ArrayExpression){let l=T(r.options.at(0),{type:n.natural,order:d.asc}),[{elements:p}]=o.arguments,s=r.getSourceCode().text;p.length>1&&p.reduce((t,a)=>(a===null||a.type===f.AST_NODE_TYPES.SpreadElement?t.push([]):t.at(-1).push(a),t),[[]]).forEach(t=>{let a=t.map(i=>{let c;if(i.type===f.AST_NODE_TYPES.ArrayExpression){let[u]=i.elements;u?u.type===f.AST_NODE_TYPES.Literal?c=u.raw:c=s.slice(...u.range):c=`${u}`}else c=s.slice(...i.range);return{size:E(i.range),node:i,name:c}});for(let i=1;i<a.length;i++){let c=a.at(i-1),u=a.at(i);m(c,u,l)&&r.report({messageId:"unexpectedMapElementsOrder",data:{first:c.name,second:u.name},node:u.node,fix:g=>{let x=r.getSourceCode(),{text:I}=x;return S(g,I,a,l)}})}})}}})}),A="sort-named-exports",v=y({name:A,meta:{type:"suggestion",docs:{description:"Enforce sorted named exports",recommended:!1},fixable:"code",schema:[{type:"object",properties:{type:{enum:[n.natural,n["line-length"]],default:n.natural},order:{enum:[d.asc,d.desc],default:d.asc}},additionalProperties:!1}],messages:{unexpectedNamedExportsOrder:'Expected "{{second}}" to come before "{{first}}"'}},defaultOptions:[{type:n.natural,order:d.asc}],create:r=>({ExportNamedDeclaration:o=>{let l=T(r.options.at(0),{type:n.natural,order:d.asc});if(o.specifiers.length>1){let p=o.specifiers.map(s=>{let{range:e,local:{name:t}}=s;return{size:E(e),node:s,name:t}});for(let s=1;s<p.length;s++){let e=p.at(s-1),t=p.at(s);if(m(e,t,l)){let a=o.specifiers[s];r.report({messageId:"unexpectedNamedExportsOrder",data:{first:e.name,second:t.name},node:a,fix:i=>{let c=r.getSourceCode(),{text:u}=c;return S(i,u,p,l)}})}}}}})}),b="sort-named-imports",z=y({name:b,meta:{type:"suggestion",docs:{description:"Enforce sorted named imports",recommended:!1},fixable:"code",schema:[{type:"object",properties:{type:{enum:[n.natural,n["line-length"]],default:n.natural},order:{enum:[d.asc,d.desc],default:d.asc}},additionalProperties:!1}],messages:{unexpectedNamedImportsOrder:'Expected "{{second}}" to come before "{{first}}"'}},defaultOptions:[{type:n.natural,order:d.asc}],create:r=>({ImportDeclaration:o=>{let l=T(r.options.at(0),{type:n.natural,order:d.asc});if(o.specifiers.length>1){let p=o.specifiers.map(s=>{let{range:e,local:{name:t}}=s;return{size:E(e),node:s,name:t}});for(let s=1;s<p.length;s++){let e=p.at(s-1),t=p.at(s);if(m(e,t,l)){let a=o.specifiers[s];r.report({messageId:"unexpectedNamedImportsOrder",data:{first:e.name,second:t.name},node:a,fix:i=>{let c=r.getSourceCode(),{text:u}=c;return S(i,u,p,l)}})}}}}})}),P="sort-union-types",J=y({name:P,meta:{type:"suggestion",docs:{description:"Enforce sorted union types",recommended:!1},fixable:"code",schema:[{type:"object",properties:{type:{enum:[n.natural,n["line-length"]],default:n.natural},order:{enum:[d.asc,d.desc],default:d.asc}},additionalProperties:!1}],messages:{unexpectedUnionTypesOrder:'Expected "{{second}}" to come before "{{first}}"'}},defaultOptions:[{type:n.natural,order:d.asc}],create:r=>({TSUnionType:o=>{let l=r.getSourceCode().text,p=T(r.options.at(0),{type:n.natural,order:d.asc}),s=o.types.map(e=>{let{range:t}=e,a=l.slice(...t);return{size:E(t),node:e,name:a}});for(let e=1;e<s.length;e++){let t=s.at(e-1),a=s.at(e);if(m(t,a,p)){let i=o.types[e];r.report({messageId:"unexpectedUnionTypesOrder",data:{first:t.name,second:a.name},node:i,fix:c=>{let u=r.getSourceCode(),{text:g}=u;return S(c,g,s,p)}})}}}})});let D=r=>{let o={[_]:["error",{spreadLast:!0}],[N]:["error"],[O]:["error"],[h]:["error"],[A]:["error"],[b]:["error"],[P]:["error"]};return Object.fromEntries(Object.entries(o).map(([l,[p,s={}]])=>[l,[p,Object.assign(s,r)]]))};const X={name:j,rules:{[_]:M,[N]:R,[O]:U,[h]:$,[A]:v,[b]:z,[P]:J},configs:{"recommended-natural":D({type:n.natural,order:d.asc}),"recommended-line-length":D({type:n["line-length"],order:d.desc})}};module.exports=X;
|
package/dist/index.mjs
CHANGED
|
@@ -1,30 +1,107 @@
|
|
|
1
|
-
import { AST_NODE_TYPES as
|
|
2
|
-
import { ESLintUtils as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
(
|
|
7
|
-
),
|
|
8
|
-
let [o,
|
|
9
|
-
return
|
|
1
|
+
import { AST_NODE_TYPES as f } from "@typescript-eslint/types";
|
|
2
|
+
import { ESLintUtils as M } from "@typescript-eslint/utils";
|
|
3
|
+
import R from "natural-compare-lite";
|
|
4
|
+
const T = "eslint-plugin-perfectionist", U = "azat-io/eslint-plugin-perfectionist";
|
|
5
|
+
let y = M.RuleCreator(
|
|
6
|
+
(r) => `https://github.com/${U}/blob/main/docs/rules/${r}.md`
|
|
7
|
+
), E = (r) => {
|
|
8
|
+
let [o, l] = r;
|
|
9
|
+
return l - o;
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
var n = /* @__PURE__ */ ((r) => (r.natural = "natural", r["line-length"] = "line-length", r))(n || {}), d = /* @__PURE__ */ ((r) => (r.asc = "asc", r.desc = "desc", r))(d || {});
|
|
12
|
+
let m = (r, o, l) => (l.order === "asc" ? 1 : -1) * (l.type === n.natural ? R(r.name, o.name) : r.size - o.size) > 0, x = (r, o, l, p) => {
|
|
13
|
+
let s = [...l].sort((t, a) => Number(m(t, a, p)) || -1);
|
|
14
|
+
p.spreadLast && s.forEach((t, a) => {
|
|
15
|
+
t.node.type === f.SpreadElement && s.push(s.splice(a, 1).at(0));
|
|
16
|
+
});
|
|
17
|
+
let e = (t) => [t.range.at(0), t.range.at(1)];
|
|
18
|
+
return l.map(
|
|
19
|
+
({ node: t }, a) => r.replaceTextRange(e(t), o.slice(...e(s[a].node)))
|
|
16
20
|
);
|
|
17
|
-
},
|
|
18
|
-
const
|
|
19
|
-
name:
|
|
21
|
+
}, h = (r = {}, o) => Object.assign(o, r);
|
|
22
|
+
const N = "sort-array-includes", $ = y({
|
|
23
|
+
name: N,
|
|
20
24
|
meta: {
|
|
21
25
|
type: "suggestion",
|
|
22
26
|
docs: {
|
|
23
|
-
description: "Enforce sorted
|
|
27
|
+
description: "Enforce sorted arrays before include method",
|
|
24
28
|
recommended: !1
|
|
25
29
|
},
|
|
30
|
+
fixable: "code",
|
|
31
|
+
schema: [
|
|
32
|
+
{
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
type: {
|
|
36
|
+
enum: [n.natural, n["line-length"]],
|
|
37
|
+
default: n.natural
|
|
38
|
+
},
|
|
39
|
+
order: {
|
|
40
|
+
enum: [d.asc, d.desc],
|
|
41
|
+
default: d.asc
|
|
42
|
+
},
|
|
43
|
+
spreadLast: {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
default: !1
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
additionalProperties: !1
|
|
49
|
+
}
|
|
50
|
+
],
|
|
26
51
|
messages: {
|
|
27
|
-
|
|
52
|
+
unexpectedArrayIncludesOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultOptions: [
|
|
56
|
+
{
|
|
57
|
+
type: n.natural,
|
|
58
|
+
order: d.asc
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
create: (r) => ({
|
|
62
|
+
MemberExpression: (o) => {
|
|
63
|
+
if ((o.object.type === f.ArrayExpression || o.object.type === f.NewExpression) && o.property.type === f.Identifier && o.property.name === "includes") {
|
|
64
|
+
let l = h(r.options.at(0), {
|
|
65
|
+
type: n.natural,
|
|
66
|
+
order: d.asc,
|
|
67
|
+
spreadLast: !1
|
|
68
|
+
}), p = o.object.type === f.ArrayExpression ? o.object.elements : o.object.arguments;
|
|
69
|
+
if (p.length > 1) {
|
|
70
|
+
let s = r.getSourceCode().text, e = p.reduce(
|
|
71
|
+
(t, a) => (a === null || t.at(0).push({
|
|
72
|
+
name: a.type === f.Literal ? a.raw : s.slice(...a.range),
|
|
73
|
+
size: E(a.range),
|
|
74
|
+
type: a.type,
|
|
75
|
+
node: a
|
|
76
|
+
}), t),
|
|
77
|
+
[[], []]
|
|
78
|
+
).flat();
|
|
79
|
+
for (let t = 1; t < e.length; t++) {
|
|
80
|
+
let a = e.at(t - 1), i = e.at(t), c;
|
|
81
|
+
l.spreadLast && a.node.type === f.Literal && i.node.type === f.SpreadElement ? c = !1 : l.spreadLast && a.node.type === f.SpreadElement && i.node.type === f.Literal ? c = !0 : c = m(a, i, l), c && r.report({
|
|
82
|
+
messageId: "unexpectedArrayIncludesOrder",
|
|
83
|
+
data: {
|
|
84
|
+
first: a.name,
|
|
85
|
+
second: i.name
|
|
86
|
+
},
|
|
87
|
+
node: i.node,
|
|
88
|
+
fix: (u) => {
|
|
89
|
+
let g = r.getSourceCode(), { text: b } = g;
|
|
90
|
+
return x(u, b, e, l);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
}), S = "sort-interfaces", v = y({
|
|
99
|
+
name: S,
|
|
100
|
+
meta: {
|
|
101
|
+
type: "suggestion",
|
|
102
|
+
docs: {
|
|
103
|
+
description: "Enforce sorted interface properties",
|
|
104
|
+
recommended: !1
|
|
28
105
|
},
|
|
29
106
|
fixable: "code",
|
|
30
107
|
schema: [
|
|
@@ -32,154 +109,231 @@ const b = "sort-interfaces", _ = E({
|
|
|
32
109
|
type: "object",
|
|
33
110
|
properties: {
|
|
34
111
|
type: {
|
|
35
|
-
enum: [
|
|
112
|
+
enum: [n.natural, n["line-length"]],
|
|
113
|
+
default: n.natural
|
|
36
114
|
},
|
|
37
115
|
order: {
|
|
38
|
-
enum: [
|
|
116
|
+
enum: [d.asc, d.desc],
|
|
117
|
+
default: d.asc
|
|
39
118
|
}
|
|
40
119
|
},
|
|
41
120
|
additionalProperties: !1
|
|
42
121
|
}
|
|
43
|
-
]
|
|
122
|
+
],
|
|
123
|
+
messages: {
|
|
124
|
+
unexpectedInterfacePropertiesOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
125
|
+
}
|
|
44
126
|
},
|
|
45
127
|
defaultOptions: [
|
|
46
128
|
{
|
|
47
|
-
type:
|
|
48
|
-
order:
|
|
129
|
+
type: n.natural,
|
|
130
|
+
order: d.asc
|
|
49
131
|
}
|
|
50
132
|
],
|
|
51
|
-
create: (
|
|
133
|
+
create: (r) => ({
|
|
52
134
|
TSInterfaceBody: (o) => {
|
|
53
|
-
let
|
|
54
|
-
type:
|
|
55
|
-
order:
|
|
56
|
-
}), d = o.body.map((e) => {
|
|
57
|
-
let s = "", r = 0, n = (c) => {
|
|
58
|
-
r += c;
|
|
59
|
-
}, p = (c) => {
|
|
60
|
-
n(y(c.key.range));
|
|
61
|
-
}, m = (c) => {
|
|
62
|
-
let { length: x } = "[]";
|
|
63
|
-
n(c.parameters.reduce((S, { range: A }) => S + y(A), x));
|
|
64
|
-
}, u = (c) => {
|
|
65
|
-
if (c.optional) {
|
|
66
|
-
let { length: x } = "?";
|
|
67
|
-
n(x);
|
|
68
|
-
}
|
|
69
|
-
}, g = (c) => {
|
|
70
|
-
var S;
|
|
71
|
-
let x = (S = c.typeAnnotation) == null ? void 0 : S.range;
|
|
72
|
-
x && n(y(x));
|
|
73
|
-
}, f = (c) => {
|
|
74
|
-
if (c.type === I.Identifier)
|
|
75
|
-
({ name: s } = c);
|
|
76
|
-
else if (c.type === I.TSIndexSignature) {
|
|
77
|
-
let x = c.parameters.at(0);
|
|
78
|
-
x && f(x);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
return e.type === I.TSPropertySignature ? (f(e.key), p(e), u(e), g(e)) : e.type === I.TSIndexSignature && (f(e), m(e), g(e)), {
|
|
82
|
-
node: e,
|
|
83
|
-
name: s,
|
|
84
|
-
size: r
|
|
85
|
-
};
|
|
135
|
+
let l = h(r.options.at(0), {
|
|
136
|
+
type: n.natural,
|
|
137
|
+
order: d.asc
|
|
86
138
|
});
|
|
87
|
-
|
|
88
|
-
let
|
|
89
|
-
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
139
|
+
if (o.body.length > 1) {
|
|
140
|
+
let p = r.getSourceCode().text, s = o.body.map((e) => {
|
|
141
|
+
var a, i, c;
|
|
142
|
+
let t;
|
|
143
|
+
if (e.type === f.TSPropertySignature)
|
|
144
|
+
if (e.key.type === f.Identifier)
|
|
145
|
+
({ name: t } = e.key);
|
|
146
|
+
else if (e.key.type === f.Literal)
|
|
147
|
+
t = `${e.key.value}`;
|
|
148
|
+
else {
|
|
149
|
+
let u;
|
|
150
|
+
if ((a = e.typeAnnotation) != null && a.range.at(0))
|
|
151
|
+
u = e.typeAnnotation.range.at(0);
|
|
152
|
+
else {
|
|
153
|
+
let g = e.optional ? 1 : 0;
|
|
154
|
+
u = e.range.at(1) - g;
|
|
155
|
+
}
|
|
156
|
+
t = p.slice(e.range.at(0), u);
|
|
101
157
|
}
|
|
102
|
-
|
|
158
|
+
else
|
|
159
|
+
e.type === f.TSIndexSignature ? t = p.slice(e.range.at(0), ((i = e.typeAnnotation) == null ? void 0 : i.range.at(0)) ?? e.range.at(1)) : t = p.slice(e.range.at(0), ((c = e.returnType) == null ? void 0 : c.range.at(0)) ?? e.range.at(1));
|
|
160
|
+
return {
|
|
161
|
+
size: E(e.range),
|
|
162
|
+
node: e,
|
|
163
|
+
name: t
|
|
164
|
+
};
|
|
165
|
+
});
|
|
166
|
+
for (let e = 1; e < s.length; e++) {
|
|
167
|
+
let t = s.at(e - 1), a = s.at(e);
|
|
168
|
+
if (m(t, a, l)) {
|
|
169
|
+
let i = o.body[e];
|
|
170
|
+
r.report({
|
|
171
|
+
messageId: "unexpectedInterfacePropertiesOrder",
|
|
172
|
+
data: {
|
|
173
|
+
first: t.name,
|
|
174
|
+
second: a.name
|
|
175
|
+
},
|
|
176
|
+
node: i,
|
|
177
|
+
fix: (c) => x(c, p, s, l)
|
|
178
|
+
});
|
|
179
|
+
}
|
|
103
180
|
}
|
|
104
181
|
}
|
|
105
182
|
}
|
|
106
183
|
})
|
|
107
|
-
}),
|
|
108
|
-
name:
|
|
184
|
+
}), O = "sort-jsx-props", z = y({
|
|
185
|
+
name: O,
|
|
109
186
|
meta: {
|
|
110
187
|
type: "suggestion",
|
|
111
188
|
docs: {
|
|
112
|
-
description: "Enforce sorted
|
|
189
|
+
description: "Enforce sorted JSX props",
|
|
113
190
|
recommended: !1
|
|
114
191
|
},
|
|
115
|
-
messages: {
|
|
116
|
-
unexpectedJSXPropsOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
117
|
-
},
|
|
118
192
|
fixable: "code",
|
|
119
193
|
schema: [
|
|
120
194
|
{
|
|
121
195
|
type: "object",
|
|
122
196
|
properties: {
|
|
123
197
|
type: {
|
|
124
|
-
enum: [
|
|
198
|
+
enum: [n.natural, n["line-length"]],
|
|
199
|
+
default: n.natural
|
|
125
200
|
},
|
|
126
201
|
order: {
|
|
127
|
-
enum: [
|
|
202
|
+
enum: [d.asc, d.desc],
|
|
203
|
+
default: d.asc
|
|
128
204
|
}
|
|
129
205
|
},
|
|
130
206
|
additionalProperties: !1
|
|
131
207
|
}
|
|
132
|
-
]
|
|
208
|
+
],
|
|
209
|
+
messages: {
|
|
210
|
+
unexpectedJSXPropsOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
211
|
+
}
|
|
133
212
|
},
|
|
134
213
|
defaultOptions: [
|
|
135
214
|
{
|
|
136
|
-
type:
|
|
137
|
-
order:
|
|
215
|
+
type: n.natural,
|
|
216
|
+
order: d.asc
|
|
138
217
|
}
|
|
139
218
|
],
|
|
140
|
-
create: (
|
|
219
|
+
create: (r) => ({
|
|
141
220
|
JSXElement: (o) => {
|
|
142
|
-
let
|
|
143
|
-
type:
|
|
144
|
-
order:
|
|
221
|
+
let l = h(r.options.at(0), {
|
|
222
|
+
type: n.natural,
|
|
223
|
+
order: d.asc
|
|
145
224
|
});
|
|
146
225
|
o.openingElement.attributes.reduce(
|
|
147
|
-
(
|
|
226
|
+
(s, e) => (e.type === "JSXAttribute" ? s.at(-1).push(e) : s.push([]), s),
|
|
148
227
|
[[]]
|
|
149
|
-
).forEach((
|
|
150
|
-
let
|
|
151
|
-
name:
|
|
152
|
-
size:
|
|
153
|
-
node:
|
|
228
|
+
).forEach((s) => {
|
|
229
|
+
let e = s.map((t) => ({
|
|
230
|
+
name: t.name.type === f.JSXNamespacedName ? `${t.name.namespace.name}:${t.name.name.name}` : t.name.name,
|
|
231
|
+
size: E(t.range),
|
|
232
|
+
node: t
|
|
154
233
|
}));
|
|
155
|
-
for (let
|
|
156
|
-
let
|
|
157
|
-
|
|
234
|
+
for (let t = 1; t < e.length; t++) {
|
|
235
|
+
let a = e.at(t - 1), i = e.at(t);
|
|
236
|
+
m(a, i, l) && r.report({
|
|
158
237
|
messageId: "unexpectedJSXPropsOrder",
|
|
159
238
|
data: {
|
|
160
|
-
first:
|
|
161
|
-
second:
|
|
239
|
+
first: a.name,
|
|
240
|
+
second: i.name
|
|
162
241
|
},
|
|
163
|
-
node:
|
|
164
|
-
fix: (
|
|
165
|
-
let
|
|
166
|
-
return
|
|
242
|
+
node: i.node,
|
|
243
|
+
fix: (c) => {
|
|
244
|
+
let u = r.getSourceCode().text;
|
|
245
|
+
return x(c, u, e, l);
|
|
167
246
|
}
|
|
168
247
|
});
|
|
169
248
|
}
|
|
170
249
|
});
|
|
171
250
|
}
|
|
172
251
|
})
|
|
173
|
-
}),
|
|
174
|
-
name:
|
|
252
|
+
}), I = "sort-map-elements", _ = y({
|
|
253
|
+
name: I,
|
|
175
254
|
meta: {
|
|
176
255
|
type: "suggestion",
|
|
177
256
|
docs: {
|
|
178
|
-
description: "Enforce sorted
|
|
257
|
+
description: "Enforce sorted Map elements",
|
|
179
258
|
recommended: !1
|
|
180
259
|
},
|
|
260
|
+
fixable: "code",
|
|
261
|
+
schema: [
|
|
262
|
+
{
|
|
263
|
+
type: "object",
|
|
264
|
+
properties: {
|
|
265
|
+
type: {
|
|
266
|
+
enum: [n.natural, n["line-length"]],
|
|
267
|
+
default: n.natural
|
|
268
|
+
},
|
|
269
|
+
order: {
|
|
270
|
+
enum: [d.asc, d.desc],
|
|
271
|
+
default: d.asc
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
additionalProperties: !1
|
|
275
|
+
}
|
|
276
|
+
],
|
|
181
277
|
messages: {
|
|
182
|
-
|
|
278
|
+
unexpectedMapElementsOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
defaultOptions: [
|
|
282
|
+
{
|
|
283
|
+
type: n.natural,
|
|
284
|
+
order: d.asc
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
create: (r) => ({
|
|
288
|
+
NewExpression: (o) => {
|
|
289
|
+
if (o.callee.type === f.Identifier && o.callee.name === "Map" && o.arguments[0].type === f.ArrayExpression) {
|
|
290
|
+
let l = h(r.options.at(0), {
|
|
291
|
+
type: n.natural,
|
|
292
|
+
order: d.asc
|
|
293
|
+
}), [{ elements: p }] = o.arguments, s = r.getSourceCode().text;
|
|
294
|
+
p.length > 1 && p.reduce(
|
|
295
|
+
(t, a) => (a === null || a.type === f.SpreadElement ? t.push([]) : t.at(-1).push(a), t),
|
|
296
|
+
[[]]
|
|
297
|
+
).forEach((t) => {
|
|
298
|
+
let a = t.map((i) => {
|
|
299
|
+
let c;
|
|
300
|
+
if (i.type === f.ArrayExpression) {
|
|
301
|
+
let [u] = i.elements;
|
|
302
|
+
u ? u.type === f.Literal ? c = u.raw : c = s.slice(...u.range) : c = `${u}`;
|
|
303
|
+
} else
|
|
304
|
+
c = s.slice(...i.range);
|
|
305
|
+
return {
|
|
306
|
+
size: E(i.range),
|
|
307
|
+
node: i,
|
|
308
|
+
name: c
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
for (let i = 1; i < a.length; i++) {
|
|
312
|
+
let c = a.at(i - 1), u = a.at(i);
|
|
313
|
+
m(c, u, l) && r.report({
|
|
314
|
+
messageId: "unexpectedMapElementsOrder",
|
|
315
|
+
data: {
|
|
316
|
+
first: c.name,
|
|
317
|
+
second: u.name
|
|
318
|
+
},
|
|
319
|
+
node: u.node,
|
|
320
|
+
fix: (g) => {
|
|
321
|
+
let b = r.getSourceCode(), { text: P } = b;
|
|
322
|
+
return x(g, P, a, l);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
})
|
|
330
|
+
}), A = "sort-named-exports", J = y({
|
|
331
|
+
name: A,
|
|
332
|
+
meta: {
|
|
333
|
+
type: "suggestion",
|
|
334
|
+
docs: {
|
|
335
|
+
description: "Enforce sorted named exports",
|
|
336
|
+
recommended: !1
|
|
183
337
|
},
|
|
184
338
|
fixable: "code",
|
|
185
339
|
schema: [
|
|
@@ -187,54 +341,59 @@ const b = "sort-interfaces", _ = E({
|
|
|
187
341
|
type: "object",
|
|
188
342
|
properties: {
|
|
189
343
|
type: {
|
|
190
|
-
enum: [
|
|
344
|
+
enum: [n.natural, n["line-length"]],
|
|
345
|
+
default: n.natural
|
|
191
346
|
},
|
|
192
347
|
order: {
|
|
193
|
-
enum: [
|
|
348
|
+
enum: [d.asc, d.desc],
|
|
349
|
+
default: d.asc
|
|
194
350
|
}
|
|
195
351
|
},
|
|
196
352
|
additionalProperties: !1
|
|
197
353
|
}
|
|
198
|
-
]
|
|
354
|
+
],
|
|
355
|
+
messages: {
|
|
356
|
+
unexpectedNamedExportsOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
357
|
+
}
|
|
199
358
|
},
|
|
200
359
|
defaultOptions: [
|
|
201
360
|
{
|
|
202
|
-
type:
|
|
203
|
-
order:
|
|
361
|
+
type: n.natural,
|
|
362
|
+
order: d.asc
|
|
204
363
|
}
|
|
205
364
|
],
|
|
206
|
-
create: (
|
|
365
|
+
create: (r) => ({
|
|
207
366
|
ExportNamedDeclaration: (o) => {
|
|
208
|
-
let
|
|
209
|
-
type:
|
|
210
|
-
order:
|
|
367
|
+
let l = h(r.options.at(0), {
|
|
368
|
+
type: n.natural,
|
|
369
|
+
order: d.asc
|
|
211
370
|
});
|
|
212
371
|
if (o.specifiers.length > 1) {
|
|
213
|
-
let
|
|
372
|
+
let p = o.specifiers.map((s) => {
|
|
214
373
|
let {
|
|
215
|
-
range:
|
|
216
|
-
local: { name:
|
|
217
|
-
} =
|
|
374
|
+
range: e,
|
|
375
|
+
local: { name: t }
|
|
376
|
+
} = s;
|
|
218
377
|
return {
|
|
219
|
-
size:
|
|
220
|
-
node:
|
|
221
|
-
name:
|
|
378
|
+
size: E(e),
|
|
379
|
+
node: s,
|
|
380
|
+
name: t
|
|
222
381
|
};
|
|
223
382
|
});
|
|
224
|
-
for (let
|
|
225
|
-
let
|
|
226
|
-
if (
|
|
227
|
-
let
|
|
228
|
-
|
|
383
|
+
for (let s = 1; s < p.length; s++) {
|
|
384
|
+
let e = p.at(s - 1), t = p.at(s);
|
|
385
|
+
if (m(e, t, l)) {
|
|
386
|
+
let a = o.specifiers[s];
|
|
387
|
+
r.report({
|
|
229
388
|
messageId: "unexpectedNamedExportsOrder",
|
|
230
389
|
data: {
|
|
231
|
-
first:
|
|
232
|
-
second:
|
|
390
|
+
first: e.name,
|
|
391
|
+
second: t.name
|
|
233
392
|
},
|
|
234
|
-
node:
|
|
235
|
-
fix: (
|
|
236
|
-
let
|
|
237
|
-
return
|
|
393
|
+
node: a,
|
|
394
|
+
fix: (i) => {
|
|
395
|
+
let c = r.getSourceCode(), { text: u } = c;
|
|
396
|
+
return x(i, u, p, l);
|
|
238
397
|
}
|
|
239
398
|
});
|
|
240
399
|
}
|
|
@@ -242,71 +401,73 @@ const b = "sort-interfaces", _ = E({
|
|
|
242
401
|
}
|
|
243
402
|
}
|
|
244
403
|
})
|
|
245
|
-
}),
|
|
246
|
-
name:
|
|
404
|
+
}), L = "sort-named-imports", X = y({
|
|
405
|
+
name: L,
|
|
247
406
|
meta: {
|
|
248
407
|
type: "suggestion",
|
|
249
408
|
docs: {
|
|
250
|
-
description: "Enforce sorted
|
|
409
|
+
description: "Enforce sorted named imports",
|
|
251
410
|
recommended: !1
|
|
252
411
|
},
|
|
253
|
-
messages: {
|
|
254
|
-
unexpectedNamedImportsOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
255
|
-
},
|
|
256
412
|
fixable: "code",
|
|
257
413
|
schema: [
|
|
258
414
|
{
|
|
259
415
|
type: "object",
|
|
260
416
|
properties: {
|
|
261
417
|
type: {
|
|
262
|
-
enum: [
|
|
418
|
+
enum: [n.natural, n["line-length"]],
|
|
419
|
+
default: n.natural
|
|
263
420
|
},
|
|
264
421
|
order: {
|
|
265
|
-
enum: [
|
|
422
|
+
enum: [d.asc, d.desc],
|
|
423
|
+
default: d.asc
|
|
266
424
|
}
|
|
267
425
|
},
|
|
268
426
|
additionalProperties: !1
|
|
269
427
|
}
|
|
270
|
-
]
|
|
428
|
+
],
|
|
429
|
+
messages: {
|
|
430
|
+
unexpectedNamedImportsOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
431
|
+
}
|
|
271
432
|
},
|
|
272
433
|
defaultOptions: [
|
|
273
434
|
{
|
|
274
|
-
type:
|
|
275
|
-
order:
|
|
435
|
+
type: n.natural,
|
|
436
|
+
order: d.asc
|
|
276
437
|
}
|
|
277
438
|
],
|
|
278
|
-
create: (
|
|
439
|
+
create: (r) => ({
|
|
279
440
|
ImportDeclaration: (o) => {
|
|
280
|
-
let
|
|
281
|
-
type:
|
|
282
|
-
order:
|
|
441
|
+
let l = h(r.options.at(0), {
|
|
442
|
+
type: n.natural,
|
|
443
|
+
order: d.asc
|
|
283
444
|
});
|
|
284
445
|
if (o.specifiers.length > 1) {
|
|
285
|
-
let
|
|
446
|
+
let p = o.specifiers.map((s) => {
|
|
286
447
|
let {
|
|
287
|
-
range:
|
|
288
|
-
local: { name:
|
|
289
|
-
} =
|
|
448
|
+
range: e,
|
|
449
|
+
local: { name: t }
|
|
450
|
+
} = s;
|
|
290
451
|
return {
|
|
291
|
-
size:
|
|
292
|
-
node:
|
|
293
|
-
name:
|
|
452
|
+
size: E(e),
|
|
453
|
+
node: s,
|
|
454
|
+
name: t
|
|
294
455
|
};
|
|
295
456
|
});
|
|
296
|
-
for (let
|
|
297
|
-
let
|
|
298
|
-
if (
|
|
299
|
-
let
|
|
300
|
-
|
|
457
|
+
for (let s = 1; s < p.length; s++) {
|
|
458
|
+
let e = p.at(s - 1), t = p.at(s);
|
|
459
|
+
if (m(e, t, l)) {
|
|
460
|
+
let a = o.specifiers[s];
|
|
461
|
+
r.report({
|
|
301
462
|
messageId: "unexpectedNamedImportsOrder",
|
|
302
463
|
data: {
|
|
303
|
-
first:
|
|
304
|
-
second:
|
|
464
|
+
first: e.name,
|
|
465
|
+
second: t.name
|
|
305
466
|
},
|
|
306
|
-
node:
|
|
307
|
-
fix: (
|
|
308
|
-
let
|
|
309
|
-
return
|
|
467
|
+
node: a,
|
|
468
|
+
fix: (i) => {
|
|
469
|
+
let c = r.getSourceCode(), { text: u } = c;
|
|
470
|
+
return x(i, u, p, l);
|
|
310
471
|
}
|
|
311
472
|
});
|
|
312
473
|
}
|
|
@@ -314,66 +475,68 @@ const b = "sort-interfaces", _ = E({
|
|
|
314
475
|
}
|
|
315
476
|
}
|
|
316
477
|
})
|
|
317
|
-
}),
|
|
318
|
-
name:
|
|
478
|
+
}), j = "sort-union-types", k = y({
|
|
479
|
+
name: j,
|
|
319
480
|
meta: {
|
|
320
481
|
type: "suggestion",
|
|
321
482
|
docs: {
|
|
322
483
|
description: "Enforce sorted union types",
|
|
323
484
|
recommended: !1
|
|
324
485
|
},
|
|
325
|
-
messages: {
|
|
326
|
-
unexpectedUnionTypesOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
327
|
-
},
|
|
328
486
|
fixable: "code",
|
|
329
487
|
schema: [
|
|
330
488
|
{
|
|
331
489
|
type: "object",
|
|
332
490
|
properties: {
|
|
333
491
|
type: {
|
|
334
|
-
enum: [
|
|
492
|
+
enum: [n.natural, n["line-length"]],
|
|
493
|
+
default: n.natural
|
|
335
494
|
},
|
|
336
495
|
order: {
|
|
337
|
-
enum: [
|
|
496
|
+
enum: [d.asc, d.desc],
|
|
497
|
+
default: d.asc
|
|
338
498
|
}
|
|
339
499
|
},
|
|
340
500
|
additionalProperties: !1
|
|
341
501
|
}
|
|
342
|
-
]
|
|
502
|
+
],
|
|
503
|
+
messages: {
|
|
504
|
+
unexpectedUnionTypesOrder: 'Expected "{{second}}" to come before "{{first}}"'
|
|
505
|
+
}
|
|
343
506
|
},
|
|
344
507
|
defaultOptions: [
|
|
345
508
|
{
|
|
346
|
-
type:
|
|
347
|
-
order:
|
|
509
|
+
type: n.natural,
|
|
510
|
+
order: d.asc
|
|
348
511
|
}
|
|
349
512
|
],
|
|
350
|
-
create: (
|
|
513
|
+
create: (r) => ({
|
|
351
514
|
TSUnionType: (o) => {
|
|
352
|
-
let
|
|
353
|
-
type:
|
|
354
|
-
order:
|
|
355
|
-
}),
|
|
356
|
-
let { range:
|
|
515
|
+
let l = r.getSourceCode().text, p = h(r.options.at(0), {
|
|
516
|
+
type: n.natural,
|
|
517
|
+
order: d.asc
|
|
518
|
+
}), s = o.types.map((e) => {
|
|
519
|
+
let { range: t } = e, a = l.slice(...t);
|
|
357
520
|
return {
|
|
358
|
-
size:
|
|
359
|
-
node:
|
|
360
|
-
name:
|
|
521
|
+
size: E(t),
|
|
522
|
+
node: e,
|
|
523
|
+
name: a
|
|
361
524
|
};
|
|
362
525
|
});
|
|
363
|
-
for (let
|
|
364
|
-
let
|
|
365
|
-
if (
|
|
366
|
-
let
|
|
367
|
-
|
|
526
|
+
for (let e = 1; e < s.length; e++) {
|
|
527
|
+
let t = s.at(e - 1), a = s.at(e);
|
|
528
|
+
if (m(t, a, p)) {
|
|
529
|
+
let i = o.types[e];
|
|
530
|
+
r.report({
|
|
368
531
|
messageId: "unexpectedUnionTypesOrder",
|
|
369
532
|
data: {
|
|
370
|
-
first:
|
|
371
|
-
second:
|
|
533
|
+
first: t.name,
|
|
534
|
+
second: a.name
|
|
372
535
|
},
|
|
373
|
-
node:
|
|
374
|
-
fix: (
|
|
375
|
-
let
|
|
376
|
-
return
|
|
536
|
+
node: i,
|
|
537
|
+
fix: (c) => {
|
|
538
|
+
let u = r.getSourceCode(), { text: g } = u;
|
|
539
|
+
return x(c, g, s, p);
|
|
377
540
|
}
|
|
378
541
|
});
|
|
379
542
|
}
|
|
@@ -381,35 +544,45 @@ const b = "sort-interfaces", _ = E({
|
|
|
381
544
|
}
|
|
382
545
|
})
|
|
383
546
|
});
|
|
384
|
-
let
|
|
547
|
+
let C = (r) => {
|
|
385
548
|
let o = {
|
|
386
|
-
[
|
|
387
|
-
[
|
|
388
|
-
[
|
|
389
|
-
[
|
|
390
|
-
[
|
|
549
|
+
[N]: ["error", { spreadLast: !0 }],
|
|
550
|
+
[S]: ["error"],
|
|
551
|
+
[O]: ["error"],
|
|
552
|
+
[I]: ["error"],
|
|
553
|
+
[A]: ["error"],
|
|
554
|
+
[L]: ["error"],
|
|
555
|
+
[j]: ["error"]
|
|
391
556
|
};
|
|
392
557
|
return Object.fromEntries(
|
|
393
|
-
Object.entries(o).map(([
|
|
394
|
-
|
|
395
|
-
[
|
|
558
|
+
Object.entries(o).map(([l, [p, s = {}]]) => [
|
|
559
|
+
l,
|
|
560
|
+
[p, Object.assign(s, r)]
|
|
396
561
|
])
|
|
397
562
|
);
|
|
398
563
|
};
|
|
399
|
-
const
|
|
400
|
-
name:
|
|
564
|
+
const V = {
|
|
565
|
+
name: T,
|
|
401
566
|
rules: {
|
|
402
|
-
[
|
|
403
|
-
[
|
|
404
|
-
[
|
|
405
|
-
[
|
|
406
|
-
[
|
|
567
|
+
[N]: $,
|
|
568
|
+
[S]: v,
|
|
569
|
+
[O]: z,
|
|
570
|
+
[I]: _,
|
|
571
|
+
[A]: J,
|
|
572
|
+
[L]: X,
|
|
573
|
+
[j]: k
|
|
407
574
|
},
|
|
408
575
|
configs: {
|
|
409
|
-
"recommended-natural":
|
|
410
|
-
|
|
576
|
+
"recommended-natural": C({
|
|
577
|
+
type: n.natural,
|
|
578
|
+
order: d.asc
|
|
579
|
+
}),
|
|
580
|
+
"recommended-line-length": C({
|
|
581
|
+
type: n["line-length"],
|
|
582
|
+
order: d.desc
|
|
583
|
+
})
|
|
411
584
|
}
|
|
412
585
|
};
|
|
413
586
|
export {
|
|
414
|
-
|
|
587
|
+
V as default
|
|
415
588
|
};
|
package/license
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright 2023 Azat S. <to@azat.io>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-perfectionist",
|
|
3
3
|
"description": "ESLint plugin for code formatting in perfectionist style",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"homepage": "https://eslint-plugin-perfectionist.azat.io",
|
|
6
6
|
"repository": "azat-io/eslint-plugin-perfectionist",
|
|
7
7
|
"author": "Azat S. <to@azat.io>",
|
package/readme.md
CHANGED
|
@@ -22,13 +22,15 @@ npm install --save-dev eslint-plugin-perfectionist
|
|
|
22
22
|
|
|
23
23
|
## Rules
|
|
24
24
|
|
|
25
|
-
| Name
|
|
26
|
-
|
|
|
27
|
-
| [sort-
|
|
28
|
-
| [sort-
|
|
29
|
-
| [sort-
|
|
30
|
-
| [sort-
|
|
31
|
-
| [sort-
|
|
25
|
+
| Name | Description | 💼 | 🛠 |
|
|
26
|
+
| :------------------------------------------------------------------------------------------- | :------------------------------------------ | :-- | :-- |
|
|
27
|
+
| [sort-array-includes](https://eslint-plugin-perfectionist.azat.io/rules/sort-array-includes) | Enforce sorted arrays before include method | ✅ | 🔧 |
|
|
28
|
+
| [sort-interfaces](https://eslint-plugin-perfectionist.azat.io/rules/sort-interfaces) | Enforce sorted interface properties | ✅ | 🔧 |
|
|
29
|
+
| [sort-jsx-props](https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props) | Enforce sorted JSX props | ✅ | 🔧 |
|
|
30
|
+
| [sort-map-elements](https://eslint-plugin-perfectionist.azat.io/rules/sort-map-elements) | Enforce sorted Map elements | ✅ | 🔧 |
|
|
31
|
+
| [sort-named-exports](https://eslint-plugin-perfectionist.azat.io/rules/sort-named-exports) | Enforce sorted named exports | ✅ | 🔧 |
|
|
32
|
+
| [sort-named-imports](https://eslint-plugin-perfectionist.azat.io/rules/sort-named-imports) | Enforce sorted named imports | ✅ | 🔧 |
|
|
33
|
+
| [sort-union-types](https://eslint-plugin-perfectionist.azat.io/rules/sort-union-types) | Enforce sorted union types | ✅ | 🔧 |
|
|
32
34
|
|
|
33
35
|
## See also
|
|
34
36
|
|