Skip to content

Commit 8870829

Browse files
committed
翻译 规则/风格/一般 (docschina#14)
1 parent 32dc6eb commit 8870829

File tree

10 files changed

+133
-133
lines changed

10 files changed

+133
-133
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- 从 HTML、markdown、CSS-in-JS 的对象/模板字符串中提取**内嵌样式**
1414
- 解析**类CSS语法**,如SCSS、Sass、Less 和 SugarSS
1515
- 支持**插件**,这样您就可以创建自己的规则或使用社区编写的插件
16-
- 自动**修复**一些违规行为*实验性功能*
16+
- 自动**修复**一些违规*实验性功能*
1717
- 经10000多个单元测试**充分测试**
1818
- 支持**可共享的配置**,您可以扩展或创建自己的配置
1919
-**非倾向性的**,所以您可以根据您的确切需要定制代码检查工具

docs/user-guide/cli.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ stylelint "foo/*.css" --fix
9292

9393
**注意:** 这是一个 _试验性_ 功能。它目前不遵守在源代码中禁用 stylelint 的特殊注释(例如 `/* stylelint-disable */`)。无论这些注释如何,都将应用自动修复。
9494

95-
如果您同时使用这些特殊注释和自动修复,请运行 stylelint 两次作为临时解决方案。在第一次运行时,可能会错过某些违规行为,或者可能会错误地报告某些违规行为
95+
如果您同时使用这些特殊注释和自动修复,请运行 stylelint 两次作为临时解决方案。在第一次运行时,可能会错过某些违规,或者可能会错误地报告某些违规
9696

9797
对于具有标准语法的 CSS,stylelint 将使用 [postcss-safe-parser](https://github.com/postcss/postcss-safe-parser) 来修复语法错误。
9898

docs/user-guide/rules.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@
350350

351351
#### 一般/表
352352

353-
- [`indentation`](../../lib/rules/indentation/README.md): Specify indentation (Autofixable).
354-
- [`linebreaks`](../../lib/rules/linebreaks/README.md): Specify unix or windows linebreaks (Autofixable).
355-
- [`max-empty-lines`](../../lib/rules/max-empty-lines/README.md): Limit the number of adjacent empty lines.
356-
- [`max-line-length`](../../lib/rules/max-line-length/README.md): Limit the length of a line.
357-
- [`no-eol-whitespace`](../../lib/rules/no-eol-whitespace/README.md): Disallow end-of-line whitespace (Autofixable).
358-
- [`no-missing-end-of-source-newline`](../../lib/rules/no-missing-end-of-source-newline/README.md): Disallow missing end-of-source newlines (Autofixable).
359-
- [`no-empty-first-line`](../../lib/rules/no-empty-first-line/README.md): Disallow empty first lines. (Autofixable).
353+
- [`indentation`](../../lib/rules/indentation/README.md):指定缩进(可自动修复)。
354+
- [`linebreaks`](../../lib/rules/linebreaks/README.md):指定 unix windows 换行符(可自动修复)。
355+
- [`max-empty-lines`](../../lib/rules/max-empty-lines/README.md):限制相邻空行的数量。
356+
- [`max-line-length`](../../lib/rules/max-line-length/README.md):限制行的长度。
357+
- [`no-eol-whitespace`](../../lib/rules/no-eol-whitespace/README.md):禁止行尾空白(可自动修复)。
358+
- [`no-missing-end-of-source-newline`](../../lib/rules/no-missing-end-of-source-newline/README.md):禁止缺少源代码结尾换行符(可自动修复)。
359+
- [`no-empty-first-line`](../../lib/rules/no-empty-first-line/README.md):禁止空第一行(可自动修复)。

lib/rules/indentation/README.md

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# indentation
22

3-
Specify indentation.
3+
指定缩进。
44

55
```css
66
|@media print {
@@ -10,20 +10,20 @@ Specify indentation.
1010
| ↑}↑ ↑
1111
|}↑ ↑ ↑
1212
/** ↑ ↑ ↑
13-
* The indentation at these three points */
13+
* 这三点的缩进 */
1414
```
1515

16-
The `--fix` option on the [command line](../../../docs/user-guide/cli.md#autofixing-errors) can automatically fix all of the problems reported by this rule.
16+
[命令行](../../../docs/user-guide/cli.md#自动修复错误)中的 `--fix` 选项可以自动修复此规则报告的所有问题。
1717

18-
## Options
18+
## 选项
1919

20-
`int|"tab"`, where `int` is the number of spaces
20+
`int|"tab"`, 其中 `int` 是空格的数量
2121

2222
### `2`
2323

24-
Always indent at-rules, rules, comments, declarations, inside parentheses and multi-line values by 2 spaces.
24+
始终将 @规则、规则、注释、声明、括号内和多行值按 2 个空格缩进。
2525

26-
The following patterns are considered violations:
26+
以下模式被视为违规:
2727

2828
```css
2929
@media print {
@@ -87,7 +87,7 @@ a {
8787
}
8888
```
8989

90-
The following patterns are *not* considered violations:
90+
以下模式**被视为违规:
9191

9292
```css
9393
@media print {
@@ -133,13 +133,13 @@ a {
133133
}
134134
```
135135

136-
## Optional secondary options
136+
## 可选的辅助选项
137137

138138
### `baseIndentLevel: int|"auto"`
139139

140-
By default, the indent level of the CSS code block in non-CSS-like files is determined by the shortest indent of non-empty line. The setting `baseIndentLevel` allows you to define a relative indent level based on CSS code block opening or closing line.
140+
默认情况下,非类 CSS 文件中 CSS 代码块的缩进级别由非空行的最短缩进行确定。设置 `baseIndentLevel` 允许您根据CSS代码块打开或闭合行定义相对缩进级别。
141141

142-
For example, with `[ 2, { baseIndentLevel: 1 } ]`, CSS should be indented 1 levels higher than `<style>` tag:
142+
例如,使用 `[2,{baseIndentLevel:1}]`,CSS 应该比 `<style>` 标签缩进高1级:
143143

144144
```html
145145
<!DOCTYPE html>
@@ -156,11 +156,11 @@ For example, with `[ 2, { baseIndentLevel: 1 } ]`, CSS should be indented 1 leve
156156

157157
### `indentInsideParens: "twice"|"once-at-root-twice-in-block"`
158158

159-
By default, *one extra* indentation (of your specified type) is expected after newlines inside parentheses, and the closing parenthesis is expected to have no extra indentation.
159+
默认情况下,在括号内的换行符后,期望有*一级额外的*缩进(指定类型),并且闭合括号预计不会有额外的缩进。
160160

161-
If you would like to change the quantity of extra indentation inside parentheses, use this option.
161+
如果要更改括号内的额外缩进数量,请使用此选项。
162162

163-
`"twice"` means you expect two extra indentations (of your specified type) after newlines inside parentheses, and expect the closing parenthesis to have one extra indentation. For example:
163+
`"twice"` 意味着在括号内的换行符之后会出现两级额外的缩进(指定类型),并期望闭合号有一个额外的缩进。例如:
164164

165165
```css
166166
a {
@@ -173,7 +173,7 @@ a {
173173
}
174174
```
175175

176-
`"once-at-root-twice-in-block"` means two things: You want the behavior of `"once"`, as documented above, when the parenthetical expression is part of a node that is an immediate descendent of the root — i.e. not inside a block. And you want the behavior of `"twice"`, as documented above, when the parenthetical expression is part of a node that is inside a block. For example, with a SCSS map:
176+
`"once-at-root-twice-in-block"` 意味着两件事:如上所述,当括号表达式是根节点的直接后代节点的一部分时————即不在块内,你想要 `"once"` 的行为。如上所述,当括号表达式是块内部节点的一部分时,您需要 `"twice"` 的行为。例如,使用 SCSS 映射:
177177

178178
```scss
179179
$foo: (
@@ -193,11 +193,11 @@ a {
193193

194194
### `indentClosingBrace: true|false`
195195

196-
If `true`, the closing brace of a block (rule or at-rule) will be expected at the same indentation level as the block's inner nodes.
196+
如果为 `true`,则块(规则或 @规则)的闭合括号将与块的内部节点保持相同的缩进级别。
197197

198-
For example, with `indentClosingBrace: true`.
198+
例如,使用 `indentClosingBrace: true`
199199

200-
The following patterns are considered violations:
200+
以下模式被视为违规:
201201

202202
```css
203203
a {
@@ -213,7 +213,7 @@ a {
213213
}
214214
```
215215

216-
The following patterns are *not* considered violations:
216+
以下模式**被视为违规:
217217

218218
```css
219219
a {
@@ -231,11 +231,11 @@ a {
231231

232232
### `except: ["block", "param", "value"]`
233233

234-
Do *not* indent for these things.
234+
对这些事物**做缩进。
235235

236-
For example, with `2`.
236+
例如,用 `2`
237237

238-
The following patterns are considered violations:
238+
以下模式被视为违规:
239239

240240
```css
241241
@media print,
@@ -248,7 +248,7 @@ The following patterns are considered violations:
248248
}
249249
```
250250

251-
The following patterns are *not* considered violations:
251+
以下模式**被视为违规:
252252

253253
```css
254254
@media print,
@@ -265,11 +265,11 @@ top right;
265265

266266
#### `"inside-parens"`
267267

268-
Ignore the indentation inside parentheses.
268+
忽略括号内的缩进。
269269

270-
For example, with `2`.
270+
例如,用 `2`
271271

272-
The following patterns are *not* considered violations:
272+
以下模式**被视为违规:
273273

274274
```css
275275
a {
@@ -284,11 +284,11 @@ a {
284284

285285
#### `"param"`
286286

287-
Ignore the indentation of at-rule params.
287+
忽略 @规则参数的缩进。
288288

289-
For example, with `2`.
289+
例如,用 `2`
290290

291-
The following patterns are *not* considered violations:
291+
以下模式**被视为违规:
292292

293293
```css
294294
@media print,
@@ -299,11 +299,11 @@ The following patterns are *not* considered violations:
299299

300300
#### `"value"`
301301

302-
Ignore the indentation of values.
302+
忽略值的缩进。
303303

304-
For example, with `2`.
304+
例如,用 `2`
305305

306-
The following patterns are *not* considered violations:
306+
以下模式**被视为违规:
307307

308308
```css
309309
a {

lib/rules/linebreaks/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# linebreaks
22

3-
Specify unix or windows linebreaks.
3+
指定 unix windows 换行符。
44

5-
The `--fix` option on the [command line](../../../docs/user-guide/cli.md#autofixing-errors) can automatically fix all of the problems reported by this rule.
5+
[命令行](../../../docs/user-guide/cli.md#自动修复错误)中的 `--fix` 选项可以自动修复此规则报告的所有问题。
66

7-
## Options
7+
## 选项
88

99
`string`: `"unix"|"windows"`
1010

1111
### `"unix"`
1212

13-
Linebreaks _must always_ be LF (`\n`).
13+
换行符*必须始终*为 LF(`\n`)。
1414

15-
Lines with CRLF linebreaks are considered violations.
15+
具有 CRLF 换行符的行被视为违规。
1616

1717
### `"windows"`
1818

19-
Linebreaks _must always_ be CRLF (`\r\n`).
19+
换行符*必须始终*CRLF`\r\n`)。
2020

21-
Lines with LF linebreaks are considered violations.
21+
具有 LF 换行符的行被视为违规。

lib/rules/max-empty-lines/README.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11

22
# max-empty-lines
33

4-
Limit the number of adjacent empty lines.
4+
限制相邻空行的数量。
55

66
```css
77
a {}
88
/**/
99
/**/
1010
a {} /**/
1111
/** ↑
12-
* These lines */
12+
* 这些行 */
1313
```
1414

15-
## Options
15+
## 选项
1616

17-
`int`: Maximum number of characters allowed.
17+
`int`:允许的最大相邻空行数。
1818

19-
For example, with `2`:
19+
例如,使用 `2`
2020

21-
The following patterns are considered violations:
21+
以下模式被视为违规:
2222

2323
```css
2424
a {}
@@ -28,19 +28,19 @@ a {}
2828
b {}
2929
```
3030

31-
Comment strings are also checked -- so the following is a violation:
31+
注释字符串也会检查————因此以下是违规:
3232

3333
```css
3434
/*
35-
Call me Ishmael.
35+
词曰:
3636
3737
3838
39-
Some years ago -- never mind how log precisely -- ...
39+
滚滚长江东逝水,浪花淘尽英雄。...
4040
*/
4141
```
4242

43-
The following patterns are *not* considered violations:
43+
以下模式**被视为违规:
4444

4545
```css
4646
a {}
@@ -60,15 +60,15 @@ a {}
6060
b {}
6161
```
6262

63-
## Optional secondary options
63+
## 可选的辅助选项
6464

6565
### `ignore: ["comments"]`
6666

67-
Only enforce the adjacent empty lines limit for lines that are not comments.
67+
仅对不是注释的行强制执行相邻的空行限制。
6868

69-
For example, with `2` adjacent empty lines:
69+
例如,使用 `2` 相邻的空行:
7070

71-
The following pattern is considered violation:
71+
以下模式被视为违规:
7272

7373
```css
7474
/* horse */
@@ -79,28 +79,28 @@ a {}
7979
b {}
8080
```
8181

82-
The following patterns are *not* considered violations:
82+
以下模式**被视为违规:
8383

8484
```css
8585
/*
86-
Call me Ishmael.
86+
词曰:
8787
8888
8989
90-
Some years ago -- never mind how log precisely -- ...
90+
滚滚长江东逝水,浪花淘尽英雄。...
9191
*/
9292
```
9393

9494
```css
95-
a {
95+
a {
9696
/*
97-
Comment
97+
注释
9898
9999
100100
101101
102-
inside the declaration with a lot of empty lines...
102+
在声明里面有很多空行...
103103
*/
104-
color: pink;
104+
color: pink;
105105
}
106106
```

0 commit comments

Comments
 (0)