You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_This is a soon-to-be deprecated feature. Do not use. See [migration guide](./docs/counter-migration-guide.md)_
79
-
80
-
`erblint` does not natively support rule disables. At GitHub, we've implemented these rules in a way to allow rules to be disabled at an offense-level via counters or disabled at a file-level because often times, we want to enable a rule but aren't able to address all offenses at once. We achieve this in one of two ways.
81
-
82
-
Rules that are marked as `Counter` can be disabled by adding a comment with the offense count that matches the number of offenses within the file like:
In this comment example, when a new `LinkHasHref` offense has been added, the counter will need to be bumped up to 2. More recent rules use a `Counter` format.
89
-
90
-
If you are enabling a rule for the first time and your codebase has a lot of offenses, you can use the `-a` command to automatically add these counter comments in the appropriate places.
91
-
92
-
```
93
-
bundle exec erblint app/views app/components -a
94
-
```
95
-
96
-
Rules that are not marked as `Counter` like `NoRedundantImageAlt` are considered to be legacy format. We are in the process of migrating these to counters. These rules can still be disabled at the file-level by adding this comment at the top of the file:
Copy file name to clipboardExpand all lines: docs/counter-migration-guide.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Counter migration guide
2
2
3
+
This is relevant for `erblint-github` versions <= 0.3.2.
4
+
3
5
[ERBLint v0.4.0](https://github.com/Shopify/erb-lint/releases/tag/v0.4.0) introduces support for inline lint rule disables.
4
6
5
7
Since an inline disable feature is now natively available, it is time to move away from the in-house (hacky) counter system we've used internally over the years and in this library. 🎉
# have to adjust to get `\n` so we delete the whole line
30
-
add_offense(processed_source.to_source_range(comment_node.loc.adjust(end_pos: 1)),"Unused erblint:counter comment for #{rule_name}","")ifcomment_node
31
-
return
32
-
end
33
-
34
-
first_offense=@offenses[0]
35
-
36
-
ifcomment_node.nil?
37
-
add_offense(processed_source.to_source_range(first_offense.source_range),"#{rule_name}: If you must, add <%# erblint:disable #{rule_name} %> at the end of the offending line to bypass this check. See https://github.com/shopify/erb-lint#disable-rule-at-offense-level","<%# erblint:disable #{rule_name} %>")
38
-
else
39
-
clear_offenses
40
-
add_offense(processed_source.to_source_range(comment_node.loc),"Incorrect erblint:counter number for #{rule_name}. Expected: #{expected_count}, actual: #{offenses_count}.","<%# erblint:counter #{rule_name}Counter #{offenses_count} %>")ifexpected_count != offenses_count
MESSAGE="[aria-disabled] may be used in place of native HTML [disabled] to allow tab-focus on an otherwise ignored element. Setting both attributes is contradictory."
Copy file name to clipboardExpand all lines: lib/erblint-github/linters/github/accessibility/nested_interactive_elements.rb
-8Lines changed: 0 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,6 @@ class NestedInteractiveElements < Linter
12
12
13
13
MESSAGE="Nesting interactive elements produces invalid HTML, and ssistive technologies, such as screen readers, might ignore or respond unexpectedly to such nested controls."
0 commit comments