Rule: no-unnecessary-class

Disallows classes that are not strictly necessary.

Rationale

Users who come from a Java-style OO language may wrap their utility functions in an extra class, instead of putting them at the top level.

Config

Three arguments may be optionally provided:

  • "allow-constructor-only" ignores classes whose members are constructors.
  • "allow-empty-class" ignores class DemoClass {}.
  • "allow-static-only" ignores classes whose members are static.
Config examples
"no-unnecessary-class": true
"no-unnecessary-class": ["allow-empty-class", "allow-constructor-only"]
Schema
{
  "type": "array",
  "items": {
    "type": "string"
  },
  "minLength": 0,
  "maxLength": 3
}