Skip to content

Commit b102c4f

Browse files
committed
Add documentation for how to migrate away
1 parent 841f923 commit b102c4f

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

docs/counter-migration-guide.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Counter migration guide
2+
3+
[ERBLint v0.4.0](https://github.com/Shopify/erb-lint/releases/tag/v0.4.0) introduces support for inline lint rule disables.
4+
5+
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. 🎉
6+
7+
Our latest `erblint-github` release removes the `-Counter` prefix from all of the lint rules. Please update your `.erb-lint.yml` accordingly.
8+
9+
If your configuration looks something like:
10+
11+
```yaml
12+
---
13+
linters:
14+
GitHub::Accessibility::AvoidBothDisabledAndAriaCounter:
15+
enabled: true
16+
GitHub::Accessibility::AvoidGenericLinkTextCounter:
17+
enabled: true
18+
GitHub::Accessibility::DisabledAttributeCounter:
19+
enabled: true
20+
```
21+
22+
It should become the following, with `-Counter` removed to make sure the rules run correctly.
23+
24+
```yaml
25+
---
26+
linters:
27+
GitHub::Accessibility::AvoidBothDisabledAndAria:
28+
enabled: true
29+
GitHub::Accessibility::AvoidGenericLinkText:
30+
enabled: true
31+
GitHub::Accessibility::DisabledAttribute:
32+
enabled: true
33+
```
34+
35+
## Easing migration
36+
37+
In order to ease migration for codebases where counter comments are in place (especially large codebases), we will continue to support counters for existing lint rules for a few releases until we deprecate it completely. This should allow you to migrate rules one-by-one, rather than all at once.
38+
39+
With this release, the counter system will now be toggled off by default, so please explicitly enable them in your `.erb-lint.yml` config if you would like to enable counters.
40+
41+
```yaml
42+
---
43+
linters:
44+
GitHub::Accessibility::AvoidBothDisabledAndAria:
45+
enabled: true
46+
counter_enabled: true
47+
GitHub::Accessibility::AvoidGenericLinkText:
48+
enabled: true
49+
counter_enabled: true
50+
```
51+
52+
With this `counter_enabled: true` config, your counter comments like `<%# erblint:counter GitHub::Accessibility::AvoidBothDisabledAndAriaCounter 1` should work as it did before.
53+
54+
However, we will drop support for the counter system within the next few releases so please take time to migrate your counter comments to native inline disable comments. Any new rules added to this library will not support the counter system.
55+
56+
Once your files do not have any counter comments, remove the `counter_enabled: true` from your configuration to ensure no new ones are added.
57+
58+
## Automate migration
59+
60+
Adding inline disables for large codebases can be extremely tedious. We recommend using a script to automate this process.
61+
62+
<!-- TODO: Add script that consumers can use -->

0 commit comments

Comments
 (0)