solhint-plugin-mud 2.2.15-main-c3c209ef0aba141416824a1613ccd1fe077adee1 → 2.2.16-54e5c06dd4606d2484a790cd1d531931d634d7a1

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.js CHANGED
@@ -1,2 +1,2 @@
1
- var l=Object.create;var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var u=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of y(t))!S.call(r,s)&&s!==e&&a(r,s,{get:()=>t[s],enumerable:!(i=h(t,s))||i.enumerable});return r};var C=(r,t,e)=>(e=r!=null?l(d(r)):{},u(t||!r||!r.__esModule?a(e,"default",{value:r,enumerable:!0}):e,r));var n=class{ruleId="no-msg-sender";reporter;config;isSystemOrLibrary=!1;constructor(t,e){this.reporter=t,this.config=e}ContractDefinition(t){let{name:e,kind:i}=t;this.isSystemOrLibrary=i==="library"||i==="contract"&&e.endsWith("System")}"ContractDefinition:exit"(){this.isSystemOrLibrary=!1}MemberAccess(t){let{expression:e,memberName:i}=t;e.type==="Identifier"&&i==="sender"&&this.reporter.error(t,this.ruleId,'Systems and their libraries should use "_msgSender()" or "_world()" instead of "msg.sender".')}};var c=C(require("path")),m=require("@solidity-parser/parser"),o=class{ruleId="system-file-name";reporter;config;expectedContractName;isSystemFile=!1;constructor(t,e,i,s){this.reporter=t,this.config=e,this.expectedContractName=c.default.basename(s,".sol"),this.expectedContractName.endsWith("System")&&this.expectedContractName!=="System"&&!this.expectedContractName.match(/^I[A-Z]/)&&(this.isSystemFile=!0)}SourceUnit(t){if(!this.isSystemFile)return;let e=this.expectedContractName,i=!1;(0,m.visit)(t,{ContractDefinition(s){let{name:p,kind:f}=s;f==="contract"&&p===e&&(i=!0)}}),i||this.reporter.error(t,this.ruleId,`System file must contain a contract with a matching name "${e}"`)}};module.exports=[n,o];
1
+ "use strict";var l=Object.create;var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var u=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of y(t))!S.call(r,s)&&s!==e&&a(r,s,{get:()=>t[s],enumerable:!(i=h(t,s))||i.enumerable});return r};var C=(r,t,e)=>(e=r!=null?l(d(r)):{},u(t||!r||!r.__esModule?a(e,"default",{value:r,enumerable:!0}):e,r));var n=class{constructor(t,e){this.ruleId="no-msg-sender";this.isSystemOrLibrary=!1;this.reporter=t,this.config=e}ContractDefinition(t){let{name:e,kind:i}=t;this.isSystemOrLibrary=i==="library"||i==="contract"&&e.endsWith("System")}"ContractDefinition:exit"(){this.isSystemOrLibrary=!1}MemberAccess(t){let{expression:e,memberName:i}=t;e.type==="Identifier"&&i==="sender"&&this.reporter.error(t,this.ruleId,'Systems and their libraries should use "_msgSender()" or "_world()" instead of "msg.sender".')}};var c=C(require("path")),m=require("@solidity-parser/parser"),o=class{constructor(t,e,i,s){this.ruleId="system-file-name";this.isSystemFile=!1;this.reporter=t,this.config=e,this.expectedContractName=c.default.basename(s,".sol"),this.expectedContractName.endsWith("System")&&this.expectedContractName!=="System"&&!this.expectedContractName.match(/^I[A-Z]/)&&(this.isSystemFile=!0)}SourceUnit(t){if(!this.isSystemFile)return;let e=this.expectedContractName,i=!1;(0,m.visit)(t,{ContractDefinition(s){let{name:p,kind:f}=s;f==="contract"&&p===e&&(i=!0)}}),i||this.reporter.error(t,this.ruleId,`System file must contain a contract with a matching name "${e}"`)}};module.exports=[n,o];
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/rules/NoMsgSender.ts","../src/rules/SystemFileName.ts","../src/index.ts"],"sourcesContent":["import type { ContractDefinition, MemberAccess } from \"@solidity-parser/parser/dist/src/ast-types\";\nimport { SolhintRule } from \"../solhintTypes\";\n\nexport class NoMsgSender implements SolhintRule {\n ruleId = \"no-msg-sender\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n reporter: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any;\n\n isSystemOrLibrary = false;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(reporter: any, config: any) {\n this.reporter = reporter;\n this.config = config;\n }\n\n ContractDefinition(node: ContractDefinition) {\n const { name, kind } = node;\n\n this.isSystemOrLibrary = kind === \"library\" || (kind === \"contract\" && name.endsWith(\"System\"));\n }\n\n \"ContractDefinition:exit\"() {\n this.isSystemOrLibrary = false;\n }\n\n MemberAccess(node: MemberAccess) {\n const { expression, memberName } = node;\n if (expression.type === \"Identifier\" && memberName === \"sender\") {\n this.reporter.error(\n node,\n this.ruleId,\n `Systems and their libraries should use \"_msgSender()\" or \"_world()\" instead of \"msg.sender\".`,\n );\n }\n }\n}\n","import path from \"path\";\nimport { visit } from \"@solidity-parser/parser\";\nimport type { ContractDefinition, SourceUnit } from \"@solidity-parser/parser/dist/src/ast-types\";\nimport { SolhintRule } from \"../solhintTypes\";\n\nexport class SystemFileName implements SolhintRule {\n ruleId = \"system-file-name\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n reporter: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any;\n\n expectedContractName: string;\n isSystemFile = false;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(reporter: any, config: any, inputSrc: string, fileName: string) {\n this.reporter = reporter;\n this.config = config;\n\n this.expectedContractName = path.basename(fileName, \".sol\");\n if (\n this.expectedContractName.endsWith(\"System\") &&\n this.expectedContractName !== \"System\" &&\n !this.expectedContractName.match(/^I[A-Z]/)\n ) {\n this.isSystemFile = true;\n }\n }\n\n SourceUnit(node: SourceUnit) {\n // only systems need a matching contract\n if (!this.isSystemFile) return;\n const expectedContractName = this.expectedContractName;\n\n // search the source file for a matching contract name\n let withMatchingContract = false;\n visit(node, {\n ContractDefinition(node: ContractDefinition) {\n const { name, kind } = node;\n\n if (kind === \"contract\" && name === expectedContractName) {\n withMatchingContract = true;\n }\n },\n });\n\n if (!withMatchingContract) {\n this.reporter.error(\n node,\n this.ruleId,\n `System file must contain a contract with a matching name \"${expectedContractName}\"`,\n );\n }\n }\n}\n","import { NoMsgSender } from \"./rules/NoMsgSender\";\nimport { SystemFileName } from \"./rules/SystemFileName\";\n\nexport = [NoMsgSender, SystemFileName];\n"],"mappings":"2cAGO,IAAMA,EAAN,KAAyC,CAC9C,OAAS,gBAET,SAEA,OAEA,kBAAoB,GAGpB,YAAYC,EAAeC,EAAa,CACtC,KAAK,SAAWD,EAChB,KAAK,OAASC,CAChB,CAEA,mBAAmBC,EAA0B,CAC3C,GAAM,CAAE,KAAAC,EAAM,KAAAC,CAAK,EAAIF,EAEvB,KAAK,kBAAoBE,IAAS,WAAcA,IAAS,YAAcD,EAAK,SAAS,QAAQ,CAC/F,CAEA,2BAA4B,CAC1B,KAAK,kBAAoB,EAC3B,CAEA,aAAaD,EAAoB,CAC/B,GAAM,CAAE,WAAAG,EAAY,WAAAC,CAAW,EAAIJ,EAC/BG,EAAW,OAAS,cAAgBC,IAAe,UACrD,KAAK,SAAS,MACZJ,EACA,KAAK,OACL,8FACF,CAEJ,CACF,ECtCA,IAAAK,EAAiB,mBACjBC,EAAsB,mCAITC,EAAN,KAA4C,CACjD,OAAS,mBAET,SAEA,OAEA,qBACA,aAAe,GAGf,YAAYC,EAAeC,EAAaC,EAAkBC,EAAkB,CAC1E,KAAK,SAAWH,EAChB,KAAK,OAASC,EAEd,KAAK,qBAAuB,EAAAG,QAAK,SAASD,EAAU,MAAM,EAExD,KAAK,qBAAqB,SAAS,QAAQ,GAC3C,KAAK,uBAAyB,UAC9B,CAAC,KAAK,qBAAqB,MAAM,SAAS,IAE1C,KAAK,aAAe,GAExB,CAEA,WAAWE,EAAkB,CAE3B,GAAI,CAAC,KAAK,aAAc,OACxB,IAAMC,EAAuB,KAAK,qBAG9BC,EAAuB,MAC3B,SAAMF,EAAM,CACV,mBAAmBA,EAA0B,CAC3C,GAAM,CAAE,KAAAG,EAAM,KAAAC,CAAK,EAAIJ,EAEnBI,IAAS,YAAcD,IAASF,IAClCC,EAAuB,GAE3B,CACF,CAAC,EAEIA,GACH,KAAK,SAAS,MACZF,EACA,KAAK,OACL,6DAA6DC,IAC/D,CAEJ,CACF,ECpDA,eAAS,CAACI,EAAaC,CAAc","names":["NoMsgSender","reporter","config","node","name","kind","expression","memberName","import_path","import_parser","SystemFileName","reporter","config","inputSrc","fileName","path","node","expectedContractName","withMatchingContract","name","kind","NoMsgSender","SystemFileName"]}
1
+ {"version":3,"sources":["../src/rules/NoMsgSender.ts","../src/rules/SystemFileName.ts","../src/index.ts"],"sourcesContent":["import type { ContractDefinition, MemberAccess } from \"@solidity-parser/parser/dist/src/ast-types\";\nimport { SolhintRule } from \"../solhintTypes\";\n\nexport class NoMsgSender implements SolhintRule {\n ruleId = \"no-msg-sender\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n reporter: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any;\n\n isSystemOrLibrary = false;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(reporter: any, config: any) {\n this.reporter = reporter;\n this.config = config;\n }\n\n ContractDefinition(node: ContractDefinition) {\n const { name, kind } = node;\n\n this.isSystemOrLibrary = kind === \"library\" || (kind === \"contract\" && name.endsWith(\"System\"));\n }\n\n \"ContractDefinition:exit\"() {\n this.isSystemOrLibrary = false;\n }\n\n MemberAccess(node: MemberAccess) {\n const { expression, memberName } = node;\n if (expression.type === \"Identifier\" && memberName === \"sender\") {\n this.reporter.error(\n node,\n this.ruleId,\n `Systems and their libraries should use \"_msgSender()\" or \"_world()\" instead of \"msg.sender\".`,\n );\n }\n }\n}\n","import path from \"path\";\nimport { visit } from \"@solidity-parser/parser\";\nimport type { ContractDefinition, SourceUnit } from \"@solidity-parser/parser/dist/src/ast-types\";\nimport { SolhintRule } from \"../solhintTypes\";\n\nexport class SystemFileName implements SolhintRule {\n ruleId = \"system-file-name\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n reporter: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any;\n\n expectedContractName: string;\n isSystemFile = false;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(reporter: any, config: any, inputSrc: string, fileName: string) {\n this.reporter = reporter;\n this.config = config;\n\n this.expectedContractName = path.basename(fileName, \".sol\");\n if (\n this.expectedContractName.endsWith(\"System\") &&\n this.expectedContractName !== \"System\" &&\n !this.expectedContractName.match(/^I[A-Z]/)\n ) {\n this.isSystemFile = true;\n }\n }\n\n SourceUnit(node: SourceUnit) {\n // only systems need a matching contract\n if (!this.isSystemFile) return;\n const expectedContractName = this.expectedContractName;\n\n // search the source file for a matching contract name\n let withMatchingContract = false;\n visit(node, {\n ContractDefinition(node: ContractDefinition) {\n const { name, kind } = node;\n\n if (kind === \"contract\" && name === expectedContractName) {\n withMatchingContract = true;\n }\n },\n });\n\n if (!withMatchingContract) {\n this.reporter.error(\n node,\n this.ruleId,\n `System file must contain a contract with a matching name \"${expectedContractName}\"`,\n );\n }\n }\n}\n","import { NoMsgSender } from \"./rules/NoMsgSender\";\nimport { SystemFileName } from \"./rules/SystemFileName\";\n\nexport = [NoMsgSender, SystemFileName];\n"],"mappings":"wdAGO,IAAMA,EAAN,KAAyC,CAU9C,YAAYC,EAAeC,EAAa,CATxC,YAAS,gBAMT,uBAAoB,GAIlB,KAAK,SAAWD,EAChB,KAAK,OAASC,CAChB,CAEA,mBAAmBC,EAA0B,CAC3C,GAAM,CAAE,KAAAC,EAAM,KAAAC,CAAK,EAAIF,EAEvB,KAAK,kBAAoBE,IAAS,WAAcA,IAAS,YAAcD,EAAK,SAAS,QAAQ,CAC/F,CAEA,2BAA4B,CAC1B,KAAK,kBAAoB,EAC3B,CAEA,aAAaD,EAAoB,CAC/B,GAAM,CAAE,WAAAG,EAAY,WAAAC,CAAW,EAAIJ,EAC/BG,EAAW,OAAS,cAAgBC,IAAe,UACrD,KAAK,SAAS,MACZJ,EACA,KAAK,OACL,8FACF,CAEJ,CACF,ECtCA,IAAAK,EAAiB,mBACjBC,EAAsB,mCAITC,EAAN,KAA4C,CAWjD,YAAYC,EAAeC,EAAaC,EAAkBC,EAAkB,CAV5E,YAAS,mBAOT,kBAAe,GAIb,KAAK,SAAWH,EAChB,KAAK,OAASC,EAEd,KAAK,qBAAuB,EAAAG,QAAK,SAASD,EAAU,MAAM,EAExD,KAAK,qBAAqB,SAAS,QAAQ,GAC3C,KAAK,uBAAyB,UAC9B,CAAC,KAAK,qBAAqB,MAAM,SAAS,IAE1C,KAAK,aAAe,GAExB,CAEA,WAAWE,EAAkB,CAE3B,GAAI,CAAC,KAAK,aAAc,OACxB,IAAMC,EAAuB,KAAK,qBAG9BC,EAAuB,MAC3B,SAAMF,EAAM,CACV,mBAAmBA,EAA0B,CAC3C,GAAM,CAAE,KAAAG,EAAM,KAAAC,CAAK,EAAIJ,EAEnBI,IAAS,YAAcD,IAASF,IAClCC,EAAuB,GAE3B,CACF,CAAC,EAEIA,GACH,KAAK,SAAS,MACZF,EACA,KAAK,OACL,6DAA6DC,CAAoB,GACnF,CAEJ,CACF,ECpDA,eAAS,CAACI,EAAaC,CAAc","names":["NoMsgSender","reporter","config","node","name","kind","expression","memberName","import_path","import_parser","SystemFileName","reporter","config","inputSrc","fileName","path","node","expectedContractName","withMatchingContract","name","kind","NoMsgSender","SystemFileName"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solhint-plugin-mud",
3
- "version": "2.2.15-main-c3c209ef0aba141416824a1613ccd1fe077adee1",
3
+ "version": "2.2.16-54e5c06dd4606d2484a790cd1d531931d634d7a1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/latticexyz/mud.git",
@@ -23,10 +23,6 @@
23
23
  "dependencies": {
24
24
  "@solidity-parser/parser": "^0.16.0"
25
25
  },
26
- "devDependencies": {
27
- "@types/node": "^18.15.11",
28
- "tsup": "^6.7.0"
29
- },
30
26
  "publishConfig": {
31
27
  "access": "public"
32
28
  },