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

Suggestion: Be more clear in differentiating "formatting" vs "style" #419

Closed
1 task done
JoshuaKGoldberg opened this issue Feb 20, 2023 · 2 comments
Closed
1 task done
Labels
enhancement New feature or request

Comments

@JoshuaKGoldberg
Copy link
Contributor

What problem do you want to solve?

On typescript-eslint.io, we generally use the following vocabulary to describe areas of lint rule responsibilities:

  • 💩 Formatting: Rules that care only about trivia (semicolons, whitespace, etc.) without impacting the runtime behavior of the code. These rules conflict with dedicated formatters such as Prettier.
  • 💅 Stylistic: Rules that care about style concerns which do impact runtime behavior of code, but generally not logic. These are mostly around naming or which roughly-equivalent syntax constructs to use (such as function declarations vs. arrow functions).
  • 🧠 Logical: Rules that care about the logic in runtime behavior of code.

However, https://eslint.org/blog/2020/05/changes-to-rules-policies/#what-are-the-changes%3F 1 -which we link to in the typescript-eslint What About Formatting? page- uses "stylistic" to describe both what we call 💩 "formatting" and 💅 "stylistic":

Stylistic rules are frozen - we won’t be adding any more options to stylistic rules. We’ve learned that there’s no way to satisfy everyone’s personal preferences, and most of the rules already have a lot of difficult-to-understand options. Stylistic rules are those related to spacing, conventions, and generally anything that does not highlight an error or a better way to do something.

As a reader of that post, I'm actually now not sure - has ESLint frozen what we call 💅 "stylistic" rules? Or are both 💩 "formatting" and 💅 "stylistic" frozen?

Has the ESLint team been intentional about vocabulary in this area?

  • If so: what is the system you use?
  • If not: can I suggest using the typescript-eslint nomenclature of 💩 formatting vs. 💅 stylistic vs. 🧠 logical, and letting me send a PR to amend that blog post?

What do you think is the correct solution?

I'm a fan of 💩 formatting vs. 💅 stylistic vs. 🧠 logical as the nomenclature. Many -in my experience, most!- developers don't have strong grasp of the conceptual differences between 💩 formatting and 💅 stylistic, even if they understand generally the differences between formatters and linters.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

I realize the silliness of suggesting vocabulary changes to a nearly 3 year old blog post 😄. But this shared vocab is something that would really benefit our work in explaining the differences between formatting & linting concerns.

Corresponding typescript-eslint issue: typescript-eslint/typescript-eslint#6495

Footnotes

  1. Original PR adding the ESLint blog post: https://github.com/eslint/archive-website/pull/732

@nzakas
Copy link
Member

nzakas commented Feb 20, 2023

By "stylistic", we mean anything that enforces a preference, which could be formatting or, as you point out, something that could affect runtime behavior but isn't necessarily a problem (like vars-on-top). If it would help to add that to README, feel free to submit a PR.

Our problem as maintainers is that we keep getting little nitpicky options suggested to support someone's personal preferences, because on a Thursday that also falls on a full moon indents should be two spaces but every other day it should be three spaces. We just don't want to keep adding exceptions to support every possible preference.

Eventually, I'd like to get rid of these rules altogether as I think they are generally a waste of time to build and maintain when you can just use a source code formatter, but in the meantime, we keep them for people to use but we don't want to maintain them.

I really don't want to start introducing new terms or changing the meanings of terms at this point. We already have too many and during the rewrite I'd like to go through and be more intentional about which terms we use and why.

@JoshuaKGoldberg
Copy link
Contributor Author

👍 perfect, thanks @nzakas! I think we're using a fairly similar shared vocab - the blog post is referring to "stylistic" as both formatting & styles. I can just update the typescript-eslint.io docs site to mention this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

2 participants