Repository: protofire/solhint (js)

Issue:
Linter counts immutable vars as state vars
Hi, 

For the `max-states-count` rule, the linter counts `immutable` vars as state variable declarations, which shouldnt be the case, right? 

See: 
![image](https://user-images.githubusercontent.com/36712489/96455015-ec6eca00-121c-11eb-982f-4be9fda267c1.png)


Pull request description:
Avoid counting `immutable` for the `max-state-count` rule
closes #258

Patch:
diff --git a/lib/rules/best-practises/max-states-count.js b/lib/rules/best-practises/max-states-count.js
index cd59ca3..7082662 100644
--- a/lib/rules/best-practises/max-states-count.js
+++ b/lib/rules/best-practises/max-states-count.js
@@ -55,7 +55,9 @@ class MaxStatesCountChecker extends BaseChecker {
   ContractDefinition(node) {
     const countOfVars = _(node.subNodes)
       .filter(({ type }) => type === 'StateVariableDeclaration')
-      .flatMap(subNode => subNode.variables.filter(variable => !variable.isDeclaredConst))
+      .flatMap(({ variables }) =>
+        variables.filter(({ isDeclaredConst, isImmutable }) => !isDeclaredConst && !isImmutable)
+      )
       .value().length
 
     if (countOfVars > this.maxStatesCount) {


Test patch:
diff --git a/test/rules/best-practises/max-states-count.js b/test/rules/best-practises/max-states-count.js
index 6a8fdc6..079328c 100644
--- a/test/rules/best-practises/max-states-count.js
+++ b/test/rules/best-practises/max-states-count.js
@@ -45,4 +45,18 @@ describe('Linter - max-states-count', () => {
 
     assertNoErrors(report)
   })
+
+  it('should not count immutable variables', () => {
+    const code = contractWith(`
+      uint public immutable a;
+      uint public b;
+      uint public c;
+
+      function f() {}
+    `)
+
+    const report = linter.processStr(code, { rules: { 'max-states-count': ['error', 2] } })
+
+    assertNoErrors(report)
+  })
 })