Skip to content

Commit 3d0c3a9

Browse files
refactor!: add support for nuxt 3/nuxt bridge (#74)
* feat: support nuxt 3 * docs: update readme * fix: use include option * chore: reorder options
1 parent ecbd1d9 commit 3d0c3a9

33 files changed

+8210
-11610
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# editorconfig.org
21
root = true
32

43
[*]

.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"@nuxtjs/eslint-config-typescript"
4+
]
5+
}

.eslintrc.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,28 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
# os: [ubuntu-latest, macos-latest, windows-latest]
1817
os: [ubuntu-latest]
19-
node: [14]
18+
node: [16]
2019

2120
steps:
22-
- uses: actions/setup-node@v2
21+
- uses: actions/checkout@v3
22+
- run: corepack enable
23+
- uses: actions/setup-node@v3
2324
with:
2425
node-version: ${{ matrix.node }}
26+
cache: "pnpm"
2527

26-
- name: checkout
27-
uses: actions/checkout@v2
28+
- name: 📦 Install dependencies
29+
run: pnpm install --frozen-lockfile
2830

29-
- name: cache node_modules
30-
uses: actions/cache@v2
31-
with:
32-
path: node_modules
33-
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
34-
35-
- name: Install dependencies
36-
if: steps.cache.outputs.cache-hit != 'true'
37-
run: yarn
31+
- name: 🚧 Set up project
32+
run: pnpm dev:prepare
3833

39-
- name: Lint
40-
run: yarn lint
34+
- name: 🛠 Build project
35+
run: pnpm build
4136

42-
- name: Test
43-
run: yarn test
37+
- name: 🧪 Test project
38+
run: pnpm test
4439

45-
- name: Coverage
46-
uses: codecov/codecov-action@v2
40+
- name: 🟩 Coverage
41+
uses: codecov/codecov-action@v3

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ node_modules
77
.DS_Store
88
coverage
99
dist
10+
sw.*
11+
.env
12+
.output

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shamefully-hoist=true

.stylelintcache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"/Users/ricardogobbosouza/code/stylelint-module/playground/app.vue":"1"},{"size":41,"mtime":1678286733960,"hashOfConfig":"2"},"13zl9hh"]

README.md

Lines changed: 73 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,51 @@
1414

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

17+
With `pnpm`
18+
1719
```bash
18-
yarn add --dev stylelint # or npm install --save-dev stylelint
20+
pnpm add -D stylelint
21+
```
22+
23+
Or, with `yarn`
24+
25+
```bash
26+
yarn add -D stylelint
27+
```
28+
29+
Or, with `npm`
30+
31+
```bash
32+
npm install -D stylelint
1933
```
2034

2135
## Setup
2236

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

39+
With `pnpm`
40+
2541
```bash
26-
yarn add --dev @nuxtjs/stylelint-module # or npm install --save-dev @nuxtjs/stylelint-module
42+
pnpm add -D @nuxtjs/stylelint-module
2743
```
2844

29-
2. Add `@nuxtjs/stylelint-module` to the `buildModules` section of `nuxt.config.js`
45+
Or, with `yarn`
46+
47+
```bash
48+
yarn add -D @nuxtjs/stylelint-module
49+
```
50+
51+
Or, with `npm`
52+
53+
```bash
54+
npm install -D @nuxtjs/stylelint-module
55+
```
56+
57+
2. Add `@nuxtjs/stylelint-module` to the `modules` section of `nuxt.config.js`
3058

3159
```js
3260
export default {
33-
buildModules: [
61+
modules: [
3462
// Simple usage
3563
'@nuxtjs/stylelint-module',
3664

@@ -40,13 +68,11 @@ export default {
4068
}
4169
```
4270

43-
:warning: If you are using Nuxt **< v2.9** you have to install the module as a `dependency` (No `--dev` or `--save-dev` flags) and use `modules` section in `nuxt.config.js` instead of `buildModules`.
44-
4571
### Using top level options
4672

