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
pnpm add -D stylelint
Or, with yarn
yarn add -D stylelint
Or, with npm
npm install -D stylelint
@nuxtjs/stylelint-module dependency to your projectnpx nuxi@latest module add stylelint
@nuxtjs/stylelint-module to the modules section of nuxt.config.jsexport default {
modules: [
// Simple usage
"@nuxtjs/stylelint-module",
// With options
[
"@nuxtjs/stylelint-module",
{
/* module options */
},
],
],
};
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.
cacheBooleantrueNote: The cache is enabled by default to decrease execution time.
includeString|Array[String][nuxt.options.srcDir.'/**/*.{css,scss,sass,less,styl,vue}']Specify directories, files, or globs.
excludeArray[String]['**/node_modules/**', 'virtual:', nuxt.options.buildDir]Specify the files and/or directories to exclude.
stylelintPathStringstylelintPath to stylelint instance that will be used for linting.
formatterFunction'string'Specify the formatter that you would like to use to format your results.
lintOnStartBooleantrueCheck all matching files on project startup, too slow, turn on discreetly.
lintDirtyOnlyBooleantrueLint changed files only when running Stylelint except from buildStart hook, all specified files from include option will be linted when disabled.
emitWarningBooleantrueThe warnings found will be printed.
emitErrorBooleantrueThe errors found will be printed.
failOnWarningwebpack // Only works with webpack builderBooleanfalseWill cause the module build to fail if there are any warnings, based on emitWarning.
failOnErrorwebpack // Only works with webpack builderBooleantrueWill 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:
pnpm installpnpm dev:preparepnpm buildpnpm devCopyright (c) Nuxt Modules