Stylelint module for Nuxt.js
npm install @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
---
Note: This branch is for Nuxt 3 or Nuxt Bridge compatible module.
Checkout the nuxt2 branch for Nuxt 2 support.
---
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
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 /
},
],
],
};
`
`js`
export default {
modules: ["@nuxtjs/stylelint-module"],
stylelint: {
/ module options /
},
};
See stylelint's options for the complete list of options available.
These options are passed through to the stylelint directly.
- Type: Booleantrue
- Default:
Note: The cache is enabled by default to decrease execution time.
- Type: String|Array[String][nuxt.options.srcDir.'/*/.{css,scss,sass,less,styl,vue}']
- Default:
Specify directories, files, or globs.
- Type: Array[String]['/node_modules/', 'virtual:', nuxt.options.buildDir]
- Default:
Specify the files and/or directories to exclude.
- Type: Stringstylelint
- Default:
Path to stylelint instance that will be used for linting.
- Type: Function'string'
- Default:
Specify the formatter that you would like to use to format your results.
- Type: Booleantrue
- Default:
Check all matching files on project startup, too slow, turn on discreetly.
- Type: Booleantrue
- Default:
Lint changed files only when running Stylelint except from buildStart hook, all specified files from include option will be linted when disabled.
- Type: Booleantrue
- Default:
The warnings found will be printed.
- Type: Booleantrue
- Default:
The errors found will be printed.
- Builder: webpack // Only works with webpack builderBoolean
- Type: false
- Default:
Will cause the module build to fail if there are any warnings, based on emitWarning.
- Builder: webpack // Only works with webpack builderBoolean
- Type: true
- Default:
Will cause the module build to fail if there are any errors, based on emitError.
You can contribute to this module online with CodeSandBox:

Or locally:
1. Clone this repository
2. Install dependencies using pnpm installpnpm dev:prepare
3. Prepare development server using pnpm build
4. Build module using pnpm dev`
5. Launch playground using
Copyright (c) Nuxt Modules
[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