Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-config-sheriff

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-sheriff

A comprehensive Eslint configuration.

  • 7.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
135
decreased by-19.16%
Maintainers
1
Weekly downloads
 
Created
Source

Sheriff

📜 Table of Contents

  1. 📜 Table of Contents
  2. 📖 Description
  3. 🛠️ Setup
  4. ✨ Features
  5. 🖥️ Techs
  6. 🔑 Requirements
  7. 🧳 Eslint plugins
  8. 🧶 Rules
  9. 🧠 Configuration
  10. 🧐 Prior art
  11. ♻ Migration guide
  12. 🧡 Contributing
  13. 🌤 Changelog
  14. 📋 License
  15. 🚀 Roadmap
  16. 💌 Acknowledgments

📖 Description

🥳 Introduction

sheriff is a comprehensive Eslint configuration.
It supports various technologies.
sheriff is very easy top get started with and use. It promotes a “zero overhead approach”. See: philosophy.
It’s a "plug & play" solution but you can customize it as much as you want. See: features.

⚠️ At the moment, sheriff supports only Typescript codebases with modern Ecmascript standards. Maybe in the future i'll take in consideration support for vanilla Javascript. See: roadmap.

🤔 Why / Motivations

Managing a complex eslint configurazione takes time and effort. sheriff does it for you.

💭 Philosophy / Criteria

This library is very opinionated, but it's for the better. I took a lot of decisions so you don't have to 1.
You can now quickstart static analysis in all your Typescript projects with ease. It's just 1 create-sheriff-config.
You can think of sheriff like prettier or create-react-app. It's a tool that comes battery-packed with optimal defaults. It remove configuration decisions from the equation, so you or your team can focus on developing the actual product.
And if you don't like something, you can easily override it, and just as easily you can extend it. See: configuration.

🛠️ Setup

This config is highly opinionated, so make sure to meet the hard requirements in your project.
Then, let create-sheriff-config handle the whole setup for you automatically, or do it yourself manually.

Let the CLI take care of everything! Just run this command in your terminal:

❯  npx create-sheriff-config

...and your good to go! Happy hacking 🎉

😫 Manual setup

Follow these steps:

  1. Install the package from npm.

    # npm
    ❯  npm install -D eslint-config-sheriff
    
    # yarn
    ❯  yarn add -D eslint-config-sheriff
    
    # pnpm
    ❯  pnpm add -D eslint-config-sheriff
    
  2. Create a eslint.config.js 2 file at the root of your project and copy/paste the contents of this snippet:

    // eslint.config.js
    
    import sheriff from 'eslint-config-sheriff/recommended';
    
    export default [
      ...sheriff,
      {
        files: ['**/*{js,ts,jsx,tsx}'],
      },
    ];
    

    or, if you already have a eslint.config.js in your project, just append sheriff to the configs array, like this:

    // eslint.config.js
    
    import sheriff from 'eslint-config-sheriff/recommended';
    // my other imports...
    
    export default [
      // my other configurations...
      ...sheriff,
    ];
    
  3. Configure sheriff (optional)

✨ Features

  • Batteries included: sheriff is a all-in-one solution. You don't need to install or configure separately anything else. Everything is included here.
  • 🔓 No lock-in: sheriff is not a framework. You can extend the eslint.config.js beyond sheriff as much as you like, just like you normally would. Or you can disable any rule sheriff comes with. sheriff doesn't impose any limitation.
  • 🏑 Frictionless by design: to setup sheriff and take off, the only input required from the user is running the command npx create-sheriff-config. The command will automatically infer the details of your project and figure out the optimal sheriff configuration by itself.
  • Interoperability: you can plop sheriff in your project at any moment. create-sheriff-config will config automatically everything for you and will warn you if you need take any special precautions. Bottomline: it's never to late too install sheriff.
  • 🏔 Cutting-edge: sheriff is one of the first attempts in the wild to adhere to the new eslint configuration format, the FlatConfig. You can use sheriff to easily and safely migrate your project to the new config format without effort. See: migration guide.
  • 🗄️ Configurable: sheriff is fully configurable with it's own config file sheriffrc.json. See: configuration.
  • 🐙 Modular: sheriff has opt-in support for a wide array of libraries.
  • SemVer: sheriff releases follows Semantic Versioning with Conventional Commits standards.

🖥️ Techs

🔑 Requirements

Hard requirements

Recommendations

🧳 Eslint plugins

🧶 Rules

See Rules.

🧠 Configuration

  • Configure sheriff as desired in the sheriffrc.json file 3.
    Every config option can be set on/off (you just pass them a boolean value). As they are all opt-in, they are all disabled by default.

    // sheriffrc.json (default)
    
    {
      react: false,
      next: false,
      lodash: false,
      playwright: false,
    }
    
  • Override any sheriff rule as desired in the eslint.config.js file.

♻ Migration guide

TODO

🧡 Contributing

TODO

📋 License

MIT License.

🌤 Changelog

See Releases.

🚀 Roadmap

  • Consider more rules
  • eslint-plugin-next
  • Create the sheriffrc.json file support
  • Create a cli ala create-react-app
  • Remove react as a hard requirement
  • Svelte support
  • Solid support
  • Vue support
  • Astro support
  • Create a documentation website

💌 Acknowledgments

For some of this config i partially used eslint-config-red as a base.
I don't take any attribution for the rules in the various eslint-plugins used here (expect for the few that i personally created). Please consider starring the respective projects for the awesome work their authors made. sheriff wouldn't be possible without their efforts.
The full list of the plugins used is here.

Footnotes

  1. This config is particularly useful for big teams with developers of various skill levels. I worked in a lot of different projects and teams through the years and i got accustomed to seeing all kinds of mistake being made. sheriff was made to prevent all of those mistakes. It is battle-tested in real-world scenarios, and shines especially in such.

  2. sheriff is based on the new format of Eslint configs. You cannot extend sheriff from a old config format, it wouldn't work.

  3. sheriff utilizes cosmiconfig under-the-hood to power-up the sheriff configuration. You are not forced to call the config file "sheriffrc.json", you can choose one of the alternative filetypes. See cosmiconfig for details.

Keywords

FAQs

Package last updated on 14 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc