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

docs(blog): New Blogpost #348

Merged
merged 2 commits into from
Jan 18, 2025
Merged

Conversation

AndreaPontrandolfo
Copy link
Owner

Fixes #347

Copy link

changeset-bot bot commented Jan 6, 2025

⚠️ No Changeset found

Latest commit: a031560

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sheriff ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2025 6:10pm

Copy link
Contributor

@lishaduck lishaduck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just left some comments :)
Good read, I enjoyed it!


{/* truncate */}

I wanted to give a glimpse into the architectural design decisions going on in Sheriff behind the scenes, so I'm sharing a deep dive into the [Inversion of Control](https://en.wikipedia.org/wiki/Inversion_of_control) principle and how it helped Sheriff achieve a more flexible and accessible options API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
I wanted to give a glimpse into the architectural design decisions going on in Sheriff behind the scenes, so I'm sharing a deep dive into the [Inversion of Control](https://en.wikipedia.org/wiki/Inversion_of_control) principle and how it helped Sheriff achieve a more flexible and accessible options API.
I wanted to give a glimpse into the architectural design decisions going on behind the scenes in Sheriff, so I'm sharing a deep dive into the [Inversion of Control](https://en.wikipedia.org/wiki/Inversion_of_control) principle and how it helps Sheriff achieve a more flexible and accessible API.


:::info

I know, Inversion of Control is an expression that can have many different meanings in computer programming, depending on the context, but in this article I'm using it in loose terms to describe the process of giving the user more control over the library's behavior.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
I know, Inversion of Control is an expression that can have many different meanings in computer programming, depending on the context, but in this article I'm using it in loose terms to describe the process of giving the user more control over the library's behavior.
I know that *Inversion of Control* has many meanings in computer programming, but I'm using here it to describe the process of giving the user more control over the library's behavior.


## Why

One of the coolest things about Sheriff is the way it encapsulates the complexity of ESLint and its ecosystem, most of the times hiding the ugly details behind the curtains. The problem is that sometimes the level of abstraction is too intrusive and can obstacolate the user's ability to customize the configuration to their needs. It's a delicate balance to strike.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
One of the coolest things about Sheriff is the way it encapsulates the complexity of ESLint and its ecosystem, most of the times hiding the ugly details behind the curtains. The problem is that sometimes the level of abstraction is too intrusive and can obstacolate the user's ability to customize the configuration to their needs. It's a delicate balance to strike.
One of the coolest things about Sheriff is the way it encapsulates the complexity of ESLint and its ecosystem, mostly hiding the ugly details behind a curtain. The problem is, sometimes the level of abstraction is too intrusive and can interfere with users' ability to customize the configuration to suit their needs. It's a delicate balance to strike.


One of the coolest things about Sheriff is the way it encapsulates the complexity of ESLint and its ecosystem, most of the times hiding the ugly details behind the curtains. The problem is that sometimes the level of abstraction is too intrusive and can obstacolate the user's ability to customize the configuration to their needs. It's a delicate balance to strike.

In this article we will explore why the Inversion of Control principle is often the key to unlock the best solution.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this article we will explore why the Inversion of Control principle is often the key to unlock the best solution.
In this article, we will explore how Sheriff uses the *Inversion of Control* principle as the key to unlocking the best APIs.


### The problem

ESLint offers a rule called [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax) that allows you to disallow specific Javascript syntax features.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ESLint offers a rule called [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax) that allows you to disallow specific Javascript syntax features.
ESLint offers a rule called [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax) that allows you to disallow specific JavaScript syntax features.


### Going forward

