Skip to content

Commit 791999a

Browse files
gucong3000yyx990803
authored andcommitted
docs: add doc for using with stylelint (#1343)
1 parent 64af079 commit 791999a

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

docs/guide/linting.md

+34
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Linting
22

3+
## ESLint
4+
35
The official [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) supports linting both the template and script parts of Vue single file components.
46

57
Make sure to use the plugin's included config in your ESLint config:
@@ -43,3 +45,35 @@ module.exports = {
4345
}
4446
}
4547
```
48+
## stylelint
49+
50+
[stylelint](https://stylelint.io) supports linting style parts of Vue single file components.
51+
52+
[Make sure that your stylelint config is right.](https://stylelint.io/user-guide/configuration/)
53+
54+
Then from the command line:
55+
56+
``` bash
57+
stylelint MyComponent.vue
58+
```
59+
60+
Another option is using [stylelint-webpack-plugin](https://github.com/webpack-contrib/stylelint-webpack-plugin):
61+
62+
``` bash
63+
npm install -D stylelint-webpack-plugin
64+
```
65+
66+
Make sure it's applied as a plugin:
67+
68+
``` js
69+
// webpack.config.js
70+
const StyleLintPlugin = require('stylelint-webpack-plugin');
71+
module.exports = {
72+
// ... other options
73+
plugins: [
74+
new StyleLintPlugin({
75+
files: ['**/*.{vue,htm,html,css,sss,less,scss,sass}'],
76+
})
77+
]
78+
}
79+
```

docs/ru/guide/linting.md

+34
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Статический анализ кода
22

3+
## ESLint
4+
35
Официальный плагин [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) поддерживает проверку секций шаблона и кода в однофайловых компонентах Vue.
46

57
Убедитесь, что используете поставляемую с плагином конфигурацию в вашей конфигурации ESLint:
@@ -43,3 +45,35 @@ module.exports = {
4345
}
4446
}
4547
```
48+
## stylelint
49+
50+
[stylelint](https://stylelint.io) поддерживает проверку секций стилей в однофайловых компонентах Vue.
51+
52+
[Убедитесь, что ваша конфигурация stylelint корректна.](https://stylelint.io/user-guide/configuration/)
53+
54+
Затем выполните в командной строке:
55+
56+
``` bash
57+
stylelint MyComponent.vue
58+
```
59+
60+
Вы также можете использовать плагин [stylelint-webpack-plugin](https://github.com/webpack-contrib/stylelint-webpack-plugin):
61+
62+
``` bash
63+
npm install -D stylelint-webpack-plugin
64+
```
65+
66+
Убедитесь, что добавили плагин в конфигурацию:
67+
68+
``` js
69+
// webpack.config.js
70+
const StyleLintPlugin = require('stylelint-webpack-plugin');
71+
module.exports = {
72+
// ... другие настройки
73+
plugins: [
74+
new StyleLintPlugin({
75+
files: ['**/*.{vue,htm,html,css,sss,less,scss,sass}'],
76+
})
77+
]
78+
}
79+
```

docs/zh/guide/linting.md

+34
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# 代码校验 (Linting)
22

3+
## ESLint
4+
35
官方的 [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) 同时支持在 Vue 单文件组件的模板和脚本部分的代码校验。
46

57
请确认在你的 ESLint 配置文件中使用该插件要导入的配置:
@@ -43,3 +45,35 @@ module.exports = {
4345
}
4446
}
4547
```
48+
## stylelint
49+
50+
[stylelint](https://stylelint.io) 支持在 Vue 单文件组件的样式部分的代码校验。
51+
52+
[请确认在你的 stylelint 配置文件正确。](https://stylelint.io/user-guide/configuration/)
53+
54+
接下来从命令行运行:
55+
56+
``` bash
57+
stylelint MyComponent.vue
58+
```
59+
60+
另一个选项是使用 [stylelint-webpack-plugin](https://github.com/webpack-contrib/stylelint-webpack-plugin):
61+
62+
``` bash
63+
npm install -D stylelint-webpack-plugin
64+
```
65+
66+
请确保它是作为一个插件运用的:
67+
68+
``` js
69+
// webpack.config.js
70+
const StyleLintPlugin = require('stylelint-webpack-plugin');
71+
module.exports = {
72+
// ... 其它选项
73+
plugins: [
74+
new StyleLintPlugin({
75+
files: ['**/*.{vue,htm,html,css,sss,less,scss,sass}'],
76+
})
77+
]
78+
}
79+
```

0 commit comments

Comments
 (0)