π§ 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.
Related projectsβ
ESLint configsβ
- eslint-config-airbnb (comparison)
- @antfu/eslint-config (comparison)
- eslint-config-canonical
- eslint-config-hardcore
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 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β
Feature | sheriff | eslint-config-airbnb | standard | eslint-config-standard | @antfu/eslint-config | XO | eslint-config-canonical | eslint-kit | eslint-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 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.