From 6fc5b55526b2411b8c1330a96a54c87f09877db0 Mon Sep 17 00:00:00 2001 From: dbale-altoros Date: Mon, 1 Jul 2024 15:58:16 -0300 Subject: [PATCH] autofix e2e tests --- conf/rulesets/solhint-all.js | 2 +- docs/rules.md | 2 +- docs/rules/naming/imports-order.md | 40 ++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 docs/rules/naming/imports-order.md diff --git a/conf/rulesets/solhint-all.js b/conf/rulesets/solhint-all.js index 060d3a4e..06b9fc5a 100644 --- a/conf/rulesets/solhint-all.js +++ b/conf/rulesets/solhint-all.js @@ -50,7 +50,7 @@ module.exports = Object.freeze({ immutablesAsConstants: true, }, ], - 'import-order': 'warn', + 'imports-order': 'warn', 'modifier-name-mixedcase': 'warn', 'named-parameters-mapping': 'warn', 'private-vars-leading-underscore': [ diff --git a/docs/rules.md b/docs/rules.md index 3af1e879..1541ec02 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -37,7 +37,7 @@ title: "Rule Index of Solhint" | [func-named-parameters](./rules/naming/func-named-parameters.md) | Enforce named parameters for function calls with 4 or more arguments. This rule may have some false positives | | | | [func-param-name-mixedcase](./rules/naming/func-param-name-mixedcase.md) | Function param name must be in mixedCase. | | | | [immutable-vars-naming](./rules/naming/immutable-vars-naming.md) | Check Immutable variables. Capitalized SNAKE_CASE or mixedCase depending on configuration. | $~~~~~~~~$✔️ | | -| [import-order](./rules/naming/import-order.md) | Order the imports of the contract to follow a certain hierarchy | | | +| [imports-order](./rules/naming/imports-order.md) | Order the imports of the contract to follow a certain hierarchy | | | | [modifier-name-mixedcase](./rules/naming/modifier-name-mixedcase.md) | Modifier name must be in mixedCase. | | | | [named-parameters-mapping](./rules/naming/named-parameters-mapping.md) | Solidity v0.8.18 introduced named parameters on the mappings definition. | | | | [private-vars-leading-underscore](./rules/naming/private-vars-leading-underscore.md) | Non-external functions and state variables should start with a single underscore. Others, shouldn't | | | diff --git a/docs/rules/naming/imports-order.md b/docs/rules/naming/imports-order.md new file mode 100644 index 00000000..05f04128 --- /dev/null +++ b/docs/rules/naming/imports-order.md @@ -0,0 +1,40 @@ +--- +warning: "This is a dynamically generated file. Do not edit manually." +layout: "default" +title: "imports-order | Solhint" +--- + +# imports-order +![Category Badge](https://img.shields.io/badge/-Style%20Guide%20Rules-informational) +![Default Severity Badge warn](https://img.shields.io/badge/Default%20Severity-warn-yellow) + +## Description +Order the imports of the contract to follow a certain hierarchy + +## Options +This rule accepts a string option of rule severity. Must be one of "error", "warn", "off". Default to warn. + +### Example Config +```json +{ + "rules": { + "imports-order": "warn" + } +} +``` + +### Notes +- Order by hierarchy of directories first, e.g. ../../ comes before ../, which comes before ./, which comes before ./foo +- Order alphabetically for each file at the same level, e.g. ./bar comes before ./foo +- Rule support up to 10 folder levels "../../../../../../../../../../" + +## Examples +This rule does not have examples. + +## Version +This rule is introduced in the latest version. + +## Resources +- [Rule source](https://github.com/protofire/solhint/tree/master/lib/rules/naming/imports-order.js) +- [Document source](https://github.com/protofire/solhint/tree/master/docs/rules/naming/imports-order.md) +- [Test cases](https://github.com/protofire/solhint/tree/master/test/rules/naming/imports-order.js)