16.20.0 • Published 5 months ago

@bhsd/stylelint-browserify v16.20.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Stylelint-browserify

npm version License Codacy Badge

API

The stylelint global variable has a lint() method.

const result = await stylelint.lint(options);

Options

config

A configuration object.

code

A string to lint.

The returned promise

stylelint.lint() returns a Promise that resolves with an object containing the following properties:

code

A string that contains the autofixed code, if the fix option is set to true. Otherwise, it is undefined.

errored

Boolean. If true, at least one rule with an "error"-level severity registered a problem.

report

A JSON string that contains the formatted problems.

results

An array containing all the Stylelint result objects (the objects that formatters consume).

Edit info

When the computeEditInfo option is enabled, a warning may include a fix property that provides information about suggested fixes:

  • range ([number, number]) - the pair of 0-based indices in source code text to remove
  • text (string) - the text to add

For example, to change a { opacity: 10%; } to a { opacity: 0.1; }, the EditInfo might look like:

{
  // "line", "column", "rule", ...
  "fix": {
    "range": [13, 16], // Indices of "10%"
    "text": "0.1" // Replacement text
  }
}

Only a single EditInfo will be recorded for a specific region in source code. If multiple report ranges overlap, only the first will contain EditInfo.

Syntax errors

stylelint.lint() does not reject the Promise when your CSS contains syntax errors. It resolves with an object (see the returned promise) that contains information about the syntax error.

16.20.0

5 months ago

16.19.1-es8

6 months ago

16.19.1-es7

6 months ago

16.19.1

6 months ago