UNPKG

4.06 kBMarkdownView Raw
1# @nuxtjs/stylelint-module
2
3[![npm version][npm-version-src]][npm-version-href]
4[![npm downloads][npm-downloads-src]][npm-downloads-href]
5[![Circle CI][circle-ci-src]][circle-ci-href]
6[![Codecov][codecov-src]][codecov-href]
7[![License][license-src]][license-href]
8
9> Stylelint module for Nuxt.js
10
11[📖 **Release Notes**](./CHANGELOG.md)
12
13## Requirements
14
15You need to ensure that you have `stylelint` installed:
16
17```bash
18yarn add --dev stylelint # or npm install --save-dev stylelint
19```
20
21## Setup
22
231. Add `@nuxtjs/stylelint-module` dependency to your project
24
25```bash
26yarn add --dev @nuxtjs/stylelint-module # or npm install --save-dev @nuxtjs/stylelint-module
27```
28
292. Add `@nuxtjs/stylelint-module` to the `buildModules` section of `nuxt.config.js`
30
31:warning: If you are using Nuxt older than **v2.9** you have to install module as a `dependency` (No `--dev` or `--save-dev` flags) and also use `modules` section in `nuxt.config.js` instead of `buildModules`.
32
33```js
34export default {
35 buildModules: [
36 // Simple usage
37 '@nuxtjs/stylelint-module',
38
39 // With options
40 ['@nuxtjs/stylelint-module', { /* module options */ }]
41 ]
42}
43```
44
45### Using top level options
46
47```js
48export default {
49 buildModules: [
50 '@nuxtjs/stylelint-module'
51 ],
52 stylelint: {
53 /* module options */
54 }
55}
56```
57
58## Options
59
60You can pass [stylelint options](http://stylelint.io/user-guide/node-api/#options).
61
62### `context`
63
64- Type: `String`
65- Default: `srcDir`
66
67A string indicating the root of your files.
68
69### `files`
70
71- Type: `String|Array[String]`
72- Default: `['assets/**/*.{s?(a|c)ss,less,stylus}', '{components,layouts,pages}/**/*.vue']`
73
74Specify the glob pattern for finding files. Must be relative to `options.context`.
75
76### `formatter`
77
78- Type: `Function`
79- Default: `require('stylelint').formatters.string`
80
81Specify the formatter that you would like to use to format your results.
82
83### `lintDirtyModulesOnly`
84
85- Type: `Boolean`
86- Default: `false`
87
88Lint only changed files, skip lint on start.
89
90### `stylelintPath`
91
92- Type: `String`
93- Default: `stylelint`
94
95Path to `stylelint` instance that will be used for linting.
96
97### Errors and Warning
98
99**By default the plugin will auto adjust error reporting depending on stylelint errors/warnings counts.**
100You can still force this behavior by using `emitError` **or** `emitWarning` options:
101
102#### `emitError`
103
104- Type: `Boolean`
105- Default: `false`
106
107Will always return errors, if set to `true`.
108
109#### `emitWarning`
110
111- Type: `Boolean`
112- Default: `false`
113
114Will always return warnings, if set to `true`.
115
116#### `failOnError`
117
118- Type: `Boolean`
119- Default: `false`
120
121Will cause the module build to fail if there are any errors, if set to `true`.
122
123#### `failOnWarning`
124
125- Type: `Boolean`
126- Default: `false`
127
128Will cause the module build to fail if there are any warnings, if set to `true`.
129
130#### `quiet`
131
132- Type: `Boolean`
133- Default: `false`
134
135Will process and report errors only and ignore warnings, if set to `true`.
136
137## Development
138
1391. Clone this repository
1402. Install dependencies using `yarn install` or `npm install`
1413. Start development server using `npm run dev`
142
143## License
144
145[MIT License](./LICENSE)
146
147Copyright (c) Nuxt Community
148
149<!-- Badges -->
150[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/stylelint-module/latest.svg?style=flat-square
151[npm-version-href]: https://npmjs.com/package/@nuxtjs/stylelint-module
152
153[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/stylelint-module.svg?style=flat-square
154[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/stylelint-module
155
156[circle-ci-src]: https://img.shields.io/circleci/project/github/nuxt-community/stylelint-module.svg?style=flat-square
157[circle-ci-href]: https://circleci.com/gh/nuxt-community/stylelint-module
158
159[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/stylelint-module.svg?style=flat-square
160[codecov-href]: https://codecov.io/gh/nuxt-community/stylelint-module
161
162[license-src]: https://img.shields.io/npm/l/@nuxtjs/stylelint-module.svg?style=flat-square
163[license-href]: https://npmjs.com/package/@nuxtjs/stylelint-module