{"id":15290563,"url":"https://github.com/goldfinch-eng/solhint-plugin-modifiers","last_synced_at":"2025-07-25T16:32:59.417Z","repository":{"id":57365841,"uuid":"351536654","full_name":"goldfinch-eng/solhint-plugin-modifiers","owner":"goldfinch-eng","description":"solhint plugin for linting function modifiers. Ensure modifiers are present in certain files, contracts, and methods with flexible matching.","archived":false,"fork":false,"pushed_at":"2021-03-26T00:07:37.000Z","size":25,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-19T07:20:54.816Z","etag":null,"topics":["solhint","solhint-plugin","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goldfinch-eng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-25T18:26:57.000Z","updated_at":"2023-05-08T22:42:24.000Z","dependencies_parsed_at":"2022-08-23T20:10:29.617Z","dependency_job_id":null,"html_url":"https://github.com/goldfinch-eng/solhint-plugin-modifiers","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goldfinch-eng%2Fsolhint-plugin-modifiers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goldfinch-eng%2Fsolhint-plugin-modifiers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goldfinch-eng%2Fsolhint-plugin-modifiers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goldfinch-eng%2Fsolhint-plugin-modifiers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goldfinch-eng","download_url":"https://codeload.github.com/goldfinch-eng/solhint-plugin-modifiers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227598473,"owners_count":17791605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["solhint","solhint-plugin","solidity"],"created_at":"2024-09-30T16:08:38.125Z","updated_at":"2024-12-01T16:45:45.181Z","avatar_url":"https://github.com/goldfinch-eng.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# solhint-plugin-modifiers\n\n[![npm version](https://badge.fury.io/js/solhint-plugin-modifiers.svg)](https://badge.fury.io/js/solhint-plugin-modifiers)\n\n[solhint](https://protofire.github.io/solhint/) plugin for linting function modifiers. Ensure modifiers are present in certain files, contracts, and methods with flexible matching.\n\n## Installation\n\nAvailable on npm:\n\n```sh\nnpm install solhint-plugin-modifiers --save-dev\n```\n\n## Usage\n\nEnable the plugin in your project's `.solhint.json`:\n\n```json\n{\n  \"extends\": \"solhint:recommended\",\n  \"plugins\": [\"modifiers\"],\n  \"rules\": {\n    \"modifiers/ensure-modifiers\": [\"error\", {\n      \"required\": {\n        \"*\": [\"onlyAdmin\"]\n      }\n    }]\n  },\n}\n```\n\nThe above configuration will require the `onlyAdmin` modifier on all methods for all contracts in all linted files.\n\nYou can use globbing to limit the required modifiers:\n\n```json\n{\n  \"required\": {\n    \"contracts/core/*.sol\": {\n      \"Contract.method\": [\"onlyAdmin\"],\n      \"Contract\": {\n        \"method\": [\"onlyAdmin\"]\n      },\n    },\n    \"contracts/core/*.sol:Contract.method\": [\"onlyAdmin\"],\n    \"contracts/core/*.sol:Contract\": {\n      \"method\": [\"onlyAdmin\"],\n    },\n  }\n}\n```\n\nAll of the rules in the previous example are equivalent. That is, they require the `onlyAdmin` modifier for `Contract.method` defined inside some solidity file in `contracts/core/`.\n\nThe file path, contract name, and method may all be globbed e.g.\n\n```json\n{\n  \"required\": {\n    \"contracts/core/*.sol\": {\n      \"*.transfer\": [\"onlyAdmin\"],\n      \"Token.*\": [\"onlyMinter\"]\n    },\n  }\n}\n```\n\nIf `Token.transfer` is defined in `contracts/core/Token.sol`, then it will be matched by both rules. Note that matching modifiers are unioned, so `Token.transfer` would require both `onlyAdmin` and `onlyMinter` modifiers.\n\n### Overrides\n\nYou might want to require a modifier everywhere by default but explicitly override the requirement for some methods. You can use the `override` key to achieve this:\n\n```json\n{\n  \"required\": {\n    \"*\": [\"onlyAdmin\"]\n  },\n  \"override\": {\n    \"*.sol:Contract.method\": []\n  }\n}\n```\n\nWith this configuration, `Contract.method` is overridden to require no modifiers, but all other methods require the `onlyAdmin` modifier.\n\n### Other configuration options\n\nDefault configuration is:\n\n```json\n{\n      \"ignoreVisibility\": [\"internal\"],\n      \"ignoreStateMutability\": [\"view\", \"pure\"],\n      \"ignoreContractKind\": [\"abstract\", \"interface\"],\n      \"verbose\": false,\n      \"required\": {},\n      \"override\": {}\n}\n```\n\nIn other words, `internal`, `view`, and `pure` methods are ignored by default, as are methods in `abstract` or `interface` contracts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoldfinch-eng%2Fsolhint-plugin-modifiers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoldfinch-eng%2Fsolhint-plugin-modifiers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoldfinch-eng%2Fsolhint-plugin-modifiers/lists"}