@2digits/eslint-plugin 3.2.3 → 3.2.5
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.mjs +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as e,match as t}from"ts-pattern";var n=`3.2.
|
|
1
|
+
import{P as e,match as t}from"ts-pattern";var n=`3.2.5`,r={type:`git`,url:`https://github.com/2digits-agency/configs.git`,directory:`packages/eslint-plugin`};const i={rules:{"@2digits/type-param-names":`error`}},a=/^(?:\(.*\)|\\?.)$/;function o(e){let t=e.toString();return a.test(t)?t:`(?:${t})`}const s=/^(?:\(\?:(.+)\)|(.+))$/,c=/^(?:\(\?:(.+)\)([?+*]|\{[\d,]+\})?|(.+))$/;function l(e){let t=t=>l(`(?<${t}>${`${e}`.replace(s,`$1$2`)})`);return{toString:()=>e.toString(),and:Object.assign((...t)=>l(`${e}${g(...t)}`),{referenceTo:t=>l(`${e}\\k<${t}>`)}),or:(...t)=>l(`(?:${e}|${t.map(e=>g(e)).join(`|`)})`),after:(...t)=>l(`(?<=${g(...t)})${e}`),before:(...t)=>l(`${e}(?=${g(...t)})`),notAfter:(...t)=>l(`(?<!${g(...t)})${e}`),notBefore:(...t)=>l(`${e}(?!${g(...t)})`),times:Object.assign(t=>l(`${o(e)}{${t}}`),{any:()=>l(`${o(e)}*`),atLeast:t=>l(`${o(e)}{${t},}`),atMost:t=>l(`${o(e)}{0,${t}}`),between:(t,n)=>l(`${o(e)}{${t},${n}}`)}),optionally:()=>l(`${o(e)}?`),as:t,groupedAs:t,grouped:()=>l(`${e}`.replace(c,`($1$3)$2`)),at:{lineStart:()=>l(`^${e}`),lineEnd:()=>l(`${e}$`)}}}const u=/[.*+?^${}()|[\]\\/]/g;function d(e){let t=l(`[${e}]`),n=(t,n)=>d(`${e}${f(t)}-${f(n)}`),r=Object.assign(t=>d(`${e}${f(t)}`),{from:n});return Object.assign(t,{orChar:r,from:n})}function f(e){return e.replace(/[-\\^\]]/g,`\\$&`)}Object.assign(e=>d(f(e)),d(``)),Object.assign(e=>d(`^${f(e)}`),d(`^`));function p(...e){return l(`(?:${e.map(e=>g(e)).join(`|`)})`)}l(`.`),l(`\\b\\w+\\b`),l(`\\w`),l(`\\b`);const m=l(`\\d`);l(`\\s`);const h=Object.assign(l(`[a-zA-Z]`),{lowercase:l(`[a-z]`),uppercase:l(`[A-Z]`)});l(`\\t`),l(`\\n`),l(`\\r`),l(`\\W+`),l(`\\W`),l(`\\B`),l(`\\D`),l(`\\S`),Object.assign(l(`[^a-zA-Z]`),{lowercase:l(`[^a-z]`),uppercase:l(`[^A-Z]`)}),l(`[^\\t]`),l(`[^\\n]`),l(`[^\\r]`);function g(...e){return l(e.map(e=>typeof e==`string`?e.replace(u,`\\$&`):e).join(``))}function _(...e){return l(`${o(g(...e))}+`)}const v=(...e)=>{let t=e.length>1&&(Array.isArray(e[e.length-1])||e[e.length-1]instanceof Set)?e.pop():void 0;return new RegExp(g(...e).toString(),[...t||``].join(``))},y=`${r.url.replaceAll(`.git`,``)}/tree/main/${r.directory}/src/rules`;function b(e){return function({name:t,meta:n,...r}){return x({meta:{...n,docs:{...n.docs,url:e(t)}},...r})}}function x({create:e,defaultOptions:t,meta:n}){return{create:(n=>e(n,n.options.map((e,n)=>({...t[n],...e})))),defaultOptions:t,meta:n}}const S=b(e=>`${y}${e}.ts`),C=v(p(`T`,`$`).at.lineStart()),w=v(p(`T`,`$`).at.lineStart(),h.uppercase),T=v(p(`T`,`$`).at.lineStart(),h.uppercase,_(h)),E=v(p(`T`,`$`).at.lineStart(),h.uppercase,_(h),m.times.any().at.lineEnd()),D={prefix:`prefix`,initial:`initial`,remainder:`remainder`,regex:`regex`},O=S({name:`type-param-names`,meta:{type:`suggestion`,docs:{description:`Enforce giving proper names to type parameters when there are two or more`},schema:[],messages:{prefix:`Type parameter {{name}} should have a prefix of "T" or "$"`,initial:`Type parameter {{name}}'s name should start with an uppercase letter`,remainder:`Type parameter {{name}}'s name should contain at least one lowercase letter`,regex:`Type parameter {{name}} should match the regex {{regex}}`}},defaultOptions:[],create(e){return{TSTypeParameterDeclaration(t){let{params:n}=t;if(!(n.length===1&&n.at(0)?.name.name===`T`))for(let t of n){let{name:n}=t.name,r=N(n);r&&e.report({node:t,messageId:r,data:{name:n}})}}}}}),k=e.string.regex(E),A=e.not(e.string.regex(C)),j=e.not(e.string.regex(w)),M=e.not(e.string.regex(T));function N(e){return t(e).with(k,()=>!1).with(A,()=>D.prefix).with(j,()=>D.initial).with(M,()=>D.remainder).otherwise(()=>!1)}const P={meta:{name:`@2digits`,version:n},rules:{"type-param-names":O},configs:{recommended:{plugins:{"@2digits":{}},rules:i.rules}}};P.configs.recommended.plugins[`@2digits`]=P;var F=P;export{F as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2digits/eslint-plugin",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5",
|
|
4
4
|
"description": "An eslint plugin that provides a set of rules to enforce best practices for 2digits projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"public": true,
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@typescript-eslint/utils": "8.
|
|
30
|
+
"@typescript-eslint/utils": "8.47.0",
|
|
31
31
|
"eslint": "9.39.1",
|
|
32
32
|
"ts-pattern": "5.9.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@typescript-eslint/parser": "8.
|
|
35
|
+
"@typescript-eslint/parser": "8.47.0",
|
|
36
36
|
"eslint-vitest-rule-tester": "3.0.0",
|
|
37
37
|
"magic-regexp": "0.10.0",
|
|
38
|
-
"tsdown": "0.16.
|
|
38
|
+
"tsdown": "0.16.1",
|
|
39
39
|
"typescript": "5.9.3",
|
|
40
|
-
"vitest": "4.0.
|
|
40
|
+
"vitest": "4.0.10",
|
|
41
41
|
"@2digits/tsconfig": "0.8.4"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|