solhint-plugin-mud 2.0.0-next.16 → 2.0.0-next.18

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.0.0-next.18
4
+
5
+ ## 2.0.0-next.17
6
+
3
7
  ## 2.0.0-next.16
4
8
 
5
9
  ## 2.0.0-next.15
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 reporter: any;\n config: any;\n\n isSystemOrLibrary = false;\n\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 reporter: any;\n config: any;\n\n expectedContractName: string;\n isSystemFile = false;\n\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,CAC9C,OAAS,gBACT,SACA,OAEA,kBAAoB,GAEpB,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,ECnCA,IAAAK,EAAiB,mBACjBC,EAAsB,mCAITC,EAAN,KAA4C,CACjD,OAAS,mBACT,SACA,OAEA,qBACA,aAAe,GAEf,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,ECjDA,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,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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solhint-plugin-mud",
3
- "version": "2.0.0-next.16",
3
+ "version": "2.0.0-next.18",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/latticexyz/mud.git",
@@ -21,7 +21,6 @@
21
21
  "publishConfig": {
22
22
  "access": "public"
23
23
  },
24
- "gitHead": "914a1e0ae4a573d685841ca2ea921435057deb8f",
25
24
  "scripts": {
26
25
  "build": "pnpm run build:js",
27
26
  "build:js": "tsup",
@@ -3,11 +3,14 @@ import { SolhintRule } from "../solhintTypes";
3
3
 
4
4
  export class NoMsgSender implements SolhintRule {
5
5
  ruleId = "no-msg-sender";
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
7
  reporter: any;
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
9
  config: any;
8
10
 
9
11
  isSystemOrLibrary = false;
10
12
 
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
14
  constructor(reporter: any, config: any) {
12
15
  this.reporter = reporter;
13
16
  this.config = config;
@@ -29,7 +32,7 @@ export class NoMsgSender implements SolhintRule {
29
32
  this.reporter.error(
30
33
  node,
31
34
  this.ruleId,
32
- `Systems and their libraries should use "_msgSender()" or "_world()" instead of "msg.sender".`
35
+ `Systems and their libraries should use "_msgSender()" or "_world()" instead of "msg.sender".`,
33
36
  );
34
37
  }
35
38
  }
@@ -5,12 +5,15 @@ import { SolhintRule } from "../solhintTypes";
5
5
 
6
6
  export class SystemFileName implements SolhintRule {
7
7
  ruleId = "system-file-name";
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
9
  reporter: any;
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
11
  config: any;
10
12
 
11
13
  expectedContractName: string;
12
14
  isSystemFile = false;
13
15
 
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
17
  constructor(reporter: any, config: any, inputSrc: string, fileName: string) {
15
18
  this.reporter = reporter;
16
19
  this.config = config;
@@ -46,7 +49,7 @@ export class SystemFileName implements SolhintRule {
46
49
  this.reporter.error(
47
50
  node,
48
51
  this.ruleId,
49
- `System file must contain a contract with a matching name "${expectedContractName}"`
52
+ `System file must contain a contract with a matching name "${expectedContractName}"`,
50
53
  );
51
54
  }
52
55
  }
@@ -1,5 +1,7 @@
1
1
  export interface SolhintRule {
2
2
  ruleId: string;
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
4
  reporter: any;
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
6
  config: any;
5
7
  }