@longzai-intelligence-oxlint/stylistic-plugin 0.1.12 → 0.1.13

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
@@ -2,5 +2,5 @@ import{defineRule as e,eslintCompatPlugin as t}from"@oxlint/plugins";function n(
2
2
  `)}})}}function N(e,t,n,r,i){let a=e.type===`Block`;if(a&&n.afterBlockComment||!a&&n.afterLineComment){if(j(i,n))return;let o=e.loc.end.line;k(o,t)||r.report({loc:{start:e.loc.end,end:e.loc.end},message:a?`块注释后需要空行`:`行注释后需要空行`,fix:t=>t.insertTextAfterRange([e.range[1],e.range[1]],`
3
3
  `)})}}function P(e,t,n,r,i=[],a=!1,o=!1){if(y(e,t)||S(e,n))return;let s=b(e,i),c=p(e,t),l=h(e,t)||g(e,t);!a&&!s&&!l&&M(e,t,n,r,c),o||N(e,t,n,r,c)}const F=e({meta:{type:`layout`,fixable:`whitespace`,docs:{description:`要求在注释前后有空行`},schema:[{type:`object`,properties:{beforeBlockComment:{type:`boolean`},afterBlockComment:{type:`boolean`},beforeLineComment:{type:`boolean`},afterLineComment:{type:`boolean`},allowBlockStart:{type:`boolean`},allowBlockEnd:{type:`boolean`},allowObjectStart:{type:`boolean`},allowObjectEnd:{type:`boolean`},allowArrayStart:{type:`boolean`},allowArrayEnd:{type:`boolean`},allowClassStart:{type:`boolean`},allowClassEnd:{type:`boolean`},allowInterfaceStart:{type:`boolean`},allowInterfaceEnd:{type:`boolean`},allowTypeStart:{type:`boolean`},allowTypeEnd:{type:`boolean`},allowEnumStart:{type:`boolean`},allowEnumEnd:{type:`boolean`},allowModuleStart:{type:`boolean`},allowModuleEnd:{type:`boolean`},allowFunctionStart:{type:`boolean`},allowFunctionEnd:{type:`boolean`},ignorePattern:{type:`string`},applyDefaultIgnorePatterns:{type:`boolean`}},additionalProperties:!1}]},createOnce(e){let t=[],n=[];return{Program(){let r=D(e.options?.[0]);t=e.sourceCode.text.split(`
4
4
  `),n=[];let i=e.sourceCode.getAllComments();for(let a=0;a<i.length;a++){let o=i[a];if(!o)continue;let s=i[a+1],c=s!==void 0&&s.loc.start.line<=o.loc.end.line+1;P(o,t,r,e,n,!1,c),n.push(o)}}}}}),I=e({meta:{type:`layout`,docs:{description:`强制多行注释使用星号块样式`}},createOnce(e){return{Program(t){let n=e.sourceCode.getAllComments();for(let t of n){if(t.type!==`Block`)continue;let n=t.value;if(!n.startsWith(`*`))continue;let r=n.split(`
5
- `);if(!(r.length<=1))for(let n=1;n<r.length-1;n++){let i=r[n]?.trim();if(i&&!i.startsWith(`*`)){e.report({loc:{start:t.loc.start,end:t.loc.end},message:`多行注释的中间行应以 "*" 开头`});break}}}}}}});function L(e){return e.type===`ExportNamedDeclaration`||e.type===`ExportDefaultDeclaration`||e.type===`ExportAllDeclaration`}function R(e,t,n){if(n-t<=1)return!1;for(let r=t+1;r<n;r++)if(e[r-1]?.trim()===``)return!0;return!1}function z(e){return e.type===`Program`}function B(e,t,n){for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r];if(!(i===void 0||a===void 0)&&L(i)&&L(a)){let e=i.loc.end.line,r=a.loc.start.line;R(t,e,r)||n.report({loc:a.loc.start,message:`export 语句之间需要空行`})}}}const V={"multiline-comment-style":I,"lines-around-comment":F,"padding-line-between-statements":e({meta:{type:`layout`,docs:{description:`要求在 export 语句之间有空行`}},createOnce(e){return{Program(t){let n=e.sourceCode.text.split(`
5
+ `);if(!(r.length<=1))for(let n=1;n<r.length-1;n++){let i=r[n]?.trim();if(i&&!i.startsWith(`*`)){e.report({loc:{start:t.loc.start,end:t.loc.end},message:`多行注释的中间行应以 "*" 开头`});break}}}}}}});function L(e){return e.type===`ExportNamedDeclaration`||e.type===`ExportDefaultDeclaration`||e.type===`ExportAllDeclaration`}function R(e,t,n){if(n-t<=1)return!1;for(let r=t+1;r<n;r++)if(e[r-1]?.trim()===``)return!0;return!1}function z(e){return e.type===`Program`}function B(e,t,n){for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r];if(i!==void 0&&a!==void 0&&L(i)&&L(a)){let e=i.loc.end.line,r=a.loc.start.line;R(t,e,r)||n.report({loc:a.loc.start,message:`export 语句之间需要空行`})}}}const V={"multiline-comment-style":I,"lines-around-comment":F,"padding-line-between-statements":e({meta:{type:`layout`,docs:{description:`要求在 export 语句之间有空行`}},createOnce(e){return{Program(t){let n=e.sourceCode.text.split(`
6
6
  `),r=z(t)?t:null;r&&B(r.body,n,e)}}}})},H=t({meta:{name:`@longzai-intelligence-oxlint/stylistic-plugin`},rules:V});export{H as default,H as stylisticPlugin,V as stylisticRules};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longzai-intelligence-oxlint/stylistic-plugin",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Oxlint stylistic 兼容插件,提供 @stylistic 规则的 Oxlint 实现",
5
5
  "license": "UNLICENSED",
6
6
  "files": [
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@longzai-intelligence-logger/node": "^0.1.1",
40
- "@longzai-intelligence-oxlint/core": "0.1.12",
40
+ "@longzai-intelligence-oxlint/core": "0.1.13",
41
41
  "@oxlint/plugins": "^1.74.0"
42
42
  },
43
43
  "devDependencies": {