Skip to main content

🧐 Prior art

Why yet another Eslint config?​

As you might have noticed, there are already a lot of ESLint configurations in the wild (have a look here or here).
None of these projects share the same goals of Sheriff.
Sheriff has a particular vision.

The main reasons that led to it's creation are:

  • easy to setup and use (thank to @sherifforg/cli)
  • easy to customize (thanks to the FlatConfig format)
  • sensible defaults, based on years of real world experience in production scenarios

After exploring every possible alternative, i came to the conclusion that none of the other options where close to what i needed for my projects and everyday use. That’s why i still opted for making Sheriff.

Simple ESLint configs​

ESLint wrappers​

These tools are not just sharable ESLint configs, but are wrappers for ESLint (and in some cases Prettier too) and also provide their CLI and their Editor integrations.

Why Sheriff is NOT an ESLint wrapper​

Sheriff is NOT an ESLint wrapper.

Meaning, you can do with Sheriff anything you can do with ESLint. ESLint wrappers instead limits you in the ability to do so. They lock you into their limited ecosystem.

I believe that ESLint wrappers had their place once upon a time when the FlatConfig wasn't a thing. But today their usecases are largely obsolete.

If you want a simple all-in-one solution, that only handles basic Javascript and doesn't require any customization, just go with something like Biomejs, atleast it's fast. Instead, if you want something more advanced, that handle more usecases and offer more granular control to the user, go with something like Sheriff.

In-depth comparisons​

The main technical difference between Sheriff and the other projects is that Sheriff is updated to the most recent version of ESLint and supports the new FlatConfig instead of relying on weird hacks using the @rushstack/eslint-patch. Because of the technical limitation imposed by this hack, these configs are harder to work with, at multiple levels.

Another key difference is that the design of most of these configs seems to revolve around the idea of stuffing as much rules as possible into the config, regardless of the quality of the experience and the goal of the project.
Sheriff instead was shaped around solid principles and only includes the rules that let it achieve its goals.

In addition, Sheriff features a lot of unique goodies and little nicities that other libraries lack. For a quick glance at the differences between Sheriff and some of the other ESLint configurations mentioned above, have a look at the table below.

Features comparison table​

Featuresheriffeslint-config-airbnbstandardeslint-config-standard@antfu/eslint-configXOeslint-config-canonicaleslint-kiteslint-config-hardcore
FlatConfigβœ…βŒβŒβœ…βœ…βŒβŒβŒβŒ
Maintainedβœ…βŒβŒβŒβœ…βœ…βœ…βœ…βœ…
Customizableβœ…βœ…βŒβœ…βœ…βœ…βœ…βœ…βœ…
Rich Docsβœ…βœ…βœ…βŒβœ…βœ…βœ…βœ…βœ…
Functional programmingβœ…βŒβŒβŒβŒβŒβŒβŒβœ…
Advanced ignores managementβœ…βŒβŒβŒβœ…βœ…βŒβŒβŒ
Learning curveπŸ˜ŠπŸ˜πŸ˜”πŸ˜πŸ˜ŠπŸ˜πŸ˜”πŸ˜”πŸ˜
Incremental adoptionβœ…βŒβŒβŒβŒβŒβŒβœ…βŒ
Typesafe configβœ…βŒβŒβŒβœ…βŒβŒβŒβŒ
Typescriptβœ…βŒβŒβŒβœ…βœ…βœ…βœ…βœ…
Reactβœ…βœ…βŒβŒβœ…βœ…βœ…βœ…βœ…
VueβŒβŒβŒβŒβœ…βœ…βŒβœ…βœ…
SolidjsβŒβŒβŒβŒβœ…βŒβŒβœ…βŒ
SvelteβŒβŒβŒβŒβœ…βŒβŒβœ…βŒ
GraphQLβŒβŒβŒβŒβŒβŒβœ…βŒβŒ
Unicornβœ…βŒβŒβŒβœ…βœ…βœ…βœ…βœ…
Sonarjsβœ…βŒβŒβŒβŒβŒβŒβŒβœ…
JSDocβœ…βŒβŒβŒβœ…βŒβœ…βŒβŒ
TSDocβœ…βŒβŒβŒβŒβŒβŒβŒβŒ
Importβœ…βœ…βœ…βœ…βœ…βœ…βœ…βœ…βœ…
Lodashβœ…βŒβŒβŒβŒβŒβœ…βŒβŒ
Remedaβœ…βŒβŒβŒβŒβŒβŒβŒβŒ
Nextjsβœ…βŒβŒβŒβœ…βŒβœ…βœ…βŒ
Jestβœ…βŒβŒβŒβŒβŒβœ…βŒβœ…
Vitestβœ…βŒβŒβŒβœ…βŒβœ…βŒβŒ
Testing-libraryβŒβŒβŒβŒβŒβŒβŒβŒβœ…
Playwrightβœ…βŒβŒβŒβŒβŒβŒβŒβŒ
Storybookβœ…βŒβŒβŒβŒβŒβŒβŒβœ…
Astroβœ…βŒβŒβŒβœ…βŒβŒβŒβŒ

Sheriff VS eslint-config-airbnb​

I cannot not mention the fact that eslint-config-airbnb is apparently the most popular ESLint config.

However there are a few specific reasons that led to this, and none of them has to do with the quality of the config itself:

  • it was one of the first ESLint configs to be created
  • the starred repository actually contains a stylistic guide, not just the ESLint config. The endorsements are for the guide, not the ESLint config
  • the repository is owned by Airbnb. Many developers through the years starred it just for their enthusiasm for the company, not for the ESLint library in particular
  • for many years, it was the deafult ESLint config in many popular boilerplates and React guides/articles

As of today it's frowned upon by many industry professionals. Some of the most glaring issues:

  • it's largely outdated and not maintained since quite some time
  • It's big, bloated, too strict for most projects
  • it doesn't support TypeScript out of the box, to get it you actually have to use a different library, even less maintained and supported than the original one

Sheriff VS @antfu/eslint-config​

Antfu config shares many similarities with Sheriff, but is less mature and has less features.

Also, it's important to note that it goes for a very opinionated route toward styling, where instead of adopting Prettier, it relies on eslint-stylistic for it's formatting needs.

That being said, Antfu is a prominent figure in the Javascript community and Sheriff takes some inpiration from his config.

Ultimately, both Sheriff and Antfu are good choices, but they have different flavors.

Sheriff VS XO​

XO is an interesting project. It uses ESLint and Prettier under the hood, but don't directly expose them to you. Instead of relying on the ESLint CLI and VSCode Extensions, it has it's own CLI and VSCode Extension. On the surface, it can seem like a good thing because it allows them to provide a more integrated experience, but it also means that you are locked into their ecosystem and you cannot freely extend them.

It is very opinionated in their stylistic and formatting choices and doesn't allow for much flexibility.

XO has many issues that ESLint and Prettier don't have.