Skip to main content

🧐 Prior art

Why yet another ESLint config?​

As you may have noticed, plenty of ESLint configurations in the wild already exist (have a look here or here).
None of these projects share the same goals of Sheriff.
Sheriff has a unique vision.

The main needs that led to its creation are:

  • breezy setup and use (thanks to @sherifforg/cli)
  • ease of customization (thanks to the β€œflat” configuration format)
  • sensible defaults based on years of real-world production experience

After exploring many possible alternatives, I came to the conclusion that none of the other options where close to what I needed for my projects and everyday use. That is why I opted for making Sheriff.

ESLint configs​

ESLint wrappers​

These tools are not just sharable ESLint configs, but are wrappers for ESLint (and sometimes Prettier) that have their own CLI and their Editor integrations.

Why Sheriff is NOT an ESLint wrapper​

Sheriff is NOT an ESLint wrapper.

This means that you can do anything with Sheriff that you can do with ESLint. ESLint wrappers limit you, locking you into their limited ecosystems.

I believe that ESLint wrappers had their place before the new config format came about, but today, they are largely obsolete.

If you want a simple all-in-one solution that only handles basic JavaScript and doesn't require any customization, you can go with something fast like Biome or Oxlint. If you instead want something more advanced that both handles more use cases and offers more granular control, 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 β€œflat” configuration format instead of relying on hacks like as @rushstack/eslint-patch. Because of the technical limitations 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 many rules as possible into the config, regardless of the quality of the plugins.
Sheriff instead was shaped around solid principles and only includes the rules that let it achieve its goals.

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

Feature 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βœ…βŒβŒβŒβœ…βŒβŒβŒβŒ
Scaffolderβœ…βŒβŒβŒβœ…βŒβŒβœ…βŒ
Self checking in CIβœ…βŒβŒβŒβŒβŒβŒβŒβŒ
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 help mentioning eslint-config-airbnb, as it is perhaps the most popular ESLint config.

However, 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. Plenty of the endorsements are for the guide, not the ESLint config.
  • Airbnb owns the repository. 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 default ESLint config in many popular boilerplates, guides, and tutorials.

Nowadays, it is frowned on by many industry professionals. Some of the most glaring issues include:

  • It is largely outdated and has not been maintained for some time.
  • It is big, bloated, and too strict for most projects.
  • It does not support TypeScript out of the box, to get it you actually have to use a different library that is even less maintained and supported than the original one.

Sheriff vs. @antfu/eslint-config​

Anthony Fu’s personal config shares many similarities with Sheriff, but is less mature and has fewer features.

Also, it’s important to note that it goes for a particularly opinionated route toward styling, where instead of adopting Prettier, it relies on ESLint Stylistic for its formatting needs.

That said, Anthony is a prominent figure in the JavaScript community and Sheriff takes some inspiration from his config.

Ultimately, both Sheriff and the Anthony’s config are good choices, but they have different stylistic choices.

Sheriff vs. XO​

XO is an interesting project. It uses ESLint and Prettier under the hood, but does not directly expose them to you. Instead of relying on the ESLint CLI and VS Code extension, it has its own CLI and VS Code 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 cannot freely extend it.

It’s style and formatting choices are rather opinionated, and it is not flexible.

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