# @nuxtjs/stylelint-module

> Stylelint module for Nuxt.js

Latest version **5.2.1** (published 2025-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nuxtjs/stylelint-module
pnpm add @nuxtjs/stylelint-module
yarn add @nuxtjs/stylelint-module
bun add @nuxtjs/stylelint-module
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 5.2.1 |
| Published | 2025-03-19 |
| First published | 2019-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 72 |
| Maintainers | ricardogobbosouza |

## Links

- npm: https://www.npmjs.com/package/@nuxtjs/stylelint-module
- Repository: https://github.com/nuxt-modules/stylelint
- Homepage: https://github.com/nuxt-modules/stylelint#readme
- Issues: https://github.com/nuxt-modules/stylelint/issues
- npm.io page: https://npm.io/package/@nuxtjs/stylelint-module

## Dependencies (5)

- [pathe](https://npm.io/package/pathe.md) ^2.0.3
- [chokidar](https://npm.io/package/chokidar.md) ^4.0.3
- [@nuxt/kit](https://npm.io/package/@nuxt/kit.md) ^3.16.0
- [vite-plugin-stylelint](https://npm.io/package/vite-plugin-stylelint.md) ^6.0.0
- [stylelint-webpack-plugin](https://npm.io/package/stylelint-webpack-plugin.md) ^5.0.1

## Recent versions

- 5.2.1 (latest) — 2025-03-19
- 4.2.2 (nuxt2) — 2023-11-28
- 5.2.0 — 2024-02-06
- 5.1.0 — 2023-05-18
- 4.2.1 — 2023-03-10
- 5.0.1 — 2023-03-10
- 5.0.0 — 2023-03-08
- 4.2.0 — 2023-03-08
- 4.1.0 — 2021-11-30
- 4.0.0 — 2020-05-14
- 3.2.2 — 2020-02-08
- 3.2.1 — 2020-01-16
- 3.2.0 — 2020-01-13
- 3.1.1 — 2019-12-02
- 3.1.0 — 2019-11-18
- … 3 more at https://npm.io/package/@nuxtjs/stylelint-module/versions

## README

# @nuxtjs/stylelint-module

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]

> Stylelint module for Nuxt.js

[📖 **Release Notes**](./CHANGELOG.md)

---

**Note:** This branch is for **Nuxt 3** or **Nuxt Bridge** compatible module.
Checkout the [`nuxt2` branch](https://github.com/nuxt-modules/stylelint/tree/nuxt2) for **Nuxt 2** support.

---

## Requirements

You need to ensure that you have `stylelint` installed:

With `pnpm`

```bash
pnpm add -D stylelint
```

Or, with `yarn`

```bash
yarn add -D stylelint
```

Or, with `npm`

```bash
npm install -D stylelint
```

## Setup

1. Add `@nuxtjs/stylelint-module` dependency to your project

```bash
npx nuxi@latest module add stylelint
```

2. Add `@nuxtjs/stylelint-module` to the `modules` section of `nuxt.config.js`

```js
export default {
  modules: [
    // Simple usage
    "@nuxtjs/stylelint-module",

    // With options
    [
      "@nuxtjs/stylelint-module",
      {
        /* module options */
      },
    ],
  ],
};
```

### Using top level options

```js
export default {
  modules: ["@nuxtjs/stylelint-module"],
  stylelint: {
    /* module options */
  },
};
```

## Options

See [stylelint's options](http://stylelint.io/user-guide/node-api/#options) for the complete list of options available.
These options are passed through to the `stylelint` directly.

### `cache`

- Type: `Boolean`
- Default: `true`

**Note**: The cache is enabled by default to decrease execution time.

### `include`

- Type: `String|Array[String]`
- Default: `[nuxt.options.srcDir.'/**/*.{css,scss,sass,less,styl,vue}']`

Specify directories, files, or globs.

### `exclude`

- Type: `Array[String]`
- Default: `['**/node_modules/**', 'virtual:', nuxt.options.buildDir]`

Specify the files and/or directories to exclude.

### `stylelintPath`

- Type: `String`
- Default: `stylelint`

Path to `stylelint` instance that will be used for linting.

### `formatter`

- Type: `Function`
- Default: `'string'`

Specify the formatter that you would like to use to format your results.

### `lintOnStart`

- Type: `Boolean`
- Default: `true`

Check all matching files on project startup, too slow, turn on discreetly.

### `lintDirtyOnly`

- Type: `Boolean`
- Default: `true`

Lint changed files only when running Stylelint except from buildStart hook, all specified files from `include` option will be linted when disabled.

### `emitWarning`

- Type: `Boolean`
- Default: `true`

The warnings found will be printed.

### `emitError`

- Type: `Boolean`
- Default: `true`

The errors found will be printed.

### `failOnWarning`

- Builder: `webpack` // Only works with webpack builder
- Type: `Boolean`
- Default: `false`

Will cause the module build to fail if there are any warnings, based on `emitWarning`.

### `failOnError`

- Builder: `webpack` // Only works with webpack builder
- Type: `Boolean`
- Default: `true`

Will cause the module build to fail if there are any errors, based on `emitError`.

## Contributing

You can contribute to this module online with CodeSandBox:

[![Edit @nuxtjs/robots](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/nuxt-modules/stylelint/?fontsize=14&hidenavigation=1&theme=dark)

Or locally:

1. Clone this repository
2. Install dependencies using `pnpm install`
3. Prepare development server using `pnpm dev:prepare`
4. Build module using `pnpm build`
5. Launch playground using `pnpm dev`

## License

[MIT License](./LICENSE)

Copyright (c) Nuxt Modules

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/stylelint-module/latest.svg
[npm-version-href]: https://npmjs.com/package/@nuxtjs/stylelint-module
[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/stylelint-module.svg
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/stylelint-module
[github-actions-ci-src]: https://github.com/nuxt-modules/stylelint/workflows/ci/badge.svg
[github-actions-ci-href]: https://github.com/nuxt-modules/stylelint/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-modules/stylelint.svg
[codecov-href]: https://codecov.io/gh/nuxt-modules/stylelint
[license-src]: https://img.shields.io/npm/l/@nuxtjs/stylelint-module.svg
[license-href]: https://npmjs.com/package/@nuxtjs/stylelint-module

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