@longzai-intelligence-oxlint/react-plugin 0.1.35 → 0.1.37

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=/\/hooks\//,r=/^use-[a-z][-a-z0-9]*(?:\.hook)?\.tsx?$/,i=/\.hook\.tsx?$/,a=/^use[A-Za-z-]*\.types\.ts$/;function o(e){return`${e.replace(/\.tsx?$/,``).replace(/\.hook$/,``).split(`-`).map((e,t)=>t===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join(``)}${e.endsWith(`.tsx`)?`.tsx`:`.ts`}`}const s=e({meta:{type:`problem`,docs:{description:`检测 hooks/ 目录下不规范的 hook 文件命名`}},createOnce(e){return{before(){let t=e.filename.replace(/\\/g,`/`);if(!n.test(t))return!1},Program(t){let s=e.filename.replace(/\\/g,`/`);if(!n.test(s))return;let c=s.split(`/`).pop()??``;if(r.test(c)){let n=o(c);e.report({node:t,message:`Hook 文件命名违规: ${c} 使用了 kebab-case。应使用 camelCase,如 ${n}`});return}if(i.test(c)){let n=c.replace(/\.hook(\.tsx?)$/,`$1`);e.report({node:t,message:`Hook 文件命名违规: ${c} 使用了 .hook 后缀。应移除 .hook 后缀,如 ${n}`});return}if(a.test(c)){e.report({node:t,message:`Hook 文件命名违规: ${c}。类型文件不应以 use 开头`});return}}}}}),c=t({meta:{name:`@longzai-intelligence-oxlint/react-plugin`},rules:{"no-incorrect-hook-naming":s}});export{c as default,c as reactPlugin,s as noIncorrectHookNamingRule};
1
+ import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";const n=/\/hooks\//,r=/^use-[a-z][-a-z0-9]*(?:\.hook)?\.tsx?$/,i=/\.hook\.tsx?$/,a=/^use[A-Za-z-]*\.types\.ts$/;function o(e){return`${e.replace(/\.tsx?$/,``).replace(/\.hook$/,``).split(`-`).map((e,t)=>t===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join(``)}${e.endsWith(`.tsx`)?`.tsx`:`.ts`}`}const s=e({meta:{type:`problem`,docs:{description:`检测 hooks/ 目录下不规范的 hook 文件命名`}},createOnce(e){return{before(){let t=e.filename.replace(/\\/g,`/`);if(!n.test(t))return!1},Program(t){let s=e.filename.replace(/\\/g,`/`);if(!n.test(s))return;let c=s.split(`/`).pop()??``;if(r.test(c)){let n=o(c);e.report({node:t,message:`Hook 文件命名违规: ${c} 使用了 kebab-case。应使用 camelCase,如 ${n}`})}else if(i.test(c)){let n=c.replace(/\.hook(\.tsx?)$/,`$1`);e.report({node:t,message:`Hook 文件命名违规: ${c} 使用了 .hook 后缀。应移除 .hook 后缀,如 ${n}`})}else a.test(c)&&e.report({node:t,message:`Hook 文件命名违规: ${c}。类型文件不应以 use 开头`})}}}}),c=t({meta:{name:`@longzai-intelligence-oxlint/react-plugin`},rules:{"no-incorrect-hook-naming":s}});export{c as default,c as reactPlugin,s as noIncorrectHookNamingRule};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-oxlint/react-plugin",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "description": "Longzai Intelligence oxlint React 规则插件",
5
5
  "keywords": [
6
6
  "longzai-intelligence",
@@ -43,7 +43,7 @@
43
43
  "typecheck:test": "lzi-tsgo typecheck tsconfig/test.json"
44
44
  },
45
45
  "dependencies": {
46
- "@longzai-intelligence-oxlint/core": "0.1.35",
46
+ "@longzai-intelligence-oxlint/core": "0.1.37",
47
47
  "@oxlint/plugins": "^1.74.0"
48
48
  },
49
49
  "devDependencies": {