JSPM

stylelint-file-max-lines

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2462
  • Score
    100M100P100Q116463F
  • License MIT

Limit a maximum number of lines per file

Package Exports

  • stylelint-file-max-lines
  • stylelint-file-max-lines/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stylelint-file-max-lines) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stylelint-file-max-lines

Stylelint rule for limiting a maximum number of lines per file.

Please note that most editors show an additional empty line at the end if the file ends with a line break. This plugin does not count that extra line.


This plugin is inspired by eslint max-lines and is an enhancement to dkrnl/stylelint-max-lines

install

npm i stylelint-file-max-lines -D

Usage

Add this config to your .stylelintrc:

{
  "plugins": ["stylelint-file-max-lines"],
  "rules": {
    "plugin/file-max-lines": 300
  }
}

Options

int: maximum number of lines per file

For example, with 5:

{
  "plugins": ["stylelint-file-max-lines"],
  "rules": {
    "plugin/file-max-lines": 5
  }
}

The following css file will get an error: 'File has too many lines (6). Maximum allowed is 5 (plugin/file-max-lines)

body {
  border: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

Optional secondary options

ignore: "comments" | "blankLines"

Ignore comments

{
  "plugins": ["stylelint-file-max-lines"],
  "rules": {
    "plugin/file-max-lines": [5, { "ignore": "comments" }]
  }
}

The following css file are not considered problems

body {
  /* border: none; */
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

Ignore blankLines

{
  "plugins": ["stylelint-file-max-lines"],
  "rules": {
    "plugin/file-max-lines": [5, { "ignore": "blankLines" }]
  }
}

The following css file are not considered problems

body {
  margin: 0;
  padding: 0;

  box-sizing: border-box;
}