# neutrino-middleware-stylelint

> Neutrino middleware for adding Stylelint support.

Latest version **3.0.0** (published 2017-07-01) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install neutrino-middleware-stylelint
pnpm add neutrino-middleware-stylelint
yarn add neutrino-middleware-stylelint
bun add neutrino-middleware-stylelint
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2017-07-01 |
| First published | 2017-03-28 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Capi Etheriel |
| Maintainers | barraponto |
| Keywords | neutrino, neutrino-middleware, stylelint |

## Links

- npm: https://www.npmjs.com/package/neutrino-middleware-stylelint
- Repository: https://github.com/barraponto/neutrino-preset-stylelint
- Homepage: https://github.com/barraponto/neutrino-preset-stylelint#readme
- Issues: https://github.com/barraponto/neutrino-preset-stylelint/issues
- npm.io page: https://npm.io/package/neutrino-middleware-stylelint

## Dependencies (2)

- [deepmerge](https://npm.io/package/deepmerge.md) ^1.4.4
- [stylelint-webpack-plugin](https://npm.io/package/stylelint-webpack-plugin.md) ^0.8.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2017-07-01
- 4.0.0-rc.2 (beta) — 2017-10-21
- 4.0.0-rc.1 (next) — 2017-07-01
- 3.0.0-beta.3 — 2017-04-22
- 3.0.0-beta.2 — 2017-04-19
- 2.0.3 — 2017-04-19
- 2.0.2 — 2017-03-28
- 2.0.0 — 2017-03-28

## README

# Neutrino Stylelint middleware 
[![NPM version][npm-image]][npm-url] [![NPM downloads][npm-downloads]][npm-url]
[![Join Slack][slack-image]][slack-url]

`neutrino-middleware-stylelint` is a Neutrino middleware that adds basic support
for [Stylelint][stylelint].

## Installation

Installation requires a single command:

`yarn add --dev neutrino-middleware-stylelint`

If you want to extend a stylelint configuration, such as [the Stylelint
standard configuration][stylelint-config-standard], don't forget to install it
too.

`yarn add --dev stylelint-config-standard`

(Yet, if that's all you really want, use our [pre-configured
preset][neutrino-preset-stylelint-standard] instead.)

## Documentation

Using this middleware requires configuration through options. It is not
designed to be used on its own, instead it should be configured in your own
preset.

For example, in `neutrino-stylelint.js`, write this configuration:

```javascript
const stylelint = require('neutrino-middleware-stylelint');

module.exports = (neutrino) => {
  neutrino.use(stylelint, {
    config: {
      extends: require.resolve('stylelint-config-standard'),
      rules: {
        "indentation": "tab",
        "number-leading-zero": null,
        "property-no-unknown": [ true, {
          "ignoreProperties": [
            "composes"
          ]
        }],
        "unit-whitelist": ["em", "rem", "s"]
      }
    }
  });
};

```

Then configure `package.json` to have Neutrino pick up your custom preset:

```json
"neutrino": {
  "use": [
    "neutrino-preset-web",
    "./neutrino-stylelint.js"
  ]
}
```

See [neutrino advanced configuration][neutrino-advanced-configuration] for more
details.

## Options

Every [stylelint plugin option][swp-docs] can be overwritten by setting in the
middleware options.

## Defaults

This middleware overrides some defaults from `stylelint-webpack-plugin`:

- `files`: set to `'**/*.+(css|scss|sass|less)'`, supporting CSS, Sass and Less
- `failOnError`: set to `false`, prevents Hot Module Replacement
  [issues][swp-hmr-issues].

You can see the other default values in [the stylelint-webpack-plugin
docs][swp-docs].

## stylelint.config.js

`neutrino-middleware-stylelint` also provides a method for getting the
Stylelint configuration suitable for use in a stylelint.config.js file.
Typically this is used for providing hints or fix solutions to the development
environment, e.g. IDEs and text editors. Doing this requires creating an
instance of the Neutrino API and providing the presets used. If you keep this
information in neutrino.use in package.json, this should be relatively
straightforward.

Example: Create a stylelint.config.js file in the root of the project.

```javascript
// .eslintrc.js
const { Neutrino } = require('neutrino');
const pkg = require('./package.json');
const api = Neutrino();

pkg.neutrino.use
  .map(require)
  .map(api.use);

module.exports = api.stylelintrc();
```


[stylelint]: https://stylelint.io/
[stylelint-config-docs]: https://stylelint.io/user-guide/configuration/
[stylelint-config-standard]: https://github.com/stylelint/stylelint-config-standard
[swp-hmr-issues]: https://github.com/JaKXz/stylelint-webpack-plugin/issues/24
[swp-docs]: https://github.com/JaKXz/stylelint-webpack-plugin#options
[neutrino-preset-stylelint]: https://www.npmjs.com/package/neutrino-preset-stylelint
[neutrino-preset-stylelint-standard]: https://www.npmjs.com/package/neutrino-preset-stylelint-standard
[npm-image]: https://img.shields.io/npm/v/neutrino-middleware-stylelint.svg
[npm-downloads]: https://img.shields.io/npm/dt/neutrino-middleware-stylelint.svg
[npm-url]: https://npmjs.org/package/neutrino-middleware-stylelint
[slack-image]: https://neutrino-slack.herokuapp.com/badge.svg
[slack-url]: https://neutrino-slack.herokuapp.com/

---
_Source: https://npm.io/package/neutrino-middleware-stylelint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
