@shell-shock/eslint-plugin 0.0.14 → 0.0.16

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 (63) hide show
  1. package/README.md +1 -1
  2. package/dist/configs/base.cjs +1 -1
  3. package/dist/configs/base.d.cts +2 -1
  4. package/dist/configs/base.d.cts.map +1 -0
  5. package/dist/configs/base.d.mts +2 -1
  6. package/dist/configs/base.d.mts.map +1 -0
  7. package/dist/configs/base.mjs +2 -1
  8. package/dist/configs/base.mjs.map +1 -0
  9. package/dist/configs/index.d.cts +2 -1
  10. package/dist/configs/index.d.cts.map +1 -0
  11. package/dist/configs/index.d.mts +2 -1
  12. package/dist/configs/index.d.mts.map +1 -0
  13. package/dist/configs/index.mjs +2 -1
  14. package/dist/configs/index.mjs.map +1 -0
  15. package/dist/helpers/create-rule.cjs +1 -1
  16. package/dist/helpers/create-rule.d.cts +2 -1
  17. package/dist/helpers/create-rule.d.cts.map +1 -0
  18. package/dist/helpers/create-rule.d.mts +2 -1
  19. package/dist/helpers/create-rule.d.mts.map +1 -0
  20. package/dist/helpers/create-rule.mjs +2 -1
  21. package/dist/helpers/create-rule.mjs.map +1 -0
  22. package/dist/index.d.cts +2 -1
  23. package/dist/index.d.cts.map +1 -0
  24. package/dist/index.d.mts +2 -1
  25. package/dist/index.d.mts.map +1 -0
  26. package/dist/index.mjs +2 -1
  27. package/dist/index.mjs.map +1 -0
  28. package/dist/package.cjs +1 -1
  29. package/dist/package.mjs +2 -1
  30. package/dist/package.mjs.map +1 -0
  31. package/dist/plugin.cjs +1 -1
  32. package/dist/plugin.d.cts +5 -2
  33. package/dist/plugin.d.cts.map +1 -0
  34. package/dist/plugin.d.mts +5 -2
  35. package/dist/plugin.d.mts.map +1 -0
  36. package/dist/plugin.mjs +2 -1
  37. package/dist/plugin.mjs.map +1 -0
  38. package/dist/rules/duplicate-command-path.cjs +2 -0
  39. package/dist/rules/duplicate-command-path.d.cts +10 -0
  40. package/dist/rules/duplicate-command-path.d.cts.map +1 -0
  41. package/dist/rules/duplicate-command-path.d.mts +10 -0
  42. package/dist/rules/duplicate-command-path.d.mts.map +1 -0
  43. package/dist/rules/duplicate-command-path.mjs +3 -0
  44. package/dist/rules/duplicate-command-path.mjs.map +1 -0
  45. package/dist/rules/invalid-command-export.cjs +1 -0
  46. package/dist/rules/invalid-command-export.d.cts +10 -0
  47. package/dist/rules/invalid-command-export.d.cts.map +1 -0
  48. package/dist/rules/invalid-command-export.d.mts +10 -0
  49. package/dist/rules/invalid-command-export.d.mts.map +1 -0
  50. package/dist/rules/invalid-command-export.mjs +2 -0
  51. package/dist/rules/invalid-command-export.mjs.map +1 -0
  52. package/dist/rules/invalid-handler-params.cjs +1 -0
  53. package/dist/rules/invalid-handler-params.d.cts +10 -0
  54. package/dist/rules/invalid-handler-params.d.cts.map +1 -0
  55. package/dist/rules/invalid-handler-params.d.mts +10 -0
  56. package/dist/rules/invalid-handler-params.d.mts.map +1 -0
  57. package/dist/rules/invalid-handler-params.mjs +2 -0
  58. package/dist/rules/invalid-handler-params.mjs.map +1 -0
  59. package/package.json +117 -21
  60. package/dist/rules/invalid-command-path.cjs +0 -1
  61. package/dist/rules/invalid-command-path.d.cts +0 -9
  62. package/dist/rules/invalid-command-path.d.mts +0 -9
  63. package/dist/rules/invalid-command-path.mjs +0 -1
package/README.md CHANGED
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
27
27
 
28
28
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
29
29
 
