w3c / aria-practices

WAI-ARIA Authoring Practices Guide (APG)
https://www.w3.org/wai/aria/apg/
Other
1.21k stars 344 forks source link

Enforce EditorConfig rules with a linter #1380

Open zcorpan opened 4 years ago

zcorpan commented 4 years ago

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.

zcorpan commented 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.

pepelsbey commented 4 years ago

I’d suggest editorconfig-checker enforced by GitHub Action on every pull request, see example.

nschonni commented 4 years ago

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

nschonni commented 4 years ago

I found that Prettier also respects/uses the EditorConfig settings, and am looking at applying that through the ESLint and Stylelint plugins

mcking65 commented 1 year ago

@nschonni

This is complete, right?

nschonni commented 1 year ago

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