Rule: max-classes-per-file

A file may not contain more than the specified number of classes

Rationale

Ensures that files have a single responsibility so that that classes each exist in their own files

Config

The one required argument is an integer indicating the maximum number of classes that can appear in a file. An optional argument "exclude-class-expressions" can be provided to exclude class expressions from the overall class count.

Config examples
"max-classes-per-file": [true, 1]
"max-classes-per-file": [true, 5, "exclude-class-expressions"]
Schema
{
  "type": "array",
  "items": [
    {
      "type": "number",
      "minimum": 1
    },
    {
      "type": "string",
      "enum": [
        "exclude-class-expressions"
      ]
    }
  ],
  "additionalItems": false,
  "minLength": 1,
  "maxLength": 2
}