New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

eslint-plugin-scats

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-scats

ESLint rules for safe scats usage

latest
Source
npmnpm
Version
0.5.9
Version published
Maintainers
1
Created
Source

eslint-plugin-scats

ESLint plugin with rules for safer and more idiomatic usage of scats.

Installation

npm install --save-dev eslint eslint-plugin-scats

If you lint TypeScript, also install:

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

Configs

Legacy config

Recommended:

module.exports = {
  plugins: ['scats'],
  extends: ['plugin:scats/recommended'],
};

Strict:

module.exports = {
  plugins: ['scats'],
  extends: ['plugin:scats/strict'],
};

Flat config

const scats = require('eslint-plugin-scats');

module.exports = [
  {
    plugins: {
      scats,
    },
    rules: {
      ...scats.configs.recommended.rules,
    },
  },
];

For strict mode use scats.configs.strict.rules.

Rules

  • scats/to-array-terminal: requires .toArray to be terminal in scats call chains
  • scats/no-array-option-fallback: disallows Option#getOrElseValue([]), Option#getOrElse(() => []), Option#getOrElseValue(Nil.toArray), and similar array fallbacks; prefer keeping values as scats collections and using Nil or an appropriate empty collection
  • scats/no-collection-emptiness-comparison: prefers .isEmpty and .nonEmpty over comparing scats collection .length or .size to zero
  • scats/no-collection-get-zero: disallows Collection#get(0); prefer head or headOption to make first-element access explicit
  • scats/no-explicit-empty: disallows creating obviously empty scats collections via constructors/factories when Nil or *.empty should be used
  • scats/no-option-nullish-fallback: disallows option(null)/option(undefined) in favor of none, disallows Option#getOrElse(() => null), Option#getOrElseValue(null), the corresponding undefined fallbacks, and redundant patterns such as option(existingOption.orNull) or option(existingOption.orNull).orElse(() => option(fallback.orNull)) when the original Option should be used directly
  • scats/no-option-foreach-assignment: disallows let result = none followed by mutation inside option(...).foreach(...); prefer deriving the value with map or flatMap
  • scats/prefer-get-or-else-value: prefers Option#getOrElseValue(...) over Option#getOrElse(() => ...) when the callback returns an explicit constant such as a literal or static template string, and prefers Option#orElseValue(...) over Option#orElse(() => someOption) when the fallback is already an Option
  • scats/no-useless-to-array-iteration: disallows for...of (... of collection.toArray) for confirmed scats collections and auto-fixes to iterate the scats collection directly

Strict

  • includes all recommended rules
  • scats/no-array-construction: disallows storing JavaScript arrays in local variables or class fields; inline arrays and object property assignments for external APIs remain allowed
  • scats/no-array-mutation: disallows mutating JavaScript arrays directly via mutating methods, index writes, or length = ...; this rule uses TypeScript type information to avoid false positives on non-array objects with methods like push
  • scats/no-array-typed-variable: disallows local variables and class fields typed as Array<T>, ReadonlyArray<T>, or T[]; this catches cases where .toArray results are stored explicitly as JavaScript arrays. For DTOs or external contracts, annotate the class with @scatsAllowArrayTypes
  • scats/no-nullish-syntax: disallows ?. and ??; prefer explicit Option flows such as option(x).flatMap(...) and option(x).getOrElseValue(...)

Development

npm test

Keywords

eslint

FAQs

Package last updated on 07 Mar 2026

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