4773
```js
4874
export default {
49-
buildModules: [
75+
modules: [
5076
'@nuxtjs/stylelint-module'
5177
],
5278
stylelint: {
@@ -57,51 +83,29 @@ export default {
5783

5884
## Options
5985

60-
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.
86+
See [stylelint's options](http://stylelint.io/user-guide/node-api/#options) for the complete list of options available.
87+
These options are passed through to the `stylelint` directly.
6188

62-
### `configFile`
63-
64-
- Type: `String`
65-
- Default: `undefined`
66-
67-
Specify the config file location to be used by `stylelint`.
68-
69-
**Note:** By default this is [handled by `stylelint`](http://stylelint.io/user-guide/configuration/).
70-
71-
### `context`
72-
73-
- Type: `String`
74-
- Default: `srcDir`
75-
76-
A string indicating the root of your files.
77-
78-
### `files`
79-
80-
- Type: `String|Array[String]`
81-
- Default: `['assets/**/*.{s?(a|c)ss,less,stylus}', '{components,layouts,pages}/**/*.vue']`
82-
83-
Specify the glob pattern for finding files. Must be relative to `options.context`.
84-
85-
### `fix`
89+
### `cache`
8690

8791
- Type: `Boolean`
88-
- Default: `false`
92+
- Default: `true`
8993

90-
If `true`, `stylelint` will fix as many errors as possible. The fixes are made to the actual source files. All unfixed errors will be reported. See [Autofixing errors](https://stylelint.io/user-guide/cli#autofixing-errors) docs.
94+
**Note**: The cache is enabled by default to decrease execution time.
9195

92-
### `formatter`
96+
### `include`
9397

94-
- Type: `Function`
95-
- Default: `require('stylelint').formatters.string`
98+
- Type: `String|Array[String]`
99+
- Default: `[nuxt.options.srcDir.'/**/*.{css,scss,sass,less,styl,vue}']`
96100

97-
Specify the formatter that you would like to use to format your results.
101+
Specify directories, files, or globs.
98102

99-
### `lintDirtyModulesOnly`
103+
### `exclude`
100104

101-
- Type: `Boolean`
102-
- Default: `false`
105+
- Type: `Array[String]`
106+
- Default: `['**/node_modules/**', 'virtual:', nuxt.options.buildDir]`
103107

104-
Lint only changed files, skip lint on start.
108+
Specify the files and/or directories to exclude.
105109

106110
### `stylelintPath`
107111

@@ -110,51 +114,61 @@ Lint only changed files, skip lint on start.
110114

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

113-
### Errors and Warning
117+
### `formatter`
118+
119+
- Type: `Function`
120+
- Default: `'string'`
114121

115-
**By default the plugin will auto adjust error reporting depending on stylelint errors/warnings counts.**
116-
You can still force this behavior by using `emitError` **or** `emitWarning` options:
122+
Specify the formatter that you would like to use to format your results.
117123

118-
#### `emitError`
124+
### `lintOnStart`
119125

120126
- Type: `Boolean`
121127
- Default: `true`
122128

123-
Will always return errors, if set to `true`.
129+
Check all matching files on project startup, too slow, turn on discreetly.
124130

125-
#### `emitWarning`
131+
### `emitWarning`
126132

127133
- Type: `Boolean`
128134
- Default: `true`
129135

130-
Will always return warnings, if set to `true`.
136+
The warnings found will be printed.
131137

132-
#### `failOnError`
138+
### `emitError`
133139

134140
- Type: `Boolean`
135141
- Default: `true`
136142

137-
Will cause the module build to fail if there are any errors, if set to `true`.
143+
The errors found will be printed.
138144

139-
#### `failOnWarning`
145+
### `failOnWarning`
140146

141147
- Type: `Boolean`
142148
- Default: `false`
143149

144-
Will cause the module build to fail if there are any warnings, if set to `true`.
150+
Will cause the module build to fail if there are any warnings, based on `emitWarning`.
145151

146-
#### `quiet`
152+
### `failOnError`
147153

148154
- Type: `Boolean`
149-
- Default: `false`
155+
- Default: `true`
156+
157+
Will cause the module build to fail if there are any errors, based on `emitError`.
158+
159+
## Contributing
160+
161+
You can contribute to this module online with CodeSandBox:
150162

151-
Will process and report errors only and ignore warnings, if set to `true`.
163+
[![Edit @nuxtjs/robots](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/nuxt-community/stylelint-module/?fontsize=14&hidenavigation=1&theme=dark)
152164

153-
## Development
165+
Or locally:
154166

155167
1. Clone this repository
156-
2. Install dependencies using `yarn install` or `npm install`
157-
3. Start development server using `npm run dev`
168+
2. Install dependencies using `pnpm install`
169+
3. Prepare development server using `pnpm dev:prepare`
170+
4. Build module using `pnpm build`
171+
5. Launch playground using `pnpm dev`
158172

159173
## License
160174

commitlint.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

husky.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)