30
- [![Version](https://img.shields.io/badge/version-0.0.12-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/shell-shock/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/shell-shock/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
30
+ [![Version](https://img.shields.io/badge/version-0.0.14-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/shell-shock/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/shell-shock/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
31
 
32
32
  <!-- prettier-ignore-start -->
33
33
  <!-- markdownlint-disable -->
@@ -1 +1 @@
1
- const e=require(`../plugin.cjs`),t={files:[`**/*.{,c,m}{j,t}s{,x}`],name:`shell-shock:base`,plugins:{"shell-shock":e.plugin},ignores:[`.storm`],rules:{"shell-shock/invalid-command-path":`error`}};var n=t;module.exports=n;
1
+ const e=require(`../plugin.cjs`),t={files:[`**/*.{,c,m}{j,t}s{,x}`],name:`shell-shock:base`,plugins:{"shell-shock":e.plugin},ignores:[`.shell-shock`],rules:{"shell-shock/duplicate-command-path":`warn`,"shell-shock/invalid-command-export":`error`,"shell-shock/invalid-handler-params":`error`}};var n=t;module.exports=n;
@@ -2,4 +2,5 @@ import { Linter } from "eslint";
2
2
 
3
3
  //#region src/configs/base.d.ts
4
4
  declare const config: Linter.Config;
5
- export = config;
5
+ export = config;
6
+ //# sourceMappingURL=base.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.cts","names":[],"sources":["../../src/configs/base.ts"],"sourcesContent":[],"mappings":";;;cAqBM,QAAQ,MAAA,CAAO"}
@@ -3,4 +3,5 @@ import { Linter } from "eslint";
3
3
  //#region src/configs/base.d.ts
4
4
  declare const config: Linter.Config;
5
5
  //#endregion
6
- export { config as default };
6
+ export { config as default };
7
+ //# sourceMappingURL=base.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.mts","names":[],"sources":["../../src/configs/base.ts"],"sourcesContent":[],"mappings":";;;cAqBM,QAAQ,MAAA,CAAO"}
@@ -1 +1,2 @@
1
- import{plugin as e}from"../plugin.mjs";var t={files:[`**/*.{,c,m}{j,t}s{,x}`],name:`shell-shock:base`,plugins:{"shell-shock":e},ignores:[`.storm`],rules:{"shell-shock/invalid-command-path":`error`}};export{t as default};
1
+ import{plugin as e}from"../plugin.mjs";var t={files:[`**/*.{,c,m}{j,t}s{,x}`],name:`shell-shock:base`,plugins:{"shell-shock":e},ignores:[`.shell-shock`],rules:{"shell-shock/duplicate-command-path":`warn`,"shell-shock/invalid-command-export":`error`,"shell-shock/invalid-handler-params":`error`}};export{t as default};
2
+ //# sourceMappingURL=base.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.mjs","names":["config: Linter.Config"],"sources":["../../src/configs/base.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Linter } from \"eslint\";\nimport { plugin } from \"../plugin\";\n\nconst config: Linter.Config = {\n files: [\"**/*.{,c,m}{j,t}s{,x}\"],\n name: \"shell-shock:base\",\n plugins: {\n \"shell-shock\": plugin\n },\n ignores: [\".shell-shock\"],\n rules: {\n \"shell-shock/duplicate-command-path\": \"warn\",\n \"shell-shock/invalid-command-export\": \"error\",\n \"shell-shock/invalid-handler-params\": \"error\"\n }\n};\n\nexport default config;\n"],"mappings":"uCAmCA,IAAA,EAd8B,CAC5B,MAAO,CAAC,wBAAwB,CAChC,KAAM,mBACN,QAAS,CACP,cAAe,EAChB,CACD,QAAS,CAAC,eAAe,CACzB,MAAO,CACL,qCAAsC,OACtC,qCAAsC,QACtC,qCAAsC,QACvC,CACF"}
@@ -3,4 +3,5 @@ import { Linter } from "eslint";
3
3
  //#region src/configs/index.d.ts
4
4
  declare const configs: Record<string, Linter.Config>;
5
5
  //#endregion
6
- export { configs };
6
+ export { configs };
7
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/configs/index.ts"],"sourcesContent":[],"mappings":";;;cAqBa,SAAS,eAAe,MAAA,CAAO"}
@@ -3,4 +3,5 @@ import { Linter } from "eslint";
3
3
  //#region src/configs/index.d.ts
4
4
  declare const configs: Record<string, Linter.Config>;
5
5
  //#endregion
6
- export { configs };
6
+ export { configs };
7
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/configs/index.ts"],"sourcesContent":[],"mappings":";;;cAqBa,SAAS,eAAe,MAAA,CAAO"}
@@ -1 +1,2 @@
1
- import e from"./base.mjs";const t={base:e};export{t as configs};
1
+ import e from"./base.mjs";const t={base:e};export{t as configs};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["configs: Record<string, Linter.Config>"],"sources":["../../src/configs/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Linter } from \"eslint\";\nimport base from \"./base\";\n\nexport const configs: Record<string, Linter.Config> = {\n base\n};\n"],"mappings":"0BAqBA,MAAaA,EAAyC,CACpD,KAAA,EACD"}
@@ -1 +1 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`defu`);t=e.__toESM(t);function n(e){return function({name:t,meta:n,...i}){return r({meta:{...n,docs:{...n.docs,url:e(t)}},...i})}}function r({create:e,defaultOptions:n,meta:r}){return{create:(r=>e(r,r.options.map((e,r)=>(0,t.default)(n?.[r]??{},e)))),defaultOptions:n??{},meta:r}}const i=n(e=>`https://docs.stormsoftware.com/projects/shell-shock/eslint/rules/${e}.md`);exports.createEslintRule=i;
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`defu`);t=e.__toESM(t);function n(e){return function({name:t,meta:n,...i}){return r({meta:{...n,docs:{...n.docs,url:e(t)}},...i})}}function r({create:e,defaultOptions:n,meta:r}){return{create:(r=>e(r,r.options.map((e,r)=>(0,t.default)(n?.[r]??{},e)))),defaultOptions:n??{},meta:r}}const i=n(e=>`https://docs.stormsoftware.com/projects/shell-shock/eslint/rules/${e}.md`);exports.createRule=i;
@@ -5,4 +5,5 @@ type RuleModule<T extends readonly unknown[]> = Rule.RuleModule & {
5
5
  defaultOptions: T;
6
6
  };
7
7
  //#endregion
8
- export { RuleModule };
8
+ export { RuleModule };
9
+ //# sourceMappingURL=create-rule.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-rule.d.cts","names":[],"sources":["../../src/helpers/create-rule.ts"],"sourcesContent":[],"mappings":";;;KA2BY,2CAA2C,IAAA,CAAK;EAAhD,cAAU,EACJ,CADI"}
@@ -5,4 +5,5 @@ type RuleModule<T extends readonly unknown[]> = Rule.RuleModule & {
5
5
  defaultOptions: T;
6
6
  };
7
7
  //#endregion
8
- export { RuleModule };
8
+ export { RuleModule };
9
+ //# sourceMappingURL=create-rule.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-rule.d.mts","names":[],"sources":["../../src/helpers/create-rule.ts"],"sourcesContent":[],"mappings":";;;KA2BY,2CAA2C,IAAA,CAAK;EAAhD,cAAU,EACJ,CADI"}
@@ -1 +1,2 @@
1
- import e from"defu";function t(e){return function({name:t,meta:r,...i}){return n({meta:{...r,docs:{...r.docs,url:e(t)}},...i})}}function n({create:t,defaultOptions:n,meta:r}){return{create:(r=>t(r,r.options.map((t,r)=>e(n?.[r]??{},t)))),defaultOptions:n??{},meta:r}}const r=t(e=>`https://docs.stormsoftware.com/projects/shell-shock/eslint/rules/${e}.md`);export{r as createEslintRule};
1
+ import e from"defu";function t(e){return function({name:t,meta:r,...i}){return n({meta:{...r,docs:{...r.docs,url:e(t)}},...i})}}function n({create:t,defaultOptions:n,meta:r}){return{create:(r=>t(r,r.options.map((t,r)=>e(n?.[r]??{},t)))),defaultOptions:n??{},meta:r}}const r=t(e=>`https://docs.stormsoftware.com/projects/shell-shock/eslint/rules/${e}.md`);export{r as createRule};
2
+ //# sourceMappingURL=create-rule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-rule.mjs","names":[],"sources":["../../src/helpers/create-rule.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n RuleListener,\n RuleWithMeta,\n RuleWithMetaAndName\n} from \"@typescript-eslint/utils/eslint-utils\";\nimport type { RuleContext } from \"@typescript-eslint/utils/ts-eslint\";\nimport defu from \"defu\";\nimport type { Rule } from \"eslint\";\n\nexport type RuleModule<T extends readonly unknown[]> = Rule.RuleModule & {\n defaultOptions: T;\n};\n\n/**\n * Creates reusable function to create rules with default options and docs URLs.\n *\n * @param urlCreator - Creates a documentation URL for a given rule name.\n * @returns Function to create a rule with the docs URL format.\n */\nfunction RuleCreator(urlCreator: (name: string) => string) {\n // This function will get much easier to call when this is merged https://github.com/Microsoft/TypeScript/pull/26349\n // TODO - when the above PR lands; add type checking for the context.report `data` property\n return function createNamedRule<\n TOptions extends readonly any[],\n TMessageIds extends string\n >({\n name,\n meta,\n ...rule\n }: Readonly<\n RuleWithMetaAndName<TOptions, TMessageIds>\n >): RuleModule<TOptions> {\n return createRuleInfo<TOptions, TMessageIds>({\n meta: {\n ...meta,\n docs: {\n ...meta.docs,\n url: urlCreator(name)\n }\n },\n ...rule\n });\n };\n}\n\n/**\n * Creates a well-typed TSESLint custom ESLint rule without a docs URL.\n *\n * @returns Well-typed TSESLint custom ESLint rule.\n * @remarks It is generally better to provide a docs URL function to RuleCreator.\n */\nfunction createRuleInfo<\n TOptions extends readonly any[],\n TMessageIds extends string\n>({\n create,\n defaultOptions,\n meta\n}: Readonly<RuleWithMeta<TOptions, TMessageIds>>): RuleModule<TOptions> {\n return {\n create: ((\n context: Readonly<RuleContext<TMessageIds, TOptions>>\n ): RuleListener => {\n const optionsWithDefault = context.options.map((options, index) => {\n return defu(defaultOptions?.[index] ?? {}, options);\n }) as unknown as TOptions;\n\n return create(context, optionsWithDefault);\n }) as any,\n defaultOptions: (defaultOptions ?? {}) as TOptions,\n meta: meta as any\n };\n}\n\nexport const createRule = RuleCreator(\n ruleName =>\n `https://docs.stormsoftware.com/projects/shell-shock/eslint/rules/${ruleName}.md`\n) as any as <TOptions extends readonly unknown[], TMessageIds extends string>({\n name,\n meta,\n ...rule\n}: Readonly<\n RuleWithMetaAndName<TOptions, TMessageIds>\n>) => RuleModule<TOptions>;\n\nconst warned = new Set<string>();\n\nexport function warnOnce(message: string): void {\n if (warned.has(message)) return;\n warned.add(message);\n // eslint-disable-next-line no-console\n console.warn(message);\n}\n"],"mappings":"oBAqCA,SAAS,EAAY,EAAsC,CAGzD,OAAO,SAGL,CACA,OACA,OACA,GAAG,GAGoB,CACvB,OAAO,EAAsC,CAC3C,KAAM,CACJ,GAAG,EACH,KAAM,CACJ,GAAG,EAAK,KACR,IAAK,EAAW,EAAK,CACtB,CACF,CACD,GAAG,EACJ,CAAC,EAUN,SAAS,EAGP,CACA,SACA,iBACA,QACsE,CACtE,MAAO,CACL,QACE,GAMO,EAAO,EAJa,EAAQ,QAAQ,KAAK,EAAS,IAChD,EAAK,IAAiB,IAAU,EAAE,CAAE,EAAQ,CACnD,CAEwC,EAE5C,eAAiB,GAAkB,EAAE,CAC/B,OACP,CAGH,MAAa,EAAa,EACxB,GACE,oEAAoE,EAAS,KAChF"}
package/dist/index.d.cts CHANGED
@@ -21,4 +21,5 @@ type RuleDefinitions = (typeof plugin)["rules"];
21
21
  type RuleOptions = { [K in keyof RuleDefinitions]: RuleDefinitions[K]["defaultOptions"] };
22
22
  type Rules = { [K in keyof RuleOptions]: Linter.RuleEntry<RuleOptions[K]> };
23
23
  //#endregion
24
- export { RuleOptions, Rules, eslintPlugin as default };
24
+ export { RuleOptions, Rules, eslintPlugin as default };
25
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAoBkC;AAqBP;AAI3B;;;;;AAIA;;;;cAbM,YAc6B,EAdf,MAAA,CAAO,MAcQ;KAP9B,eAAA,WAA0B;KAEnB,WAAA,iBACE,kBAAkB,gBAAgB;KAGpC,KAAA,iBACE,cAAc,MAAA,CAAO,UAAU,YAAY"}
package/dist/index.d.mts CHANGED
@@ -21,4 +21,5 @@ type RuleDefinitions = (typeof plugin)["rules"];
21
21
  type RuleOptions = { [K in keyof RuleDefinitions]: RuleDefinitions[K]["defaultOptions"] };
22
22
  type Rules = { [K in keyof RuleOptions]: Linter.RuleEntry<RuleOptions[K]> };
23
23
  //#endregion
24
- export { RuleOptions, Rules, eslintPlugin as default };
24
+ export { RuleOptions, Rules, eslintPlugin as default };
25
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAoBkC;AAqBP;AAI3B;;;;;AAIA;;;;cAbM,YAc6B,EAdf,MAAA,CAAO,MAcQ;KAP9B,eAAA,WAA0B;KAEnB,WAAA,iBACE,kBAAkB,gBAAgB;KAGpC,KAAA,iBACE,cAAc,MAAA,CAAO,UAAU,YAAY"}
package/dist/index.mjs CHANGED
@@ -1 +1,2 @@
1
- import{plugin as e}from"./plugin.mjs";import{configs as t}from"./configs/index.mjs";var n={...e,configs:t};export{n as default};
1
+ import{plugin as e}from"./plugin.mjs";import{configs as t}from"./configs/index.mjs";var n={...e,configs:t};export{n as default};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["eslintPlugin: ESLint.Plugin"],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ESLint, Linter } from \"eslint\";\nimport { configs } from \"./configs\";\nimport { plugin } from \"./plugin\";\n\n/**\n * A shared ESLint configuration containing globals used in Storm Stack projects\n *\n * @packageDocumentation\n * This package contains the ESLint plugin for Storm Stack, which provides\n * a set of rules and configurations for linting JavaScript and TypeScript code.\n * It includes a set of recommended rules, as well as a strict configuration\n * that enforces a more opinionated style. The plugin is designed to be used\n * with ESLint, a popular linting tool for JavaScript and TypeScript.\n *\n * This package also includes additional utilities for enhancing the linting\n * experience and ensuring code quality across projects.\n */\n\nconst eslintPlugin: ESLint.Plugin = {\n ...plugin,\n configs\n};\n\nexport default eslintPlugin;\n\ntype RuleDefinitions = (typeof plugin)[\"rules\"];\n\nexport type RuleOptions = {\n [K in keyof RuleDefinitions]: RuleDefinitions[K][\"defaultOptions\"];\n};\n\nexport type Rules = {\n [K in keyof RuleOptions]: Linter.RuleEntry<RuleOptions[K]>;\n};\n"],"mappings":"oFAyCA,IAAA,EALoC,CAClC,GAAG,EACH,UACD"}
package/dist/package.cjs CHANGED
@@ -1 +1 @@
1
- var e=`0.0.13`;Object.defineProperty(exports,`version`,{enumerable:!0,get:function(){return e}});
1
+ var e=`0.0.15`;Object.defineProperty(exports,`version`,{enumerable:!0,get:function(){return e}});
package/dist/package.mjs CHANGED
@@ -1 +1,2 @@
1
- var e=`0.0.13`;export{e as version};
1
+ var e=`0.0.15`;export{e as version};
2
+ //# sourceMappingURL=package.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@shell-shock/eslint-plugin\",\n \"version\": \"0.0.15\",\n \"type\": \"module\",\n \"description\": \"An ESLint Plugin with linting rules that ensure a Shell Shock project is following the best practices.\",\n \"repository\": {\n \"type\": \"github\",\n \"url\": \"https://github.com/storm-software/shell-shock.git\",\n \"directory\": \"packages/eslint-plugin\"\n },\n \"homepage\": \"https://stormsoftware.com\",\n \"bugs\": {\n \"url\": \"https://stormsoftware.com/support\",\n \"email\": \"support@stormsoftware.com\"\n },\n \"author\": {\n \"name\": \"Storm Software\",\n \"email\": \"contact@stormsoftware.com\",\n \"url\": \"https://stormsoftware.com\"\n },\n \"maintainers\": [\n {\n \"name\": \"Storm Software\",\n \"email\": \"contact@stormsoftware.com\",\n \"url\": \"https://stormsoftware.com\"\n }\n ],\n \"contributors\": [\n {\n \"name\": \"Storm Software\",\n \"email\": \"contact@stormsoftware.com\",\n \"url\": \"https://stormsoftware.com\"\n }\n ],\n \"funding\": {\n \"type\": \"github\",\n \"url\": \"https://github.com/sponsors/storm-software\"\n },\n \"license\": \"Apache-2.0\",\n \"private\": false,\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n },\n \"import\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\n },\n \"default\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\n }\n },\n \"./configs\": {\n \"require\": {\n \"types\": \"./dist/configs/index.d.cts\",\n \"default\": \"./dist/configs/index.cjs\"\n },\n \"import\": {\n \"types\": \"./dist/configs/index.d.mts\",\n \"default\": \"./dist/configs/index.mjs\"\n },\n \"default\": {\n \"types\": \"./dist/configs/index.d.mts\",\n \"default\": \"./dist/configs/index.mjs\"\n }\n },\n \"./configs/base\": {\n \"require\": {\n \"types\": \"./dist/configs/base.d.cts\",\n \"default\": \"./dist/configs/base.cjs\"\n },\n \"import\": {\n \"types\": \"./dist/configs/base.d.mts\",\n \"default\": \"./dist/configs/base.mjs\"\n },\n \"default\": {\n \"types\": \"./dist/configs/base.d.mts\",\n \"default\": \"./dist/configs/base.mjs\"\n }\n },\n \"./package.json\": \"./package.json\",\n \"./plugin\": {\n \"require\": {\n \"types\": \"./dist/plugin.d.cts\",\n \"default\": \"./dist/plugin.cjs\"\n },\n \"import\": {\n \"types\": \"./dist/plugin.d.mts\",\n \"default\": \"./dist/plugin.mjs\"\n },\n \"default\": {\n \"types\": \"./dist/plugin.d.mts\",\n \"default\": \"./dist/plugin.mjs\"\n }\n },\n \"./rules/duplicate-command-path\": {\n \"require\": {\n \"types\": \"./dist/rules/duplicate-command-path.d.cts\",\n \"default\": \"./dist/rules/duplicate-command-path.cjs\"\n },\n \"import\": {\n \"types\": \"./dist/rules/duplicate-command-path.d.mts\",\n \"default\": \"./dist/rules/duplicate-command-path.mjs\"\n },\n \"default\": {\n \"types\": \"./dist/rules/duplicate-command-path.d.mts\",\n \"default\": \"./dist/rules/duplicate-command-path.mjs\"\n }\n },\n \"./rules/invalid-command-export\": {\n \"require\": {\n \"types\": \"./dist/rules/invalid-command-export.d.cts\",\n \"default\": \"./dist/rules/invalid-command-export.cjs\"\n },\n \"import\": {\n \"types\": \"./dist/rules/invalid-command-export.d.mts\",\n \"default\": \"./dist/rules/invalid-command-export.mjs\"\n },\n \"default\": {\n \"types\": \"./dist/rules/invalid-command-export.d.mts\",\n \"default\": \"./dist/rules/invalid-command-export.mjs\"\n }\n },\n \"./rules/invalid-handler-params\": {\n \"require\": {\n \"types\": \"./dist/rules/invalid-handler-params.d.cts\",\n \"default\": \"./dist/rules/invalid-handler-params.cjs\"\n },\n \"import\": {\n \"types\": \"./dist/rules/invalid-handler-params.d.mts\",\n \"default\": \"./dist/rules/invalid-handler-params.mjs\"\n },\n \"default\": {\n \"types\": \"./dist/rules/invalid-handler-params.d.mts\",\n \"default\": \"./dist/rules/invalid-handler-params.mjs\"\n }\n }\n },\n \"types\": \"./dist/index.d.cts\",\n \"typings\": \"dist/index.d.mts\",\n \"files\": [\"dist/**/*\"],\n \"keywords\": [\"eslint\", \"eslint-plugin\", \"shell-shock\", \"storm-software\"],\n \"peerDependencies\": {\n \"eslint\": \"catalog:\",\n \"@powerlines/plugin-tsdown\": \">=0.1.224\",\n \"powerlines\": \">=0.38.38\"\n },\n \"peerDependenciesMeta\": {\n \"eslint\": {\n \"optional\": false\n }\n },\n \"dependencies\": {\n \"@stryke/fs\": \"catalog:\",\n \"@stryke/path\": \"catalog:\",\n \"@typescript-eslint/utils\": \"catalog:\",\n \"defu\": \"catalog:\"\n },\n \"devDependencies\": {\n \"@eslint/config-inspector\": \"catalog:\",\n \"@powerlines/plugin-tsdown\": \"catalog:\",\n \"@storm-software/eslint\": \"catalog:\",\n \"@types/eslint\": \"catalog:\",\n \"@types/eslint__js\": \"catalog:\",\n \"@types/node\": \"catalog:\",\n \"eslint\": \"catalog:\",\n \"eslint-doc-generator\": \"catalog:\",\n \"eslint-plugin-eslint-plugin\": \"catalog:\",\n \"eslint-plugin-i18n-text\": \"catalog:\",\n \"eslint-rule-documentation\": \"catalog:\",\n \"eslint-typegen\": \"catalog:\",\n \"powerlines\": \"catalog:\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"exports\": {\n \".\": {\n \"require\": \"./dist/index.cjs\",\n \"import\": \"./dist/index.mjs\"\n },\n \"./configs\": {\n \"require\": \"./dist/configs/index.cjs\",\n \"import\": \"./dist/configs/index.mjs\"\n },\n \"./configs/base\": {\n \"require\": \"./dist/configs/base.cjs\",\n \"import\": \"./dist/configs/base.mjs\"\n },\n \"./plugin\": {\n \"require\": \"./dist/plugin.cjs\",\n \"import\": \"./dist/plugin.mjs\"\n },\n \"./rules/duplicate-command-path\": {\n \"require\": \"./dist/rules/duplicate-command-path.cjs\",\n \"import\": \"./dist/rules/duplicate-command-path.mjs\"\n },\n \"./rules/invalid-command-export\": {\n \"require\": \"./dist/rules/invalid-command-export.cjs\",\n \"import\": \"./dist/rules/invalid-command-export.mjs\"\n },\n \"./rules/invalid-handler-params\": {\n \"require\": \"./dist/rules/invalid-handler-params.cjs\",\n \"import\": \"./dist/rules/invalid-handler-params.mjs\"\n },\n \"./package.json\": \"./package.json\"\n }\n }\n}\n"],"mappings":"MAEa"}
package/dist/plugin.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./package.cjs`),t=require(`./rules/invalid-command-path.cjs`),n={meta:{name:`shell-shock`,version:e.version},rules:{"invalid-command-path":t.default}};exports.plugin=n;
1
+ const e=require(`./package.cjs`),t=require(`./rules/duplicate-command-path.cjs`),n=require(`./rules/invalid-command-export.cjs`),r=require(`./rules/invalid-handler-params.cjs`),i={meta:{name:`shell-shock`,version:e.version},rules:{"duplicate-command-path":t.default,"invalid-command-export":n.default,"invalid-handler-params":r.default}};exports.plugin=i;
package/dist/plugin.d.cts CHANGED
@@ -7,8 +7,11 @@ declare const plugin: {
7
7
  version: string;
8
8
  };
9
9
  rules: {
10
- "invalid-command-path": RuleModule<[]>;
10
+ "duplicate-command-path": RuleModule<[]>;
11
+ "invalid-command-export": RuleModule<[]>;
12
+ "invalid-handler-params": RuleModule<[]>;
11
13
  };
12
14
  };
13
15
  //#endregion
14
- export { plugin };
16
+ export { plugin };
17
+ //# sourceMappingURL=plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"sourcesContent":[],"mappings":";;;cAwBa;;;IAAA,OAUY,EAAA,MAAA;EAAA,CAAA;;8BAAA"}
package/dist/plugin.d.mts CHANGED
@@ -7,8 +7,11 @@ declare const plugin: {
7
7
  version: string;
8
8
  };
9
9
  rules: {
10
- "invalid-command-path": RuleModule<[]>;
10
+ "duplicate-command-path": RuleModule<[]>;
11
+ "invalid-command-export": RuleModule<[]>;
12
+ "invalid-handler-params": RuleModule<[]>;
11
13
  };
12
14
  };
13
15
  //#endregion
14
- export { plugin };
16
+ export { plugin };
17
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"sourcesContent":[],"mappings":";;;cAwBa;;;IAAA,OAUY,EAAA,MAAA;EAAA,CAAA;;8BAAA"}
package/dist/plugin.mjs CHANGED
@@ -1 +1,2 @@
1
- import{version as e}from"./package.mjs";import t from"./rules/invalid-command-path.mjs";const n={meta:{name:`shell-shock`,version:e},rules:{"invalid-command-path":t}};export{n as plugin};
1
+ import{version as e}from"./package.mjs";import t from"./rules/duplicate-command-path.mjs";import n from"./rules/invalid-command-export.mjs";import r from"./rules/invalid-handler-params.mjs";const i={meta:{name:`shell-shock`,version:e},rules:{"duplicate-command-path":t,"invalid-command-export":n,"invalid-handler-params":r}};export{i as plugin};
2
+ //# sourceMappingURL=plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.mjs","names":["packageJson.version","duplicateCommandPath","invalidCommandExport","invalidHandlerParams"],"sources":["../src/plugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ESLint } from \"eslint\";\nimport packageJson from \"../package.json\" with { type: \"json\" };\nimport duplicateCommandPath from \"./rules/duplicate-command-path\";\nimport invalidCommandExport from \"./rules/invalid-command-export\";\nimport invalidHandlerParams from \"./rules/invalid-handler-params\";\n\nexport const plugin = {\n meta: {\n name: \"shell-shock\",\n version: packageJson.version\n },\n rules: {\n \"duplicate-command-path\": duplicateCommandPath,\n \"invalid-command-export\": invalidCommandExport,\n \"invalid-handler-params\": invalidHandlerParams\n }\n} satisfies ESLint.Plugin;\n"],"mappings":"8LAwBA,MAAa,EAAS,CACpB,KAAM,CACJ,KAAM,cACGA,UACV,CACD,MAAO,CACL,yBAA0BC,EAC1B,yBAA0BC,EAC1B,yBAA0BC,EAC3B,CACF"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../helpers/create-rule.cjs`);let n=require(`@stryke/fs/is-file`),r=require(`@stryke/fs/list-files`),i=require(`@stryke/path/file-path-fns`),a=require(`@stryke/path/join`),o=require(`@stryke/path/resolve-parent-path`),s=require(`node:fs`);const c=`duplicate-command-path`;var l=t.createRule({name:c,meta:{type:`problem`,docs:{description:`Multiple command files found in the same directory. This can lead to unexpected behavior. Please ensure that there is only one command file per directory.`},schema:[],messages:{duplicateCommandPath:`Multiple command files found in the same directory. This can lead to unexpected behavior. Please ensure that there is only one command file per directory: {{#duplicates}}
2
+ - {{.}}{{/duplicates}}`}},defaultOptions:[],create:e=>({Program(t){let c=e.filename??e.getFilename();if((0,i.findFileName)(c,{withExtension:!1})!==`command`)return;let l=(0,i.findFilePath)(c);if(!l)return;let u=(0,r.listSync)(l).filter(e=>(0,n.isDirectory)(e)&&((0,i.findFileName)(e).startsWith(`(`)&&(0,i.findFileName)(e).startsWith(`(`)||(0,i.findFileName)(e).startsWith(`_`))&&(0,s.existsSync)((0,a.joinPaths)(e,`command.ts`)));u.length>1&&e.report({node:t,messageId:`duplicateCommandPath`,data:{duplicates:u}});let d=(0,o.resolveParentPath)(c);((0,i.findFolderName)(d).startsWith(`(`)&&(0,i.findFolderName)(d).startsWith(`(`)||(0,i.findFolderName)(d).startsWith(`_`))&&(0,s.existsSync)((0,a.joinPaths)(d,`command.ts`))&&e.report({node:t,messageId:`duplicateCommandPath`,data:{duplicates:[d]}})}})});exports.RULE_NAME=c,exports.default=l;
@@ -0,0 +1,10 @@
1
+ import { RuleModule } from "../helpers/create-rule.cjs";
2
+
3
+ //#region src/rules/duplicate-command-path.d.ts
4
+ declare const RULE_NAME = "duplicate-command-path";
5
+ type MessageIds = "duplicateCommandPath";
6
+ type Options = [];
7
+ declare const _default: RuleModule<[]>;
8
+ //#endregion
9
+ export { MessageIds, Options, RULE_NAME, _default as default };
10
+ //# sourceMappingURL=duplicate-command-path.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicate-command-path.d.cts","names":[],"sources":["../../src/rules/duplicate-command-path.ts"],"sourcesContent":[],"mappings":";;;cA8Ba,SAAA;KACD,UAAA;KACA,OAAA;AAFZ,cAEyB,QAFH,EAEG,UAFH,CAAA,EAAA,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { RuleModule } from "../helpers/create-rule.mjs";
2
+
3
+ //#region src/rules/duplicate-command-path.d.ts
4
+ declare const RULE_NAME = "duplicate-command-path";
5
+ type MessageIds = "duplicateCommandPath";
6
+ type Options = [];
7
+ declare const _default: RuleModule<[]>;
8
+ //#endregion
9
+ export { MessageIds, Options, RULE_NAME, _default as default };
10
+ //# sourceMappingURL=duplicate-command-path.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicate-command-path.d.mts","names":[],"sources":["../../src/rules/duplicate-command-path.ts"],"sourcesContent":[],"mappings":";;;cA8Ba,SAAA;KACD,UAAA;KACA,OAAA;AAFZ,cAEyB,QAFH,EAEG,UAFH,CAAA,EAAA,CAAA"}
@@ -0,0 +1,3 @@
1
+ import{createRule as e}from"../helpers/create-rule.mjs";import{isDirectory as t}from"@stryke/fs/is-file";import{listSync as n}from"@stryke/fs/list-files";import{findFileName as r,findFilePath as i,findFolderName as a}from"@stryke/path/file-path-fns";import{joinPaths as o}from"@stryke/path/join";import{resolveParentPath as s}from"@stryke/path/resolve-parent-path";import{existsSync as c}from"node:fs";const l=`duplicate-command-path`;var u=e({name:l,meta:{type:`problem`,docs:{description:`Multiple command files found in the same directory. This can lead to unexpected behavior. Please ensure that there is only one command file per directory.`},schema:[],messages:{duplicateCommandPath:`Multiple command files found in the same directory. This can lead to unexpected behavior. Please ensure that there is only one command file per directory: {{#duplicates}}
2
+ - {{.}}{{/duplicates}}`}},defaultOptions:[],create:e=>({Program(l){let u=e.filename??e.getFilename();if(r(u,{withExtension:!1})!==`command`)return;let d=i(u);if(!d)return;let f=n(d).filter(e=>t(e)&&(r(e).startsWith(`(`)&&r(e).startsWith(`(`)||r(e).startsWith(`_`))&&c(o(e,`command.ts`)));f.length>1&&e.report({node:l,messageId:`duplicateCommandPath`,data:{duplicates:f}});let p=s(u);(a(p).startsWith(`(`)&&a(p).startsWith(`(`)||a(p).startsWith(`_`))&&c(o(p,`command.ts`))&&e.report({node:l,messageId:`duplicateCommandPath`,data:{duplicates:[p]}})}})});export{l as RULE_NAME,u as default};
3
+ //# sourceMappingURL=duplicate-command-path.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duplicate-command-path.mjs","names":[],"sources":["../../src/rules/duplicate-command-path.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isDirectory } from \"@stryke/fs/is-file\";\nimport { listSync } from \"@stryke/fs/list-files\";\nimport {\n findFileName,\n findFilePath,\n findFolderName\n} from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { existsSync } from \"node:fs\";\nimport { createRule } from \"../helpers/create-rule\";\n\nexport const RULE_NAME = \"duplicate-command-path\";\nexport type MessageIds = \"duplicateCommandPath\";\nexport type Options = [];\n\nexport default createRule<Options, MessageIds>({\n name: RULE_NAME,\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Multiple command files found in the same directory. This can lead to unexpected behavior. Please ensure that there is only one command file per directory.\"\n },\n schema: [],\n messages: {\n duplicateCommandPath:\n \"Multiple command files found in the same directory. This can lead to unexpected behavior. Please ensure that there is only one command file per directory: {{#duplicates}}\\n- {{.}}{{/duplicates}}\"\n }\n },\n defaultOptions: [],\n create: context => {\n return {\n Program(node) {\n const fileName = context.filename ?? context.getFilename();\n if (\n findFileName(fileName, {\n withExtension: false\n }) !== \"command\"\n ) {\n return;\n }\n\n const filePath = findFilePath(fileName);\n if (!filePath) {\n return;\n }\n\n const duplicates = listSync(filePath).filter(\n contentItem =>\n isDirectory(contentItem) &&\n ((findFileName(contentItem).startsWith(\"(\") &&\n findFileName(contentItem).startsWith(\"(\")) ||\n findFileName(contentItem).startsWith(\"_\")) &&\n existsSync(joinPaths(contentItem, \"command.ts\"))\n );\n if (duplicates.length > 1) {\n context.report({\n node,\n messageId: \"duplicateCommandPath\",\n data: {\n duplicates\n }\n });\n }\n\n const parentPath = resolveParentPath(fileName);\n if (\n ((findFolderName(parentPath).startsWith(\"(\") &&\n findFolderName(parentPath).startsWith(\"(\")) ||\n findFolderName(parentPath).startsWith(\"_\")) &&\n existsSync(joinPaths(parentPath, \"command.ts\"))\n ) {\n context.report({\n node,\n messageId: \"duplicateCommandPath\",\n data: {\n duplicates: [parentPath]\n }\n });\n }\n }\n };\n }\n});\n"],"mappings":"kZA8BA,MAAa,EAAY,yBAIzB,IAAA,EAAe,EAAgC,CAC7C,KAAM,EACN,KAAM,CACJ,KAAM,UACN,KAAM,CACJ,YACE,6JACH,CACD,OAAQ,EAAE,CACV,SAAU,CACR,qBACE;wBACH,CACF,CACD,eAAgB,EAAE,CAClB,OAAQ,IACC,CACL,QAAQ,EAAM,CACZ,IAAM,EAAW,EAAQ,UAAY,EAAQ,aAAa,CAC1D,GACE,EAAa,EAAU,CACrB,cAAe,GAChB,CAAC,GAAK,UAEP,OAGF,IAAM,EAAW,EAAa,EAAS,CACvC,GAAI,CAAC,EACH,OAGF,IAAM,EAAa,EAAS,EAAS,CAAC,OACpC,GACE,EAAY,EAAY,GACtB,EAAa,EAAY,CAAC,WAAW,IAAI,EACzC,EAAa,EAAY,CAAC,WAAW,IAAI,EACzC,EAAa,EAAY,CAAC,WAAW,IAAI,GAC3C,EAAW,EAAU,EAAa,aAAa,CAAC,CACnD,CACG,EAAW,OAAS,GACtB,EAAQ,OAAO,CACb,OACA,UAAW,uBACX,KAAM,CACJ,aACD,CACF,CAAC,CAGJ,IAAM,EAAa,EAAkB,EAAS,EAE1C,EAAe,EAAW,CAAC,WAAW,IAAI,EAC1C,EAAe,EAAW,CAAC,WAAW,IAAI,EAC1C,EAAe,EAAW,CAAC,WAAW,IAAI,GAC5C,EAAW,EAAU,EAAY,aAAa,CAAC,EAE/C,EAAQ,OAAO,CACb,OACA,UAAW,uBACX,KAAM,CACJ,WAAY,CAAC,EAAW,CACzB,CACF,CAAC,EAGP,EAEJ,CAAC"}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../helpers/create-rule.cjs`);let n=require(`@stryke/path/file-path-fns`);const r=`invalid-command-export`;var i=t.createRule({name:r,meta:{type:`problem`,docs:{description:`A command module must have a handler function as it's default export.`},schema:[],messages:{invalidExport:`A command module must have a handler function as it's default export.`}},defaultOptions:[],create:e=>({Program(t){if((0,n.findFileName)(e.filename??e.getFilename(),{withExtension:!1})===`command`){for(let n of t.body)if(n.type===`ExportDefaultDeclaration`){if(n.declaration.type===`FunctionDeclaration`)return;if(n.declaration.type===`Identifier`){let e=n.declaration.name;if(t.body.some(t=>t.type===`FunctionDeclaration`&&t.id.name===e||t.type===`VariableDeclaration`&&t.declarations.find(t=>t.id?.type===`Identifier`&&t.id.name===e)))return}e.report({node:n,messageId:`invalidExport`})}}}})});exports.RULE_NAME=r,exports.default=i;
@@ -0,0 +1,10 @@
1
+ import { RuleModule } from "../helpers/create-rule.cjs";
2
+
3
+ //#region src/rules/invalid-command-export.d.ts
4
+ declare const RULE_NAME = "invalid-command-export";
5
+ type MessageIds = "invalidExport";
6
+ type Options = [];
7
+ declare const _default: RuleModule<[]>;
8
+ //#endregion
9
+ export { MessageIds, Options, RULE_NAME, _default as default };
10
+ //# sourceMappingURL=invalid-command-export.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-command-export.d.cts","names":[],"sources":["../../src/rules/invalid-command-export.ts"],"sourcesContent":[],"mappings":";;;cAqBa,SAAA;KACD,UAAA;KACA,OAAA;AAFZ,cAEyB,QAFH,EAEG,UAFH,CAAA,EAAA,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { RuleModule } from "../helpers/create-rule.mjs";
2
+
3
+ //#region src/rules/invalid-command-export.d.ts
4
+ declare const RULE_NAME = "invalid-command-export";
5
+ type MessageIds = "invalidExport";
6
+ type Options = [];
7
+ declare const _default: RuleModule<[]>;
8
+ //#endregion
9
+ export { MessageIds, Options, RULE_NAME, _default as default };
10
+ //# sourceMappingURL=invalid-command-export.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-command-export.d.mts","names":[],"sources":["../../src/rules/invalid-command-export.ts"],"sourcesContent":[],"mappings":";;;cAqBa,SAAA;KACD,UAAA;KACA,OAAA;AAFZ,cAEyB,QAFH,EAEG,UAFH,CAAA,EAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{createRule as e}from"../helpers/create-rule.mjs";import{findFileName as t}from"@stryke/path/file-path-fns";const n=`invalid-command-export`;var r=e({name:n,meta:{type:`problem`,docs:{description:`A command module must have a handler function as it's default export.`},schema:[],messages:{invalidExport:`A command module must have a handler function as it's default export.`}},defaultOptions:[],create:e=>({Program(n){if(t(e.filename??e.getFilename(),{withExtension:!1})===`command`){for(let t of n.body)if(t.type===`ExportDefaultDeclaration`){if(t.declaration.type===`FunctionDeclaration`)return;if(t.declaration.type===`Identifier`){let e=t.declaration.name;if(n.body.some(t=>t.type===`FunctionDeclaration`&&t.id.name===e||t.type===`VariableDeclaration`&&t.declarations.find(t=>t.id?.type===`Identifier`&&t.id.name===e)))return}e.report({node:t,messageId:`invalidExport`})}}}})});export{n as RULE_NAME,r as default};
2
+ //# sourceMappingURL=invalid-command-export.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-command-export.mjs","names":[],"sources":["../../src/rules/invalid-command-export.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { createRule } from \"../helpers/create-rule\";\n\nexport const RULE_NAME = \"invalid-command-export\";\nexport type MessageIds = \"invalidExport\";\nexport type Options = [];\n\nexport default createRule<Options, MessageIds>({\n name: RULE_NAME,\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"A command module must have a handler function as it's default export.\"\n },\n schema: [],\n messages: {\n invalidExport:\n \"A command module must have a handler function as it's default export.\"\n }\n },\n defaultOptions: [],\n create: context => {\n return {\n Program(node) {\n const fileName = context.filename ?? context.getFilename();\n if (\n findFileName(fileName, {\n withExtension: false\n }) !== \"command\"\n ) {\n return;\n }\n\n for (const block of node.body) {\n if (block.type === \"ExportDefaultDeclaration\") {\n if (block.declaration.type === \"FunctionDeclaration\") {\n return;\n } else if (block.declaration.type === \"Identifier\") {\n const name = block.declaration.name;\n if (\n node.body.some(\n localBlock =>\n (localBlock.type === \"FunctionDeclaration\" &&\n localBlock.id.name === name) ||\n (localBlock.type === \"VariableDeclaration\" &&\n localBlock.declarations.find(\n declaration =>\n declaration.id?.type === \"Identifier\" &&\n declaration.id.name === name\n ))\n )\n ) {\n return;\n }\n }\n\n context.report({\n node: block,\n messageId: \"invalidExport\"\n });\n }\n }\n }\n };\n }\n});\n"],"mappings":"kHAqBA,MAAa,EAAY,yBAIzB,IAAA,EAAe,EAAgC,CAC7C,KAAM,EACN,KAAM,CACJ,KAAM,UACN,KAAM,CACJ,YACE,wEACH,CACD,OAAQ,EAAE,CACV,SAAU,CACR,cACE,wEACH,CACF,CACD,eAAgB,EAAE,CAClB,OAAQ,IACC,CACL,QAAQ,EAAM,CAGV,KAFe,EAAQ,UAAY,EAAQ,aAAa,CAEjC,CACrB,cAAe,GAChB,CAAC,GAAK,UAKT,KAAK,IAAM,KAAS,EAAK,KACvB,GAAI,EAAM,OAAS,2BAA4B,CAC7C,GAAI,EAAM,YAAY,OAAS,sBAC7B,UACS,EAAM,YAAY,OAAS,aAAc,CAClD,IAAM,EAAO,EAAM,YAAY,KAC/B,GACE,EAAK,KAAK,KACR,GACG,EAAW,OAAS,uBACnB,EAAW,GAAG,OAAS,GACxB,EAAW,OAAS,uBACnB,EAAW,aAAa,KACtB,GACE,EAAY,IAAI,OAAS,cACzB,EAAY,GAAG,OAAS,EAC3B,CACN,CAED,OAIJ,EAAQ,OAAO,CACb,KAAM,EACN,UAAW,gBACZ,CAAC,IAIT,EAEJ,CAAC"}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../helpers/create-rule.cjs`);let n=require(`@stryke/path/file-path-fns`),r=require(`@typescript-eslint/utils`);const i=`invalid-handler-params`;function a(e){switch(e.type){case r.AST_NODE_TYPES.Identifier:return e.typeAnnotation?e.typeAnnotation.typeAnnotation:null;case r.AST_NODE_TYPES.AssignmentPattern:{let t=e.left;return t.type===r.AST_NODE_TYPES.Identifier&&t.typeAnnotation?t.typeAnnotation.typeAnnotation:null}case r.AST_NODE_TYPES.RestElement:{let t=e.argument;return t.type===r.AST_NODE_TYPES.Identifier&&t.typeAnnotation?t.typeAnnotation.typeAnnotation:null}case r.AST_NODE_TYPES.ArrayPattern:case r.AST_NODE_TYPES.ObjectPattern:case r.AST_NODE_TYPES.TSParameterProperty:default:return null}}function o(e,t,n){if(t.params.length>0&&t.params[0]){let i=a(t.params[0]);if(i||n.report({node:t.params[0],messageId:`invalidOptionsParam`}),i.type===r.AST_NODE_TYPES.TSTypeLiteral&&i.members.some(e=>e.type===r.AST_NODE_TYPES.TSPropertySignature)||i.type===r.AST_NODE_TYPES.TSIntersectionType&&i.types.some(e=>e.type===r.AST_NODE_TYPES.TSTypeLiteral&&e.members.some(e=>e.type===r.AST_NODE_TYPES.TSPropertySignature)))return;if(i.type===r.AST_NODE_TYPES.TSTypeReference&&i.typeName.type===r.AST_NODE_TYPES.Identifier){let t=i.typeName.name;if(!e.some(e=>e.type===r.AST_NODE_TYPES.TSInterfaceDeclaration&&e.id.name===t||e.type===r.AST_NODE_TYPES.TSTypeAliasDeclaration&&e.id.name===t&&(e.typeAnnotation.type===r.AST_NODE_TYPES.TSTypeLiteral&&e.typeAnnotation.members.some(e=>e.type===r.AST_NODE_TYPES.TSPropertySignature)||e.typeAnnotation.type===r.AST_NODE_TYPES.TSIntersectionType&&e.typeAnnotation.types.some(e=>e.type===r.AST_NODE_TYPES.TSTypeLiteral&&e.members.some(e=>e.type===r.AST_NODE_TYPES.TSPropertySignature)))))return}n.report({node:i,messageId:`invalidOptionsParam`})}}function s(e,t,n){t.params.length>1&&t.params.slice(1).forEach(e=>{let t=a(e);t?.type!==r.AST_NODE_TYPES.TSStringKeyword&&t?.type!==r.AST_NODE_TYPES.TSNumberKeyword&&t?.type!==r.AST_NODE_TYPES.TSBooleanKeyword&&!(t?.type===r.AST_NODE_TYPES.TSArrayType&&(t.elementType.type===r.AST_NODE_TYPES.TSStringKeyword||t.elementType.type===r.AST_NODE_TYPES.TSNumberKeyword))&&n.report({node:t,messageId:`invalidArgsParam`})})}var c=t.createRule({name:i,meta:{type:`problem`,docs:{description:`The command handler function must have a valid parameter types.`},schema:[],messages:{invalidOptionsParam:`The command handler function's first parameter should represent the command's potential options. As a result, it must be an object type with properties.`,invalidArgsParam:`All command handler function parameters except the first should represent the command's positional arguments. As a result, their types must be included in the following list: \\n- string \\n- number \\n- boolean \\n- string[] \\n- number[]`}},defaultOptions:[],create:e=>({Program(t){if((0,n.findFileName)(e.filename??e.getFilename(),{withExtension:!1})===`command`){for(let n of t.body)if(n.type===`ExportDefaultDeclaration`){if(n.declaration?.type===`FunctionDeclaration`)n.declaration.params.length>0&&(o(t.body,n.declaration,e),s(t.body,n.declaration,e));else if(n.declaration?.type===`Identifier`){let r=n.declaration.name,i=t.body.find(e=>e.type===`FunctionDeclaration`&&e.id.name===r||e.type===`VariableDeclaration`&&e.declarations.find(e=>e.id?.type===`Identifier`&&e.id.name===r));if(i?.type===`FunctionDeclaration`)o(t.body,i,e),s(t.body,i,e);else if(i?.type===`VariableDeclaration`){let n=i.declarations.find(e=>e.id?.type===`Identifier`&&e.id.name===r);n?.init?.type===`ArrowFunctionExpression`&&(o(t.body,n.init,e),s(t.body,n.init,e))}}}}}})});exports.RULE_NAME=i,exports.default=c;
@@ -0,0 +1,10 @@
1
+ import { RuleModule } from "../helpers/create-rule.cjs";
2
+
3
+ //#region src/rules/invalid-handler-params.d.ts
4
+ declare const RULE_NAME = "invalid-handler-params";
5
+ type MessageIds = "invalidOptionsParam" | "invalidArgsParam";
6
+ type Options = [];
7
+ declare const _default: RuleModule<[]>;
8
+ //#endregion
9
+ export { MessageIds, Options, RULE_NAME, _default as default };
10
+ //# sourceMappingURL=invalid-handler-params.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-handler-params.d.cts","names":[],"sources":["../../src/rules/invalid-handler-params.ts"],"sourcesContent":[],"mappings":";;;cAwBa,SAAA;KACD,UAAA;KACA,OAAA;AAFZ,cAEyB,QAFH,EAEG,UAFH,CAAA,EAAA,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { RuleModule } from "../helpers/create-rule.mjs";
2
+
3
+ //#region src/rules/invalid-handler-params.d.ts
4
+ declare const RULE_NAME = "invalid-handler-params";
5
+ type MessageIds = "invalidOptionsParam" | "invalidArgsParam";
6
+ type Options = [];
7
+ declare const _default: RuleModule<[]>;
8
+ //#endregion
9
+ export { MessageIds, Options, RULE_NAME, _default as default };
10
+ //# sourceMappingURL=invalid-handler-params.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-handler-params.d.mts","names":[],"sources":["../../src/rules/invalid-handler-params.ts"],"sourcesContent":[],"mappings":";;;cAwBa,SAAA;KACD,UAAA;KACA,OAAA;AAFZ,cAEyB,QAFH,EAEG,UAFH,CAAA,EAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{createRule as e}from"../helpers/create-rule.mjs";import{findFileName as t}from"@stryke/path/file-path-fns";import{AST_NODE_TYPES as n}from"@typescript-eslint/utils";const r=`invalid-handler-params`;function i(e){switch(e.type){case n.Identifier:return e.typeAnnotation?e.typeAnnotation.typeAnnotation:null;case n.AssignmentPattern:{let t=e.left;return t.type===n.Identifier&&t.typeAnnotation?t.typeAnnotation.typeAnnotation:null}case n.RestElement:{let t=e.argument;return t.type===n.Identifier&&t.typeAnnotation?t.typeAnnotation.typeAnnotation:null}case n.ArrayPattern:case n.ObjectPattern:case n.TSParameterProperty:default:return null}}function a(e,t,r){if(t.params.length>0&&t.params[0]){let a=i(t.params[0]);if(a||r.report({node:t.params[0],messageId:`invalidOptionsParam`}),a.type===n.TSTypeLiteral&&a.members.some(e=>e.type===n.TSPropertySignature)||a.type===n.TSIntersectionType&&a.types.some(e=>e.type===n.TSTypeLiteral&&e.members.some(e=>e.type===n.TSPropertySignature)))return;if(a.type===n.TSTypeReference&&a.typeName.type===n.Identifier){let t=a.typeName.name;if(!e.some(e=>e.type===n.TSInterfaceDeclaration&&e.id.name===t||e.type===n.TSTypeAliasDeclaration&&e.id.name===t&&(e.typeAnnotation.type===n.TSTypeLiteral&&e.typeAnnotation.members.some(e=>e.type===n.TSPropertySignature)||e.typeAnnotation.type===n.TSIntersectionType&&e.typeAnnotation.types.some(e=>e.type===n.TSTypeLiteral&&e.members.some(e=>e.type===n.TSPropertySignature)))))return}r.report({node:a,messageId:`invalidOptionsParam`})}}function o(e,t,r){t.params.length>1&&t.params.slice(1).forEach(e=>{let t=i(e);t?.type!==n.TSStringKeyword&&t?.type!==n.TSNumberKeyword&&t?.type!==n.TSBooleanKeyword&&!(t?.type===n.TSArrayType&&(t.elementType.type===n.TSStringKeyword||t.elementType.type===n.TSNumberKeyword))&&r.report({node:t,messageId:`invalidArgsParam`})})}var s=e({name:r,meta:{type:`problem`,docs:{description:`The command handler function must have a valid parameter types.`},schema:[],messages:{invalidOptionsParam:`The command handler function's first parameter should represent the command's potential options. As a result, it must be an object type with properties.`,invalidArgsParam:`All command handler function parameters except the first should represent the command's positional arguments. As a result, their types must be included in the following list: \\n- string \\n- number \\n- boolean \\n- string[] \\n- number[]`}},defaultOptions:[],create:e=>({Program(n){if(t(e.filename??e.getFilename(),{withExtension:!1})===`command`){for(let t of n.body)if(t.type===`ExportDefaultDeclaration`){if(t.declaration?.type===`FunctionDeclaration`)t.declaration.params.length>0&&(a(n.body,t.declaration,e),o(n.body,t.declaration,e));else if(t.declaration?.type===`Identifier`){let r=t.declaration.name,i=n.body.find(e=>e.type===`FunctionDeclaration`&&e.id.name===r||e.type===`VariableDeclaration`&&e.declarations.find(e=>e.id?.type===`Identifier`&&e.id.name===r));if(i?.type===`FunctionDeclaration`)a(n.body,i,e),o(n.body,i,e);else if(i?.type===`VariableDeclaration`){let t=i.declarations.find(e=>e.id?.type===`Identifier`&&e.id.name===r);t?.init?.type===`ArrowFunctionExpression`&&(a(n.body,t.init,e),o(n.body,t.init,e))}}}}}})});export{r as RULE_NAME,s as default};
2
+ //# sourceMappingURL=invalid-handler-params.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-handler-params.mjs","names":["type"],"sources":["../../src/rules/invalid-handler-params.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport type { TSESTree } from \"@typescript-eslint/utils\";\nimport { AST_NODE_TYPES } from \"@typescript-eslint/utils\";\nimport type { RuleContext } from \"@typescript-eslint/utils/ts-eslint\";\nimport { createRule } from \"../helpers/create-rule\";\n\nexport const RULE_NAME = \"invalid-handler-params\";\nexport type MessageIds = \"invalidOptionsParam\" | \"invalidArgsParam\";\nexport type Options = [];\n\nfunction getTypeNode(param: TSESTree.Parameter): TSESTree.TypeNode | null {\n switch (param.type) {\n case AST_NODE_TYPES.Identifier:\n return param.typeAnnotation ? param.typeAnnotation.typeAnnotation : null;\n\n case AST_NODE_TYPES.AssignmentPattern: {\n const left = param.left;\n if (left.type === AST_NODE_TYPES.Identifier && left.typeAnnotation) {\n return left.typeAnnotation.typeAnnotation;\n }\n return null;\n }\n\n case AST_NODE_TYPES.RestElement: {\n const arg = param.argument;\n if (arg.type === AST_NODE_TYPES.Identifier && arg.typeAnnotation) {\n return arg.typeAnnotation.typeAnnotation;\n }\n return null;\n }\n\n case AST_NODE_TYPES.ArrayPattern:\n case AST_NODE_TYPES.ObjectPattern:\n case AST_NODE_TYPES.TSParameterProperty:\n default:\n return null;\n }\n}\n\n/**\n * Checks the validity of the command handler function's options parameters.\n *\n * @remarks\n * The first parameter should represent the command's potential options, and as a result, it must be an object type with properties.\n *\n * @param body - The body of the program, used to check for type/interface declarations when validating the options parameter.\n * @param node - The function node representing the command handler, used to access its parameters and validate their types.\n * @param context - The ESLint rule context, used to report any validation errors found in the parameters.\n */\nfunction checkOptionsParam(\n body: TSESTree.ProgramStatement[],\n node: TSESTree.FunctionDeclaration | TSESTree.ArrowFunctionExpression,\n context: Readonly<RuleContext<\"invalidOptionsParam\", []>>\n) {\n if (node.params.length > 0 && node.params[0]) {\n const type = getTypeNode(node.params[0]);\n if (!type) {\n context.report({\n node: node.params[0],\n messageId: \"invalidOptionsParam\"\n });\n }\n\n if (\n type!.type === AST_NODE_TYPES.TSTypeLiteral &&\n type.members.some(\n member => member.type === AST_NODE_TYPES.TSPropertySignature\n )\n ) {\n return;\n } else if (\n type!.type === AST_NODE_TYPES.TSIntersectionType &&\n type.types.some(\n type =>\n type.type === AST_NODE_TYPES.TSTypeLiteral &&\n type.members.some(\n member => member.type === AST_NODE_TYPES.TSPropertySignature\n )\n )\n ) {\n return;\n } else if (\n type!.type === AST_NODE_TYPES.TSTypeReference &&\n type.typeName.type === AST_NODE_TYPES.Identifier\n ) {\n const typeName = type.typeName.name;\n if (\n !body.some(\n localBlock =>\n (localBlock.type === AST_NODE_TYPES.TSInterfaceDeclaration &&\n localBlock.id.name === typeName) ||\n (localBlock.type === AST_NODE_TYPES.TSTypeAliasDeclaration &&\n localBlock.id.name === typeName &&\n ((localBlock.typeAnnotation.type ===\n AST_NODE_TYPES.TSTypeLiteral &&\n localBlock.typeAnnotation.members.some(\n member => member.type === AST_NODE_TYPES.TSPropertySignature\n )) ||\n (localBlock.typeAnnotation.type ===\n AST_NODE_TYPES.TSIntersectionType &&\n localBlock.typeAnnotation.types.some(\n type =>\n type.type === AST_NODE_TYPES.TSTypeLiteral &&\n type.members.some(\n member =>\n member.type === AST_NODE_TYPES.TSPropertySignature\n )\n ))))\n )\n ) {\n return;\n }\n }\n\n context.report({\n node: type!,\n messageId: \"invalidOptionsParam\"\n });\n }\n}\n\n/**\n * Checks the validity of the command handler function's positional argument parameters.\n *\n * @remarks\n * All parameters except the first should represent the command's positional arguments, and as a result, their types must be included in the following list:\n * - string\n * - number\n * - boolean\n * - string[]\n * - number[]\n *\n * @param body - The body of the program, used to check for type/interface declarations when validating the args parameters.\n * @param node - The function node representing the command handler, used to access its parameters and validate their types.\n * @param context - The ESLint rule context, used to report any validation errors found in the parameters.\n */\nfunction checkArgsParam(\n body: TSESTree.ProgramStatement[],\n node: TSESTree.FunctionDeclaration | TSESTree.ArrowFunctionExpression,\n context: Readonly<RuleContext<\"invalidArgsParam\", []>>\n) {\n if (node.params.length > 1) {\n node.params.slice(1).forEach(param => {\n const type = getTypeNode(param);\n if (\n type?.type !== AST_NODE_TYPES.TSStringKeyword &&\n type?.type !== AST_NODE_TYPES.TSNumberKeyword &&\n type?.type !== AST_NODE_TYPES.TSBooleanKeyword &&\n !(\n type?.type === AST_NODE_TYPES.TSArrayType &&\n (type.elementType.type === AST_NODE_TYPES.TSStringKeyword ||\n type.elementType.type === AST_NODE_TYPES.TSNumberKeyword)\n )\n ) {\n context.report({\n node: type!,\n messageId: \"invalidArgsParam\"\n });\n }\n });\n }\n}\n\nexport default createRule<Options, MessageIds>({\n name: RULE_NAME,\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"The command handler function must have a valid parameter types.\"\n },\n schema: [],\n messages: {\n invalidOptionsParam:\n \"The command handler function's first parameter should represent the command's potential options. As a result, it must be an object type with properties.\",\n invalidArgsParam:\n \"All command handler function parameters except the first should represent the command's positional arguments. As a result, their types must be included in the following list: \\\\n- string \\\\n- number \\\\n- boolean \\\\n- string[] \\\\n- number[]\"\n }\n },\n defaultOptions: [],\n create: context => {\n return {\n Program(node) {\n const fileName = context.filename ?? context.getFilename();\n if (\n findFileName(fileName, {\n withExtension: false\n }) !== \"command\"\n ) {\n return;\n }\n\n for (const block of node.body) {\n if (block.type === \"ExportDefaultDeclaration\") {\n // export default async function handler() {...}\n if (block.declaration?.type === \"FunctionDeclaration\") {\n if (block.declaration.params.length > 0) {\n checkOptionsParam(node.body, block.declaration, context);\n checkArgsParam(node.body, block.declaration, context);\n }\n } else if (block.declaration?.type === \"Identifier\") {\n // async function handler() {...}; export default handler;\n const targetName = block.declaration.name;\n const functionDeclaration = node.body.find(\n localBlock =>\n (localBlock.type === \"FunctionDeclaration\" &&\n localBlock.id.name === targetName) ||\n (localBlock.type === \"VariableDeclaration\" &&\n localBlock.declarations.find(\n declaration =>\n declaration.id?.type === \"Identifier\" &&\n declaration.id.name === targetName\n ))\n );\n if (functionDeclaration?.type === \"FunctionDeclaration\") {\n checkOptionsParam(node.body, functionDeclaration, context);\n checkArgsParam(node.body, functionDeclaration, context);\n } else if (functionDeclaration?.type === \"VariableDeclaration\") {\n const varDeclarator = functionDeclaration.declarations.find(\n declaration =>\n declaration.id?.type === \"Identifier\" &&\n declaration.id.name === targetName\n );\n if (varDeclarator?.init?.type === \"ArrowFunctionExpression\") {\n checkOptionsParam(node.body, varDeclarator.init, context);\n checkArgsParam(node.body, varDeclarator.init, context);\n }\n }\n }\n }\n }\n }\n };\n }\n});\n"],"mappings":"4KAwBA,MAAa,EAAY,yBAIzB,SAAS,EAAY,EAAqD,CACxE,OAAQ,EAAM,KAAd,CACE,KAAK,EAAe,WAClB,OAAO,EAAM,eAAiB,EAAM,eAAe,eAAiB,KAEtE,KAAK,EAAe,kBAAmB,CACrC,IAAM,EAAO,EAAM,KAInB,OAHI,EAAK,OAAS,EAAe,YAAc,EAAK,eAC3C,EAAK,eAAe,eAEtB,KAGT,KAAK,EAAe,YAAa,CAC/B,IAAM,EAAM,EAAM,SAIlB,OAHI,EAAI,OAAS,EAAe,YAAc,EAAI,eACzC,EAAI,eAAe,eAErB,KAGT,KAAK,EAAe,aACpB,KAAK,EAAe,cACpB,KAAK,EAAe,oBACpB,QACE,OAAO,MAcb,SAAS,EACP,EACA,EACA,EACA,CACA,GAAI,EAAK,OAAO,OAAS,GAAK,EAAK,OAAO,GAAI,CAC5C,IAAM,EAAO,EAAY,EAAK,OAAO,GAAG,IACnC,GACH,EAAQ,OAAO,CACb,KAAM,EAAK,OAAO,GAClB,UAAW,sBACZ,CAAC,CAIF,EAAM,OAAS,EAAe,eAC9B,EAAK,QAAQ,KACX,GAAU,EAAO,OAAS,EAAe,oBAC1C,EAID,EAAM,OAAS,EAAe,oBAC9B,EAAK,MAAM,KACT,GACEA,EAAK,OAAS,EAAe,eAC7BA,EAAK,QAAQ,KACX,GAAU,EAAO,OAAS,EAAe,oBAC1C,CACJ,CAED,UAEA,EAAM,OAAS,EAAe,iBAC9B,EAAK,SAAS,OAAS,EAAe,WACtC,CACA,IAAM,EAAW,EAAK,SAAS,KAC/B,GACE,CAAC,EAAK,KACJ,GACG,EAAW,OAAS,EAAe,wBAClC,EAAW,GAAG,OAAS,GACxB,EAAW,OAAS,EAAe,wBAClC,EAAW,GAAG,OAAS,IACrB,EAAW,eAAe,OAC1B,EAAe,eACf,EAAW,eAAe,QAAQ,KAChC,GAAU,EAAO,OAAS,EAAe,oBAC1C,EACA,EAAW,eAAe,OACzB,EAAe,oBACf,EAAW,eAAe,MAAM,KAC9B,GACEA,EAAK,OAAS,EAAe,eAC7BA,EAAK,QAAQ,KACX,GACE,EAAO,OAAS,EAAe,oBAClC,CACJ,EACV,CAED,OAIJ,EAAQ,OAAO,CACb,KAAM,EACN,UAAW,sBACZ,CAAC,EAmBN,SAAS,EACP,EACA,EACA,EACA,CACI,EAAK,OAAO,OAAS,GACvB,EAAK,OAAO,MAAM,EAAE,CAAC,QAAQ,GAAS,CACpC,IAAM,EAAO,EAAY,EAAM,CAE7B,GAAM,OAAS,EAAe,iBAC9B,GAAM,OAAS,EAAe,iBAC9B,GAAM,OAAS,EAAe,kBAC9B,EACE,GAAM,OAAS,EAAe,cAC7B,EAAK,YAAY,OAAS,EAAe,iBACxC,EAAK,YAAY,OAAS,EAAe,mBAG7C,EAAQ,OAAO,CACb,KAAM,EACN,UAAW,mBACZ,CAAC,EAEJ,CAIN,IAAA,EAAe,EAAgC,CAC7C,KAAM,EACN,KAAM,CACJ,KAAM,UACN,KAAM,CACJ,YACE,kEACH,CACD,OAAQ,EAAE,CACV,SAAU,CACR,oBACE,2JACF,iBACE,kPACH,CACF,CACD,eAAgB,EAAE,CAClB,OAAQ,IACC,CACL,QAAQ,EAAM,CAGV,KAFe,EAAQ,UAAY,EAAQ,aAAa,CAEjC,CACrB,cAAe,GAChB,CAAC,GAAK,UAKT,KAAK,IAAM,KAAS,EAAK,KACvB,GAAI,EAAM,OAAS,+BAEb,EAAM,aAAa,OAAS,sBAC1B,EAAM,YAAY,OAAO,OAAS,IACpC,EAAkB,EAAK,KAAM,EAAM,YAAa,EAAQ,CACxD,EAAe,EAAK,KAAM,EAAM,YAAa,EAAQ,UAE9C,EAAM,aAAa,OAAS,aAAc,CAEnD,IAAM,EAAa,EAAM,YAAY,KAC/B,EAAsB,EAAK,KAAK,KACpC,GACG,EAAW,OAAS,uBACnB,EAAW,GAAG,OAAS,GACxB,EAAW,OAAS,uBACnB,EAAW,aAAa,KACtB,GACE,EAAY,IAAI,OAAS,cACzB,EAAY,GAAG,OAAS,EAC3B,CACN,CACD,GAAI,GAAqB,OAAS,sBAChC,EAAkB,EAAK,KAAM,EAAqB,EAAQ,CAC1D,EAAe,EAAK,KAAM,EAAqB,EAAQ,SAC9C,GAAqB,OAAS,sBAAuB,CAC9D,IAAM,EAAgB,EAAoB,aAAa,KACrD,GACE,EAAY,IAAI,OAAS,cACzB,EAAY,GAAG,OAAS,EAC3B,CACG,GAAe,MAAM,OAAS,4BAChC,EAAkB,EAAK,KAAM,EAAc,KAAM,EAAQ,CACzD,EAAe,EAAK,KAAM,EAAc,KAAM,EAAQ,OAOnE,EAEJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/eslint-plugin",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "description": "An ESLint Plugin with linting rules that ensure a Shell Shock project is following the best practices.",
6
6
  "repository": {
@@ -41,24 +41,105 @@
41
41
  "main": "./dist/index.cjs",
42
42
  "module": "./dist/index.mjs",
43
43
  "exports": {
44
- ".": { "require": "./dist/index.cjs", "import": "./dist/index.mjs" },
44
+ ".": {
45
+ "require": {
46
+ "types": "./dist/index.d.cts",
47
+ "default": "./dist/index.cjs"
48
+ },
49
+ "import": {
50
+ "types": "./dist/index.d.mts",
51
+ "default": "./dist/index.mjs"
52
+ },
53
+ "default": {
54
+ "types": "./dist/index.d.mts",
55
+ "default": "./dist/index.mjs"
56
+ }
57
+ },
45
58
  "./configs": {
46
- "require": "./dist/configs/index.cjs",
47
- "import": "./dist/configs/index.mjs"
59
+ "require": {
60
+ "types": "./dist/configs/index.d.cts",
61
+ "default": "./dist/configs/index.cjs"
62
+ },
63
+ "import": {
64
+ "types": "./dist/configs/index.d.mts",
65
+ "default": "./dist/configs/index.mjs"
66
+ },
67
+ "default": {
68
+ "types": "./dist/configs/index.d.mts",
69
+ "default": "./dist/configs/index.mjs"
70
+ }
48
71
  },
49
72
  "./configs/base": {
50
- "require": "./dist/configs/base.cjs",
51
- "import": "./dist/configs/base.mjs"
73
+ "require": {
74
+ "types": "./dist/configs/base.d.cts",
75
+ "default": "./dist/configs/base.cjs"
76
+ },
77
+ "import": {
78
+ "types": "./dist/configs/base.d.mts",
79
+ "default": "./dist/configs/base.mjs"
80
+ },
81
+ "default": {
82
+ "types": "./dist/configs/base.d.mts",
83
+ "default": "./dist/configs/base.mjs"
84
+ }
52
85
  },
86
+ "./package.json": "./package.json",
53
87
  "./plugin": {
54
- "require": "./dist/plugin.cjs",
55
- "import": "./dist/plugin.mjs"
88
+ "require": {
89
+ "types": "./dist/plugin.d.cts",
90
+ "default": "./dist/plugin.cjs"
91
+ },
92
+ "import": {
93
+ "types": "./dist/plugin.d.mts",
94
+ "default": "./dist/plugin.mjs"
95
+ },
96
+ "default": {
97
+ "types": "./dist/plugin.d.mts",
98
+ "default": "./dist/plugin.mjs"
99
+ }
100
+ },
101
+ "./rules/duplicate-command-path": {
102
+ "require": {
103
+ "types": "./dist/rules/duplicate-command-path.d.cts",
104
+ "default": "./dist/rules/duplicate-command-path.cjs"
105
+ },
106
+ "import": {
107
+ "types": "./dist/rules/duplicate-command-path.d.mts",
108
+ "default": "./dist/rules/duplicate-command-path.mjs"
109
+ },
110
+ "default": {
111
+ "types": "./dist/rules/duplicate-command-path.d.mts",
112
+ "default": "./dist/rules/duplicate-command-path.mjs"
113
+ }
56
114
  },
57
- "./rules/invalid-command-path": {
58
- "require": "./dist/rules/invalid-command-path.cjs",
59
- "import": "./dist/rules/invalid-command-path.mjs"
115
+ "./rules/invalid-command-export": {
116
+ "require": {
117
+ "types": "./dist/rules/invalid-command-export.d.cts",
118
+ "default": "./dist/rules/invalid-command-export.cjs"
119
+ },
120
+ "import": {
121
+ "types": "./dist/rules/invalid-command-export.d.mts",
122
+ "default": "./dist/rules/invalid-command-export.mjs"
123
+ },
124
+ "default": {
125
+ "types": "./dist/rules/invalid-command-export.d.mts",
126
+ "default": "./dist/rules/invalid-command-export.mjs"
127
+ }
60
128
  },
61
- "./package.json": "./package.json"
129
+ "./rules/invalid-handler-params": {
130
+ "require": {
131
+ "types": "./dist/rules/invalid-handler-params.d.cts",
132
+ "default": "./dist/rules/invalid-handler-params.cjs"
133
+ },
134
+ "import": {
135
+ "types": "./dist/rules/invalid-handler-params.d.mts",
136
+ "default": "./dist/rules/invalid-handler-params.mjs"
137
+ },
138
+ "default": {
139
+ "types": "./dist/rules/invalid-handler-params.d.mts",
140
+ "default": "./dist/rules/invalid-handler-params.mjs"
141
+ }
142
+ }
62
143
  },
63
144
  "types": "./dist/index.d.cts",
64
145
  "typings": "dist/index.d.mts",
@@ -66,23 +147,30 @@
66
147
  "keywords": ["eslint", "eslint-plugin", "shell-shock", "storm-software"],
67
148
  "peerDependencies": {
68
149
  "eslint": "^9.39.2",
69
- "@powerlines/plugin-tsdown": "0.1.184",
70
- "powerlines": "0.37.102"
150
+ "@powerlines/plugin-tsdown": ">=0.1.224",
151
+ "powerlines": ">=0.38.38"
71
152
  },
72
153
  "peerDependenciesMeta": { "eslint": { "optional": false } },
73
- "dependencies": { "@typescript-eslint/utils": "^8.55.0", "defu": "^6.1.4" },
154
+ "dependencies": {
155
+ "@stryke/fs": "^0.33.43",
156
+ "@stryke/path": "0.26.6",
157
+ "@typescript-eslint/utils": "^8.55.0",
158
+ "defu": "^6.1.4"
159
+ },
74
160
  "devDependencies": {
75
161
  "@eslint/config-inspector": "^1.4.2",
162
+ "@powerlines/plugin-tsdown": "^0.1.224",
76
163
  "@storm-software/eslint": "^0.169.83",
77
164
  "@types/eslint": "^9.6.1",
78
165
  "@types/eslint__js": "^9.14.0",
79
- "@types/node": "^22.19.10",
166
+ "@types/node": "^22.19.11",
80
167
  "eslint": "^9.39.2",
81
168
  "eslint-doc-generator": "^3.0.2",
82
169
  "eslint-plugin-eslint-plugin": "^7.3.0",
83
170
  "eslint-plugin-i18n-text": "^1.0.1",
84
171
  "eslint-rule-documentation": "^1.0.23",
85
- "eslint-typegen": "^2.3.0"
172
+ "eslint-typegen": "^2.3.0",
173
+ "powerlines": "^0.38.38"
86
174
  },
87
175
  "publishConfig": {
88
176
  "access": "public",
@@ -100,12 +188,20 @@
100
188
  "require": "./dist/plugin.cjs",
101
189
  "import": "./dist/plugin.mjs"
102
190
  },
103
- "./rules/invalid-command-path": {
104
- "require": "./dist/rules/invalid-command-path.cjs",
105
- "import": "./dist/rules/invalid-command-path.mjs"
191
+ "./rules/duplicate-command-path": {
192
+ "require": "./dist/rules/duplicate-command-path.cjs",
193
+ "import": "./dist/rules/duplicate-command-path.mjs"
194
+ },
195
+ "./rules/invalid-command-export": {
196
+ "require": "./dist/rules/invalid-command-export.cjs",
197
+ "import": "./dist/rules/invalid-command-export.mjs"
198
+ },
199
+ "./rules/invalid-handler-params": {
200
+ "require": "./dist/rules/invalid-handler-params.cjs",
201
+ "import": "./dist/rules/invalid-handler-params.mjs"
106
202
  },
107
203
  "./package.json": "./package.json"
108
204
  }
109
205
  },
110
- "gitHead": "29463ac608044d8268c0fcd661e83def6cf7fb07"
206
+ "gitHead": "b748bcb948ef2c11eca8e4259c76afb65ce963f0"
111
207
  }
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`../helpers/create-rule.cjs`),t=`storm-urls-only`;var n=e.createEslintRule({name:t,meta:{type:`problem`,docs:{description:"Prefer usage of `StormURL` class when using Storm Stack"},fixable:`code`,schema:[],messages:{stormURLsOnly:"When using Storm Stack, source code should use `StormURL` instead of the base `URL` class."}},defaultOptions:[],create:e=>({NewExpression(t){t.callee.type===`Identifier`&&t.callee.name===`URL`&&e.report({node:t,messageId:`stormURLsOnly`,fix(e){return e.replaceText(t.callee,`StormError`)}})},CallExpression(t){t.callee.type===`Identifier`&&t.callee.name===`URL`&&e.report({node:t,messageId:`stormURLsOnly`,fix(e){return e.replaceText(t.callee,`StormURL`)}})}})});exports.RULE_NAME=t,exports.default=n;
@@ -1,9 +0,0 @@
1
- import { RuleModule } from "../helpers/create-rule.cjs";
2
-
3
- //#region src/rules/invalid-command-path.d.ts
4
- declare const RULE_NAME = "storm-urls-only";
5
- type MessageIds = "stormURLsOnly";
6
- type Options = [];
7
- declare const _default: RuleModule<[]>;
8
- //#endregion
9
- export { MessageIds, Options, RULE_NAME, _default as default };
@@ -1,9 +0,0 @@
1
- import { RuleModule } from "../helpers/create-rule.mjs";
2
-
3
- //#region src/rules/invalid-command-path.d.ts
4
- declare const RULE_NAME = "storm-urls-only";
5
- type MessageIds = "stormURLsOnly";
6
- type Options = [];
7
- declare const _default: RuleModule<[]>;
8
- //#endregion
9
- export { MessageIds, Options, RULE_NAME, _default as default };
@@ -1 +0,0 @@
1
- import{createEslintRule as e}from"../helpers/create-rule.mjs";const t=`storm-urls-only`;var n=e({name:t,meta:{type:`problem`,docs:{description:"Prefer usage of `StormURL` class when using Storm Stack"},fixable:`code`,schema:[],messages:{stormURLsOnly:"When using Storm Stack, source code should use `StormURL` instead of the base `URL` class."}},defaultOptions:[],create:e=>({NewExpression(t){t.callee.type===`Identifier`&&t.callee.name===`URL`&&e.report({node:t,messageId:`stormURLsOnly`,fix(e){return e.replaceText(t.callee,`StormError`)}})},CallExpression(t){t.callee.type===`Identifier`&&t.callee.name===`URL`&&e.report({node:t,messageId:`stormURLsOnly`,fix(e){return e.replaceText(t.callee,`StormURL`)}})}})});export{t as RULE_NAME,n as default};