Open zcorpan opened 4 years ago
More generally, I think a lot of things in the code guide can be linted for. If something can't be linted, we could consider removing it from the code guide. This would mean that contributors can fix mistakes before they open a PR (if they lint locally) or directly after they open a PR, and the code reviewer can focus on higher-level issues.
I’d suggest editorconfig-checker enforced by GitHub Action on every pull request, see example.
There is already https://github.com/w3c/aria-practices/pull/856 for EditorConfig enforcement, but that only enforces the number of spaces. For language/context specific indenting, it needs to be done by something like ESLint
I found that Prettier also respects/uses the EditorConfig settings, and am looking at applying that through the ESLint and Stylelint plugins
@nschonni
This is complete, right?
I think everything except HTML is covered https://github.com/w3c/aria-practices/blob/3952625fc459ac53f735b9395b01fe48de1e381c/.prettierignore#L8-L9 Prettier tends to make some ugly formatting for HTML, so it's still excluded
This project has an .editorconfig file. However, the rules aren't consistently applied, judging from https://github.com/w3c/aria-practices/pull/1370.
In order to avoid contributors making unrelated changes because their text editor apply the rules in the .editorconfig, I think it would be useful to enforce the rules with a linter. If a contributor uses a text editor that doesn't honor the .editorconfig rules, the lint check would fail and they would need to either manually fix it or change the settings in their editor.