Since then the typescript-eslint team moved to a new option called [`projectService`](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8-beta#project-service).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Since then the typescript-eslint team moved to a new option called [`projectService`](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8-beta#project-service).
Since then, the typescript-eslint team has moved to a new system called the [project service](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8#project-service).


Since then the typescript-eslint team moved to a new option called [`projectService`](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8-beta#project-service).

This option is meant to definitely get rid of the need for the custom tsconfigs, like `tsconfig.eslint.json` etc, that some users had for some advanced use-cases. It also has other benefits. [Learn more](https://typescript-eslint.io/packages/parser#projectservice).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This option is meant to definitely get rid of the need for the custom tsconfigs, like `tsconfig.eslint.json` etc, that some users had for some advanced use-cases. It also has other benefits. [Learn more](https://typescript-eslint.io/packages/parser#projectservice).
This option is meant to get rid of the need for custom `tsconfig.json`s like `tsconfig.eslint.json`, etc., that some users had made for advanced use cases. The project service also has other benefits, and is often more performant. [Learn more](https://typescript-eslint.io/packages/parser#projectservice).


This option is meant to definitely get rid of the need for the custom tsconfigs, like `tsconfig.eslint.json` etc, that some users had for some advanced use-cases. It also has other benefits. [Learn more](https://typescript-eslint.io/packages/parser#projectservice).

Sheriff is currently exploring on adopting this new API ([Issue](https://github.com/AndreaPontrandolfo/sheriff/issues/203) | [PR](https://github.com/AndreaPontrandolfo/sheriff/pull/205)), but it seems like the feature is still experimental and [has some issues to iron out first](https://github.com/microsoft/vscode-eslint/issues/1911).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Sheriff is currently exploring on adopting this new API ([Issue](https://github.com/AndreaPontrandolfo/sheriff/issues/203) | [PR](https://github.com/AndreaPontrandolfo/sheriff/pull/205)), but it seems like the feature is still experimental and [has some issues to iron out first](https://github.com/microsoft/vscode-eslint/issues/1911).
Sheriff is currently exploring on adopting this new API ([issue](https://github.com/AndreaPontrandolfo/sheriff/issues/203) | [PR](https://github.com/AndreaPontrandolfo/sheriff/pull/205)).

The linked issue states that the project service is now more correct than the old version (in typescript-eslint >=8.3.0), although the issue remains open until issues (that also exist with the current version) are fixed. It's also no longer experimental in typescript-eslint v8, but has been stabilized.


## Conclusion

By simplifying APIs and empowering advanced users with more granular controls, Sheriff strikes a balance between ease of use and developer freedom. As the library evolves, it remains committed to enhancing developer experience with modern, user-focused solutions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By simplifying APIs and empowering advanced users with more granular controls, Sheriff strikes a balance between ease of use and developer freedom. As the library evolves, it remains committed to enhancing developer experience with modern, user-focused solutions.
By simplifying APIs and empowering users with more granular controls, Sheriff seeks to strike a balance between ease of use and developer freedom. As the library evolves, we remain committed to enhancing developer experience with modern, user-focused solutions.

Comment on lines +9 to +10
- [ESLint >=9.0.0](https://eslint.org/)
- [Typescript >= 5.0.0](https://www.typescriptlang.org/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already listed in the minimums. I think we do want to recommend newer versions though, perhaps this?:

Suggested change
- [ESLint >=9.0.0](https://eslint.org/)
- [Typescript >= 5.0.0](https://www.typescriptlang.org/)
- [ESLint >=9.5.0](https://eslint.org/)
- [Typescript >= 5.7.0](https://www.typescriptlang.org/)

b/c 9.5 introduced language plugins and is the version ESLint tooling depends on, and 5.7 b/c it's needed for @types/node@>=22.7.3.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think this will conflict with #305.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i basically "duplicated" here these requirements because it felt odd not having the hard requirements as a base for the recommended requirements. I mean, they are intended as a base of course, but making it explicit avoid any confusion i think.

@AndreaPontrandolfo AndreaPontrandolfo marked this pull request as ready for review January 18, 2025 18:10
@AndreaPontrandolfo AndreaPontrandolfo merged commit ca53e56 into master Jan 18, 2025
5 checks passed
@AndreaPontrandolfo AndreaPontrandolfo deleted the AndreaPontrandolfo/issue347 branch January 18, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Blogpost
2 participants