https://github.com/exogen/stylis-plugin-stylelint
Run stylelint as Stylis middleware.
https://github.com/exogen/stylis-plugin-stylelint
Last synced: about 1 year ago
JSON representation
Run stylelint as Stylis middleware.
- Host: GitHub
- URL: https://github.com/exogen/stylis-plugin-stylelint
- Owner: exogen
- License: mit
- Created: 2018-03-03T22:52:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-04T06:13:01.000Z (over 8 years ago)
- Last Synced: 2025-04-03T11:15:42.445Z (over 1 year ago)
- Language: JavaScript
- Size: 97.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stylis-plugin-stylelint
Run stylelint as a Stylis plugin. The plugin runs against the CSS content during
the `-1` stage.
## Usage
```js
import stylis from 'stylis'
import stylelintPlugin from 'stylis-plugin-stylelint'
stylis.use(stylelintPlugin(/* options */))
```
### Options
#### failOnError
Whether to throw an error from the plugin if stylelint finds any errors.
Default: `false`
#### stripIndent
Whether to strip indentation from the CSS string before linting. Uses the
[strip-indent](https://github.com/sindresorhus/strip-indent) module.
Default: `true`
#### formatter
The stylelint formatter to use.
Default: `'string'`
#### getLintOptions
A custom function to add options to
[the object passed to stylelint](https://github.com/stylelint/stylelint/blob/master/docs/user-guide/node-api.md#options).
The result will be merged with (and will overwrite) existing options set by this
plugin.
The function is called with a `meta` object with values from stylis:
`{ selectors, parent, line, column, length }`
Default: `undefined`
### resultCollector
If `failOnError` is false but there is an error, this function will be called
with the results. You can use this to extract the errors that occurred and
report them in a nicer way without throwing.
Default: `undefined`