@express-zod-api/migration 25.1.1 → 26.0.0-beta.2

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/README.md CHANGED
@@ -18,6 +18,6 @@ import migration from "@express-zod-api/migration";
18
18
 
19
19
  export default [
20
20
  { languageOptions: { parser }, plugins: { migration } },
21
- { files: ["**/*.ts"], rules: { "migration/v25": "error" } },
21
+ { files: ["**/*.ts"], rules: { "migration/v26": "error" } },
22
22
  ];
23
23
  ```
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
- import{AST_NODE_TYPES as e,ESLintUtils as t}from"@typescript-eslint/utils";const n={zod:`${e.ImportDeclaration}[source.value='zod/v4']`,dateInOutExample:`${e.CallExpression}[callee.object.name='ez'][callee.property.name=/date(In|Out)/] >${e.ObjectExpression} > ${e.Property}[key.name='example']`,getExamples:`${e.CallExpression}[callee.name='getExamples']`},r=e=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[n[r]]:e[r]}),{}),i=`v${`25.1.1`?.split(`.`)[0]??`0`}`,a=t.RuleCreator.withoutDocs({name:i,meta:{type:`problem`,fixable:`code`,schema:[],messages:{change:`change {{ subject }} from {{ from }} to {{ to }}`,add:`add {{ subject }} to {{ to }}`,move:`move {{ subject }} to {{ to }}`,remove:`remove {{ subject }}`}},defaultOptions:[],create:e=>r({zod:t=>e.report({node:t.source,messageId:`change`,data:{subject:`import`,from:`zod/v4`,to:`zod`},fix:e=>e.replaceText(t.source,`"zod"`)}),dateInOutExample:t=>e.report({node:t,messageId:`change`,data:{subject:`property`,from:`example`,to:`examples`},fix:n=>n.replaceText(t,`examples: [${e.sourceCode.getText(t.value)}]`)}),getExamples:t=>e.report({node:t,messageId:`change`,data:{subject:`method`,from:`getExamples()`,to:`.meta()?.examples || []`},fix:n=>n.replaceText(t,`(${e.sourceCode.getText(t.arguments[0])}.meta()?.examples || [])`)})})});var o={rules:{[i]:a}};export{o as default};
1
+ import{AST_NODE_TYPES as e,ESLintUtils as t}from"@typescript-eslint/utils";const n={dependsOnMethod:`${e.NewExpression}[callee.name='DependsOnMethod']`,handlerOptions:`${e.ObjectExpression} > ${e.Property}[key.name='handler'] > ${e.ArrowFunctionExpression} > ${e.ObjectPattern} > ${e.Property}[key.name='options']`,addOptions:`${e.CallExpression}:has( ${e.ArrowFunctionExpression} ) > ${e.MemberExpression} > ${e.Identifier}[name='addOptions']`,testMiddlewareOptions:`${e.CallExpression}[callee.name='testMiddleware'] > ${e.ObjectExpression} > ${e.Property}[key.name='options']`},r=t=>t.type===e.Property&&!t.computed&&(t.key.type===e.Identifier||t.key.type===e.Literal&&typeof t.key.value==`string`),i=t=>t.key.type===e.Identifier?t.key.name:t.key.value,a=e=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[n[r]]:e[r]}),{}),o=`v${`26.0.0-beta.2`?.split(`.`)[0]??`0`}`,s=t.RuleCreator.withoutDocs({meta:{type:`problem`,fixable:`code`,schema:[],messages:{change:`change {{ subject }} from {{ from }} to {{ to }}`,add:`add {{ subject }} to {{ to }}`,move:`move {{ subject }} to {{ to }}`,remove:`remove {{ subject }}`}},defaultOptions:[],create:t=>a({dependsOnMethod:n=>{if(n.arguments.length!==1)return;let a=n.arguments[0];if(a.type!==e.ObjectExpression)return;let o=!1,s,c=n;for(;c&&c.parent&&c.parent.type===e.MemberExpression&&c.parent.property.type===e.Identifier&&c.parent.parent&&c.parent.parent.type===e.CallExpression;){let t=c.parent.property.name,n=c.parent.parent;t===`deprecated`&&(o=!0),t===`nest`&&n.arguments[0]&&n.arguments[0].type===e.ObjectExpression&&(s=n.arguments[0]),c=n}t.report({node:c,messageId:`change`,data:{subject:`value`,from:`new DependsOnMethod(...)`,to:`its argument`},fix:e=>{let n=e=>n=>r(n)?`${e===`nest`?t.sourceCode.getText(n.key):i(n)}: ${t.sourceCode.getText(n.value)}${e===`deprecated`?`.deprecated()`:``},`:`${t.sourceCode.getText(n)}, /** @todo migrate manually */`,l=a.properties.map(n(o?`deprecated`:void 0)).concat(s?.properties.map(n(`nest`))??[]).join(`
2
+ `);return e.replaceText(c,`{\n${l}\n}`)}})},handlerOptions:e=>{t.report({node:e,messageId:`change`,data:{subject:`property`,from:`options`,to:`ctx`},fix:t=>t.replaceText(e.key,`ctx`)})},addOptions:e=>{t.report({node:e,messageId:`change`,data:{subject:`method`,from:`addOptions`,to:`addContext`},fix:t=>t.replaceText(e,`addContext`)})},testMiddlewareOptions:e=>{t.report({node:e,messageId:`change`,data:{subject:`property`,from:`options`,to:`ctx`},fix:t=>t.replaceText(e.key,`ctx`)})}})});var c={rules:{[o]:s}};export{c as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@express-zod-api/migration",
3
- "version": "25.1.1",
3
+ "version": "26.0.0-beta.2",
4
4
  "license": "MIT",
5
5
  "description": "Migration scripts for express-zod-api",
6
6
  "repository": {
@@ -28,15 +28,18 @@
28
28
  "dist",
29
29
  "*.md"
30
30
  ],
31
+ "engines": {
32
+ "node": "^20.19.0 || ^22.12.0 || ^24.0.0"
33
+ },
31
34
  "peerDependencies": {
32
35
  "eslint": "^9.0.0",
33
36
  "typescript-eslint": "^8.0.0"
34
37
  },
35
38
  "devDependencies": {
36
- "@typescript-eslint/rule-tester": "^8.35.1"
39
+ "@typescript-eslint/rule-tester": "^8.46.1"
37
40
  },
38
41
  "scripts": {
39
- "pretest": "tsc --noEmit",
42
+ "pretest": "tsc",
40
43
  "test": "vitest run --globals",
41
44
  "build": "tsdown"
42
45
  }