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

eslint-plugin-always

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-always

ESLint plugin that always reports with configurable message

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NPM version Downloads star this repo fork this repo CI

eslint-plugin-always

ESLint plugin that always reports with a configurable message.

Simply reports ALWAYS!

There is a reason why we want to do so! See Why?

Installation

$ yarn add eslint-plugin-always --dev

Usage

Add the plugin to your ESLint configuration:

{
  "plugins": [
    "always"
  ]
}

And then add the following rule:

{
  "rules": {
    "always/always": ["error", {
      "message": "Hello World"
    }]
  }
}

Why?

I need to notice the team members that the new folder must contain a ESLint configuration.

Notice

I will simply show you the use case which is the reason why I created this plugin.

There is a cartridges/ folder in the project. This folder contains multiple packages which may need a different ESLint configuration.

The surrounding application uses another ESLint configuration. But this configuration isn't applicable for the packages in the cartridges/ folder.

├── cartridges
│   ├── app_foo
│   │   ├── .eslintrc.json
│   ├── int_foo
│   │   ├── .eslintrc.json
│   ├── int_bar
│   │   ├── .eslintrc.json
│   ├── int_new <-- DETECT WHY THIS FOLDER DOESN'T HAVE A LINT CONFIGURATION
│   ├── bc_foo
│   │   ├── .eslintrc.json
│   ├── .eslintrc.json <-- THE FILE THAT ENABLES THIS RULE AND CONTAINING root: true
├── packages.json <-- CONTAINING THE SURROUNDING LINT CONFIGURATION

For a new package cartidges/int_new a valid ESLint configuration must be added.

cartridges/.eslintrc.json resets the ESLint configuration and adds this rule.

{
  "root": true,
  "plugins": [
    "always"
  ],
  "rules": {
    "always/always": ["error", {
      "message": "No ESLint config found. Please add one or ignore the cartridge."
    }]
  }
}

So all files in this folder structure won't check any ESLint rules. The subfolders must contain ESLint configurations which can differ between each subfolder.

For the case that someone adds a subfolder and forgets the ESLint configuration this rule was created. So every file within the subfolder will report an error

No ESLint config found. Please add one or ignore the cartridge.

License

MIT © 2023 Jens Simon

Keywords

FAQs

Package last updated on 16 Oct 2023

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