solhint-plugin-mud 2.0.12-main-9be2bb86 → 2.0.12-main-e43c0938

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
- "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{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
+ 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];
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":"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"]}
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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solhint-plugin-mud",
3
- "version": "2.0.12-main-9be2bb86",
3
+ "version": "2.0.12-main-e43c0938",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/latticexyz/mud.git",
@@ -10,7 +10,9 @@
10
10
  "exports": {
11
11
  ".": "./dist/index.js"
12
12
  },
13
- "types": "./src/index.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
14
16
  "dependencies": {
15
17
  "@solidity-parser/parser": "^0.16.0"
16
18
  },
package/CHANGELOG.md DELETED
@@ -1,68 +0,0 @@
1
- # Change Log
2
-
3
- ## 2.0.12-main-9be2bb86
4
-
5
- ## 2.0.11
6
-
7
- ## 2.0.10
8
-
9
- ## 2.0.9
10
-
11
- ## 2.0.8
12
-
13
- ## 2.0.7
14
-
15
- ## 2.0.6
16
-
17
- ## 2.0.5
18
-
19
- ## 2.0.4
20
-
21
- ## 2.0.3
22
-
23
- ## 2.0.2
24
-
25
- ## 2.0.1
26
-
27
- ## 2.0.0
28
-
29
- ## 2.0.0-next.18
30
-
31
- ## 2.0.0-next.17
32
-
33
- ## 2.0.0-next.16
34
-
35
- ## 2.0.0-next.15
36
-
37
- ## 2.0.0-next.14
38
-
39
- ## 2.0.0-next.13
40
-
41
- ## 2.0.0-next.12
42
-
43
- ## 2.0.0-next.11
44
-
45
- ## 2.0.0-next.10
46
-
47
- ## 2.0.0-next.9
48
-
49
- ## 2.0.0-next.8
50
-
51
- ## 2.0.0-next.7
52
-
53
- ## 2.0.0-next.6
54
-
55
- ## 2.0.0-next.5
56
-
57
- ## 2.0.0-next.4
58
-
59
- ## 2.0.0-next.3
60
-
61
- ## 2.0.0-next.2
62
-
63
- ## 2.0.0-next.1
64
-
65
- ## 2.0.0-next.0
66
-
67
- All notable changes to this project will be documented in this file.
68
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- import { NoMsgSender } from "./rules/NoMsgSender";
2
- import { SystemFileName } from "./rules/SystemFileName";
3
-
4
- export = [NoMsgSender, SystemFileName];
@@ -1,39 +0,0 @@
1
- import type { ContractDefinition, MemberAccess } from "@solidity-parser/parser/dist/src/ast-types";
2
- import { SolhintRule } from "../solhintTypes";
3
-
4
- export class NoMsgSender implements SolhintRule {
5
- ruleId = "no-msg-sender";
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- reporter: any;
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- config: any;
10
-
11
- isSystemOrLibrary = false;
12
-
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- constructor(reporter: any, config: any) {
15
- this.reporter = reporter;
16
- this.config = config;
17
- }
18
-
19
- ContractDefinition(node: ContractDefinition) {
20
- const { name, kind } = node;
21
-
22
- this.isSystemOrLibrary = kind === "library" || (kind === "contract" && name.endsWith("System"));
23
- }
24
-
25
- "ContractDefinition:exit"() {
26
- this.isSystemOrLibrary = false;
27
- }
28
-
29
- MemberAccess(node: MemberAccess) {
30
- const { expression, memberName } = node;
31
- if (expression.type === "Identifier" && memberName === "sender") {
32
- this.reporter.error(
33
- node,
34
- this.ruleId,
35
- `Systems and their libraries should use "_msgSender()" or "_world()" instead of "msg.sender".`,
36
- );
37
- }
38
- }
39
- }
@@ -1,56 +0,0 @@
1
- import path from "path";
2
- import { visit } from "@solidity-parser/parser";
3
- import type { ContractDefinition, SourceUnit } from "@solidity-parser/parser/dist/src/ast-types";
4
- import { SolhintRule } from "../solhintTypes";
5
-
6
- export class SystemFileName implements SolhintRule {
7
- ruleId = "system-file-name";
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- reporter: any;
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- config: any;
12
-
13
- expectedContractName: string;
14
- isSystemFile = false;
15
-
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- constructor(reporter: any, config: any, inputSrc: string, fileName: string) {
18
- this.reporter = reporter;
19
- this.config = config;
20
-
21
- this.expectedContractName = path.basename(fileName, ".sol");
22
- if (
23
- this.expectedContractName.endsWith("System") &&
24
- this.expectedContractName !== "System" &&
25
- !this.expectedContractName.match(/^I[A-Z]/)
26
- ) {
27
- this.isSystemFile = true;
28
- }
29
- }
30
-
31
- SourceUnit(node: SourceUnit) {
32
- // only systems need a matching contract
33
- if (!this.isSystemFile) return;
34
- const expectedContractName = this.expectedContractName;
35
-
36
- // search the source file for a matching contract name
37
- let withMatchingContract = false;
38
- visit(node, {
39
- ContractDefinition(node: ContractDefinition) {
40
- const { name, kind } = node;
41
-
42
- if (kind === "contract" && name === expectedContractName) {
43
- withMatchingContract = true;
44
- }
45
- },
46
- });
47
-
48
- if (!withMatchingContract) {
49
- this.reporter.error(
50
- node,
51
- this.ruleId,
52
- `System file must contain a contract with a matching name "${expectedContractName}"`,
53
- );
54
- }
55
- }
56
- }
@@ -1,7 +0,0 @@
1
- export interface SolhintRule {
2
- ruleId: string;
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- reporter: any;
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- config: any;
7
- }