npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-sbnc-typescript-rules

v0.2.1

Published

An ESLint plugin with customised linting rules for TypeScript

Downloads

4

Readme

ESLint Plugin: SBNC Typescript Rules

This plugin includes some specialised ESLint rules to be used in TypeScript projects.

The current version of the rules are based on the v8.39.0 version of ESLint and are NOT tested to be compatible with ESLint v7 or earlier.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

You'll also need to have typescript-eslint set up:

npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint typescript

Next, install eslint-plugin-sbnc-typescript-rules:

npm install eslint-plugin-sbnc-typescript-rules --save-dev

Usage

Add sbnc-typescript-rules to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "sbnc-typescript-rules"
    ]
}

Then configure the rules you want to use under the rules section. Since these rules are a superset of the built-in rules with the same names those need to be disabled for the replacements to work as intended.

{
    "rules": {
      "@typescript-eslint/type-annotation-spacing"   : "off",
      "sbnc-typescript-rules/type-annotation-spacing": "warn"
    }
}

Supported Rules

This Plugin contains one rule. It is an extended versions of the existing rule under the same name provided with typescript-eslint. This rule should behave exactly the same as the original counterpart if the rule configuration is the same. However, it allows some additional configuration options to further fine-tune the behaviour.

For detailed information and examples about the rule refer to the respective documentation under the docs/rules folder:

type-annotation-spacing

This rule provides extra options to allow turning off some parts of the rule enforcement.

The two new options are: ignoreBefore and ignoreAfter. These can be used to turn off the enforcement of spaces before or after the type annotation.

This can be useful in use with conjunction of the key-spacing rule to allow aligning the type annotations on the colons. An example configuration may look like this:

{
  "rules": {
    "key-spacing": [ "warn", { "align": "colon" } ],
    "sbnc-typescript-rules/type-annotation-spacing": [ "warn", { "overrides": { "property": { "ignoreBefore": true } } } ]
  }
}

This configuration would allow the following code, which would otherwise be considered invalid and cause a conflict between key-spacing and @typescript-eslint/type-annotation-spacing:

type Foo = {
  barShortName                        : string
  barVeryLongNameThatPushesTheColonOut: string
}

Additional info

The plugin scaffolding was created based on the @darraghor/eslint-plugin-nestjs-typed plugin.


Bence Szalai - https://sbnc.eu/

For similar extended rules of the base ESLint rules check out my other plugin: eslint-plugin-sbnc-rules.