Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce EditorConfig rules with a linter #1380

Open
zcorpan opened this issue Apr 17, 2020 · 6 comments
Open

Enforce EditorConfig rules with a linter #1380

zcorpan opened this issue Apr 17, 2020 · 6 comments
Labels
Build Process Related to build process automation, including build scripts, linting, syntax automated tests, etc. enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy

Comments

@zcorpan
Copy link
Member

zcorpan commented Apr 17, 2020

This project has an .editorconfig file. However, the rules aren't consistently applied, judging from #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 zcorpan added the Build Process Related to build process automation, including build scripts, linting, syntax automated tests, etc. label Apr 17, 2020
@zcorpan
Copy link
Member Author

zcorpan commented Apr 17, 2020

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
Copy link
Contributor

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

@nschonni
Copy link
Contributor

There is already #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
Copy link
Contributor

nschonni commented Oct 1, 2020

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

@mcking65
Copy link
Contributor

@nschonni

This is complete, right?

@mcking65 mcking65 added the enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy label Jun 19, 2023
@nschonni
Copy link
Contributor

I think everything except HTML is covered

# Ignore HTML formatting as the diffs are not great
*.html

Prettier tends to make some ugly formatting for HTML, so it's still excluded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Process Related to build process automation, including build scripts, linting, syntax automated tests, etc. enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy
Projects
None yet
Development

No branches or pull requests

4 participants