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 CHANGED
@@ -1 +1 @@
1
- "use strict";const h=require("@typescript-eslint/types"),j=require("@typescript-eslint/utils"),U=require("natural-compare-lite"),z="eslint-plugin-perfectionist",D="azat-io/eslint-plugin-perfectionist";let S=j.ESLintUtils.RuleCreator(t=>`https://github.com/${D}/blob/main/docs/rules/${t}.md`),x=t=>{let[n,a]=t;return a-n};var i=(t=>(t.natural="natural",t["line-length"]="line-length",t))(i||{}),l=(t=>(t.asc="asc",t.desc="desc",t))(l||{});let E=(t,n,a)=>(a.order==="asc"?1:-1)*(a.type===i.natural?U(t.name,n.name):t.size-n.size)>0,I=(t,n,a,d)=>{let e=[...a].sort((r,o)=>Number(E(r,o,d))||-1),s=r=>[r.range.at(0),r.range.at(1)];return a.map(({node:r},o)=>t.replaceTextRange(s(r),n.slice(...s(e[o].node))))},N=(t={},n)=>Object.assign(n,t);const T="sort-interfaces",$=S({name:T,meta:{type:"suggestion",docs:{description:"Enforce sorted interface properties",recommended:!1},messages:{unexpectedInterfacePropertiesOrder:'Expected "{{second}}" to come before "{{first}}"'},fixable:"code",schema:[{type:"object",properties:{type:{enum:[i.natural,i["line-length"]]},order:{enum:[l.asc,l.desc]}},additionalProperties:!1}]},defaultOptions:[{type:i.natural,order:l.asc}],create:t=>({TSInterfaceBody:n=>{let a=N(t.options.at(0),{type:i.natural,order:l.asc}),d=n.body.map(e=>{let s="",r=0,o=c=>{r+=c},p=c=>{o(x(c.key.range))},m=c=>{let{length:y}="[]";o(c.parameters.reduce((O,{range:R})=>O+x(R),y))},u=c=>{if(c.optional){let{length:y}="?";o(y)}},g=c=>{var O;let y=(O=c.typeAnnotation)==null?void 0:O.range;y&&o(x(y))},f=c=>{if(c.type===h.AST_NODE_TYPES.Identifier)({name:s}=c);else if(c.type===h.AST_NODE_TYPES.TSIndexSignature){let y=c.parameters.at(0);y&&f(y)}};return e.type===h.AST_NODE_TYPES.TSPropertySignature?(f(e.key),p(e),u(e),g(e)):e.type===h.AST_NODE_TYPES.TSIndexSignature&&(f(e),m(e),g(e)),{node:e,name:s,size:r}});for(let e=1;e<d.length;e++){let s=e-1,r=e,o=d.at(s),p=d.at(r);if(E(o,p,a)){let m=n.body[r];t.report({messageId:"unexpectedInterfacePropertiesOrder",data:{first:o.name,second:p.name},node:m,fix:u=>{let g=t.getSourceCode(),{text:f}=g;return I(u,f,d,a)}})}}}})}),b="sort-jsx-props",v=S({name:b,meta:{type:"suggestion",docs:{description:"Enforce sorted interface properties",recommended:!1},messages:{unexpectedJSXPropsOrder:'Expected "{{second}}" to come before "{{first}}"'},fixable:"code",schema:[{type:"object",properties:{type:{enum:[i.natural,i["line-length"]]},order:{enum:[l.asc,l.desc]}},additionalProperties:!1}]},defaultOptions:[{type:i.natural,order:l.asc}],create:t=>({JSXElement:n=>{let a=N(t.options.at(0),{type:i.natural,order:l.asc});n.openingElement.attributes.reduce((e,s)=>(s.type==="JSXAttribute"?e.at(-1).push(s):e.push([]),e),[[]]).forEach(e=>{let s=e.map(r=>({name:r.name.type===h.AST_NODE_TYPES.JSXNamespacedName?`${r.name.namespace.name}:${r.name.name.name}`:r.name.name,size:x(r.range),node:r}));for(let r=1;r<s.length;r++){let o=r-1,p=r,m=s.at(o),u=s.at(p);E(m,u,a)&&t.report({messageId:"unexpectedJSXPropsOrder",data:{first:m.name,second:u.name},node:u.node,fix:g=>{let f=t.getSourceCode(),{text:c}=f;return I(g,c,s,a)}})}})}})}),P="sort-named-exports",J=S({name:P,meta:{type:"suggestion",docs:{description:"Enforce sorted interface properties",recommended:!1},messages:{unexpectedNamedExportsOrder:'Expected "{{second}}" to come before "{{first}}"'},fixable:"code",schema:[{type:"object",properties:{type:{enum:[i.natural,i["line-length"]]},order:{enum:[l.asc,l.desc]}},additionalProperties:!1}]},defaultOptions:[{type:i.natural,order:l.asc}],create:t=>({ExportNamedDeclaration:n=>{let a=N(t.options.at(0),{type:i.natural,order:l.asc});if(n.specifiers.length>1){let d=n.specifiers.map(e=>{let{range:s,local:{name:r}}=e;return{size:x(s),node:e,name:r}});for(let e=1;e<d.length;e++){let s=e-1,r=e,o=d.at(s),p=d.at(r);if(E(o,p,a)){let m=n.specifiers[r];t.report({messageId:"unexpectedNamedExportsOrder",data:{first:o.name,second:p.name},node:m,fix:u=>{let g=t.getSourceCode(),{text:f}=g;return I(u,f,d,a)}})}}}}})}),_="sort-named-imports",L=S({name:_,meta:{type:"suggestion",docs:{description:"Enforce sorted interface properties",recommended:!1},messages:{unexpectedNamedImportsOrder:'Expected "{{second}}" to come before "{{first}}"'},fixable:"code",schema:[{type:"object",properties:{type:{enum:[i.natural,i["line-length"]]},order:{enum:[l.asc,l.desc]}},additionalProperties:!1}]},defaultOptions:[{type:i.natural,order:l.asc}],create:t=>({ImportDeclaration:n=>{let a=N(t.options.at(0),{type:i.natural,order:l.asc});if(n.specifiers.length>1){let d=n.specifiers.map(e=>{let{range:s,local:{name:r}}=e;return{size:x(s),node:e,name:r}});for(let e=1;e<d.length;e++){let s=e-1,r=e,o=d.at(s),p=d.at(r);if(E(o,p,a)){let m=n.specifiers[r];t.report({messageId:"unexpectedNamedImportsOrder",data:{first:o.name,second:p.name},node:m,fix:u=>{let g=t.getSourceCode(),{text:f}=g;return I(u,f,d,a)}})}}}}})}),A="sort-union-types",M=S({name:A,meta:{type:"suggestion",docs:{description:"Enforce sorted union types",recommended:!1},messages:{unexpectedUnionTypesOrder:'Expected "{{second}}" to come before "{{first}}"'},fixable:"code",schema:[{type:"object",properties:{type:{enum:[i.natural,i["line-length"]]},order:{enum:[l.asc,l.desc]}},additionalProperties:!1}]},defaultOptions:[{type:i.natural,order:l.asc}],create:t=>({TSUnionType:n=>{let a=t.getSourceCode().text,d=N(t.options.at(0),{type:i.natural,order:l.asc}),e=n.types.map(s=>{let{range:r}=s,o=a.slice(...r);return{size:x(r),node:s,name:o}});for(let s=1;s<e.length;s++){let r=s-1,o=s,p=e.at(r),m=e.at(o);if(E(p,m,d)){let u=n.types[o];t.report({messageId:"unexpectedUnionTypesOrder",data:{first:p.name,second:m.name},node:u,fix:g=>{let f=t.getSourceCode(),{text:c}=f;return I(g,c,e,d)}})}}}})});let C=t=>{let n={[T]:["error"],[b]:["error"],[P]:["error"],[_]:["error"],[A]:["error"]};return Object.fromEntries(Object.entries(n).map(([a,[d,e={}]])=>[a,[d,Object.assign(e,t)]]))};const X={name:z,rules:{[T]:$,[b]:v,[P]:J,[_]:L,[A]:M},configs:{"recommended-natural":C({type:"natural",order:"asc"}),"recommended-line-length":C({type:"line-length",order:"desc"})}};module.exports=X;
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 I } from "@typescript-eslint/types";
2
- import { ESLintUtils as U } from "@typescript-eslint/utils";
3
- import z from "natural-compare-lite";
4
- const $ = "eslint-plugin-perfectionist", v = "azat-io/eslint-plugin-perfectionist";
5
- let E = U.RuleCreator(
6
- (t) => `https://github.com/${v}/blob/main/docs/rules/${t}.md`
7
- ), y = (t) => {
8
- let [o, a] = t;
9
- return a - o;
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 i = /* @__PURE__ */ ((t) => (t.natural = "natural", t["line-length"] = "line-length", t))(i || {}), l = /* @__PURE__ */ ((t) => (t.asc = "asc", t.desc = "desc", t))(l || {});
12
- let h = (t, o, a) => (a.order === "asc" ? 1 : -1) * (a.type === i.natural ? z(t.name, o.name) : t.size - o.size) > 0, N = (t, o, a, d) => {
13
- let e = [...a].sort((r, n) => Number(h(r, n, d)) || -1), s = (r) => [r.range.at(0), r.range.at(1)];
14
- return a.map(
15
- ({ node: r }, n) => t.replaceTextRange(s(r), o.slice(...s(e[n].node)))
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
- }, O = (t = {}, o) => Object.assign(o, t);
18
- const b = "sort-interfaces", _ = E({
19
- name: b,
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 interface properties",
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
- unexpectedInterfacePropertiesOrder: 'Expected "{{second}}" to come before "{{first}}"'
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: [i.natural, i["line-length"]]
112
+ enum: [n.natural, n["line-length"]],
113
+ default: n.natural
36
114
  },
37
115
  order: {
38
- enum: [l.asc, l.desc]
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: i.natural,
48
- order: l.asc
129
+ type: n.natural,
130
+ order: d.asc
49
131
  }
50
132
  ],
51
- create: (t) => ({
133
+ create: (r) => ({
52
134
  TSInterfaceBody: (o) => {
53
- let a = O(t.options.at(0), {
54
- type: i.natural,
55
- order: l.asc
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
- for (let e = 1; e < d.length; e++) {
88
- let s = e - 1, r = e, n = d.at(s), p = d.at(r);
89
- if (h(n, p, a)) {
90
- let m = o.body[r];
91
- t.report({
92
- messageId: "unexpectedInterfacePropertiesOrder",
93
- data: {
94
- first: n.name,
95
- second: p.name
96
- },
97
- node: m,
98
- fix: (u) => {
99
- let g = t.getSourceCode(), { text: f } = g;
100
- return N(u, f, d, a);
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
- }), C = "sort-jsx-props", J = E({
108
- name: C,
184
+ }), O = "sort-jsx-props", z = y({
185
+ name: O,
109
186
  meta: {
110
187
  type: "suggestion",
111
188
  docs: {
112
- description: "Enforce sorted interface properties",
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: [i.natural, i["line-length"]]
198
+ enum: [n.natural, n["line-length"]],
199
+ default: n.natural
125
200
  },
126
201
  order: {
127
- enum: [l.asc, l.desc]
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: i.natural,
137
- order: l.asc
215
+ type: n.natural,
216
+ order: d.asc
138
217
  }
139
218
  ],
140
- create: (t) => ({
219
+ create: (r) => ({
141
220
  JSXElement: (o) => {
142
- let a = O(t.options.at(0), {
143
- type: i.natural,
144
- order: l.asc
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
- (e, s) => (s.type === "JSXAttribute" ? e.at(-1).push(s) : e.push([]), e),
226
+ (s, e) => (e.type === "JSXAttribute" ? s.at(-1).push(e) : s.push([]), s),
148
227
  [[]]
149
- ).forEach((e) => {
150
- let s = e.map((r) => ({
151
- name: r.name.type === I.JSXNamespacedName ? `${r.name.namespace.name}:${r.name.name.name}` : r.name.name,
152
- size: y(r.range),
153
- node: r
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 r = 1; r < s.length; r++) {
156
- let n = r - 1, p = r, m = s.at(n), u = s.at(p);
157
- h(m, u, a) && t.report({
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: m.name,
161
- second: u.name
239
+ first: a.name,
240
+ second: i.name
162
241
  },
163
- node: u.node,
164
- fix: (g) => {
165
- let f = t.getSourceCode(), { text: c } = f;
166
- return N(g, c, s, a);
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
- }), R = "sort-named-exports", L = E({
174
- name: R,
252
+ }), I = "sort-map-elements", _ = y({
253
+ name: I,
175
254
  meta: {
176
255
  type: "suggestion",
177
256
  docs: {
178
- description: "Enforce sorted interface properties",
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
- unexpectedNamedExportsOrder: 'Expected "{{second}}" to come before "{{first}}"'
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: [i.natural, i["line-length"]]
344
+ enum: [n.natural, n["line-length"]],
345
+ default: n.natural
191
346
  },
192
347
  order: {
193
- enum: [l.asc, l.desc]
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: i.natural,
203
- order: l.asc
361
+ type: n.natural,
362
+ order: d.asc
204
363
  }
205
364
  ],
206
- create: (t) => ({
365
+ create: (r) => ({
207
366
  ExportNamedDeclaration: (o) => {
208
- let a = O(t.options.at(0), {
209
- type: i.natural,
210
- order: l.asc
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 d = o.specifiers.map((e) => {
372
+ let p = o.specifiers.map((s) => {
214
373
  let {
215
- range: s,
216
- local: { name: r }
217
- } = e;
374
+ range: e,
375
+ local: { name: t }
376
+ } = s;
218
377
  return {
219
- size: y(s),
220
- node: e,
221
- name: r
378
+ size: E(e),
379
+ node: s,
380
+ name: t
222
381
  };
223
382
  });
224
- for (let e = 1; e < d.length; e++) {
225
- let s = e - 1, r = e, n = d.at(s), p = d.at(r);
226
- if (h(n, p, a)) {
227
- let m = o.specifiers[r];
228
- t.report({
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: n.name,
232
- second: p.name
390
+ first: e.name,
391
+ second: t.name
233
392
  },
234
- node: m,
235
- fix: (u) => {
236
- let g = t.getSourceCode(), { text: f } = g;
237
- return N(u, f, d, a);
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
- }), T = "sort-named-imports", M = E({
246
- name: T,
404
+ }), L = "sort-named-imports", X = y({
405
+ name: L,
247
406
  meta: {
248
407
  type: "suggestion",
249
408
  docs: {
250
- description: "Enforce sorted interface properties",
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: [i.natural, i["line-length"]]
418
+ enum: [n.natural, n["line-length"]],
419
+ default: n.natural
263
420
  },
264
421
  order: {
265
- enum: [l.asc, l.desc]
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: i.natural,
275
- order: l.asc
435
+ type: n.natural,
436
+ order: d.asc
276
437
  }
277
438
  ],
278
- create: (t) => ({
439
+ create: (r) => ({
279
440
  ImportDeclaration: (o) => {
280
- let a = O(t.options.at(0), {
281
- type: i.natural,
282
- order: l.asc
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 d = o.specifiers.map((e) => {
446
+ let p = o.specifiers.map((s) => {
286
447
  let {
287
- range: s,
288
- local: { name: r }
289
- } = e;
448
+ range: e,
449
+ local: { name: t }
450
+ } = s;
290
451
  return {
291
- size: y(s),
292
- node: e,
293
- name: r
452
+ size: E(e),
453
+ node: s,
454
+ name: t
294
455
  };
295
456
  });
296
- for (let e = 1; e < d.length; e++) {
297
- let s = e - 1, r = e, n = d.at(s), p = d.at(r);
298
- if (h(n, p, a)) {
299
- let m = o.specifiers[r];
300
- t.report({
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: n.name,
304
- second: p.name
464
+ first: e.name,
465
+ second: t.name
305
466
  },
306
- node: m,
307
- fix: (u) => {
308
- let g = t.getSourceCode(), { text: f } = g;
309
- return N(u, f, d, a);
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
- }), P = "sort-union-types", X = E({
318
- name: P,
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: [i.natural, i["line-length"]]
492
+ enum: [n.natural, n["line-length"]],
493
+ default: n.natural
335
494
  },
336
495
  order: {
337
- enum: [l.asc, l.desc]
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: i.natural,
347
- order: l.asc
509
+ type: n.natural,
510
+ order: d.asc
348
511
  }
349
512
  ],
350
- create: (t) => ({
513
+ create: (r) => ({
351
514
  TSUnionType: (o) => {
352
- let a = t.getSourceCode().text, d = O(t.options.at(0), {
353
- type: i.natural,
354
- order: l.asc
355
- }), e = o.types.map((s) => {
356
- let { range: r } = s, n = a.slice(...r);
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: y(r),
359
- node: s,
360
- name: n
521
+ size: E(t),
522
+ node: e,
523
+ name: a
361
524
  };
362
525
  });
363
- for (let s = 1; s < e.length; s++) {
364
- let r = s - 1, n = s, p = e.at(r), m = e.at(n);
365
- if (h(p, m, d)) {
366
- let u = o.types[n];
367
- t.report({
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: p.name,
371
- second: m.name
533
+ first: t.name,
534
+ second: a.name
372
535
  },
373
- node: u,
374
- fix: (g) => {
375
- let f = t.getSourceCode(), { text: c } = f;
376
- return N(g, c, e, d);
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 j = (t) => {
547
+ let C = (r) => {
385
548
  let o = {
386
- [b]: ["error"],
387
- [C]: ["error"],
388
- [R]: ["error"],
389
- [T]: ["error"],
390
- [P]: ["error"]
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(([a, [d, e = {}]]) => [
394
- a,
395
- [d, Object.assign(e, t)]
558
+ Object.entries(o).map(([l, [p, s = {}]]) => [
559
+ l,
560
+ [p, Object.assign(s, r)]
396
561
  ])
397
562
  );
398
563
  };
399
- const B = {
400
- name: $,
564
+ const V = {
565
+ name: T,
401
566
  rules: {
402
- [b]: _,
403
- [C]: J,
404
- [R]: L,
405
- [T]: M,
406
- [P]: X
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": j({ type: "natural", order: "asc" }),
410
- "recommended-line-length": j({ type: "line-length", order: "desc" })
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
- B as default
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.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 | Description | 💼 | 🛠 |
26
- | :----------------------------------------------------------------------------------------- | :---------------------------------- | :-- | :-- |
27
- | [sort-interfaces](https://eslint-plugin-perfectionist.azat.io/rules/sort-interfaces) | Enforce sorted interface properties | ✅ | 🔧 |
28
- | [sort-jsx-props](https://eslint-plugin-perfectionist.azat.io/rules/sort-jsx-props) | Enforce sorted JSX props | ✅ | 🔧 |
29
- | [sort-named-exports](https://eslint-plugin-perfectionist.azat.io/rules/sort-named-exports) | Enforce sorted named exports | ✅ | 🔧 |
30
- | [sort-named-imports](https://eslint-plugin-perfectionist.azat.io/rules/sort-named-imports) | Enforce sorted named imports | ✅ | 🔧 |
31
- | [sort-union-types](https://eslint-plugin-perfectionist.azat.io/rules/sort-union-types) | Enforce sorted union types | ✅ | 🔧 |
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