Skip to content

Commit

Permalink
feat: sync v8.31.0 (#94)
Browse files Browse the repository at this point in the history
* docs: User Guide Getting Started expansion

* docs: add options to check destructuring in no-underscore-dangle

eslint/eslint#16006

* docs: adjust some words

* docs: Add function call example for no-undefined

eslint/eslint#16712

* docs: check assignment patterns in no-underscore-dangle

eslint/eslint#16693

* update formatters

* Apply suggestions from code review

Co-authored-by: Strek <ssharishkumar@gmail.com>

---------

Co-authored-by: Strek <ssharishkumar@gmail.com>
  • Loading branch information
kecrily and harish-sethuraman committed Feb 28, 2023
1 parent 79d441c commit 61d9cb5
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 103 deletions.
45 changes: 43 additions & 2 deletions src/rules/no-underscore-dangle.md
Expand Up @@ -56,9 +56,9 @@ const foo = (_bar) => {};
* `"allow"` 允许指定的标识符有悬空的下划线
* `"allowAfterThis": false`(默认值)不允许在 `this` 对象的成员中使用悬空的下划线
* `"allowAfterSuper": false`(默认值)不允许在 `super` 对象的成员中使用悬空的下划线
* `"allowAfterThisConstructor": false`(默认值)不允许在 `this.constructor` 对象的成员中使用悬空的下划线
* `"allowAfterThisConstructor": false`(默认值)不允许在 `this.constructor` 对象的成员中使用悬空的下划线
* `"enforceInMethodNames": false`(默认值)允许在方法名称中使用悬空的下划线
* `"enforceInClassFields": false`(默认值)允许在 es2022 类字段名中使用悬空的下划线
* `"enforceInClassFields": false`(默认值)允许在 es2022 类字段名中使用悬空的下划线
* `"allowInArrayDestructuring": true`(默认值)允许在由数组解构分配的变量名称中使用悬空的下划线
* `"allowInObjectDestructuring": true`(默认值)允许在对象解构分配的变量名称中使用悬空的下划线
* `"allowFunctionParams": true`(默认值)允许在函数参数名称中使用悬空的下划线
Expand Down Expand Up @@ -224,6 +224,47 @@ const { foo, bar, _baz: baz } = collection;

:::

### allowInArrayDestructuring

使用此规则与 `{ "allowInArrayDestructuring": false }` 选项的**错误**示例:

::: incorrect

```js
/*eslint no-underscore-dangle: ["error", { "allowInArrayDestructuring": false }]*/
const [_foo, _bar] = list;
const [foo_, ..._bar] = list;
const [foo, [bar, _baz]] = list;
```

:::

### allowInObjectDestructuring

使用此规则与 `{ "allowInObjectDestructuring": false }` 选项的**错误**示例:

::: incorrect

```js
/*eslint no-underscore-dangle: ["error", { "allowInObjectDestructuring": false }]*/
const { foo, bar: _bar } = collection;
const { foo, bar, _baz } = collection;
```

:::

使用此规则与 `{ "allowInObjectDestructuring": false }` 选项的**正确**示例:

::: correct

```js
/*eslint no-underscore-dangle: ["error", { "allowInObjectDestructuring": false }]*/
const { foo, bar, _baz: { a, b } } = collection;
const { foo, bar, _baz: baz } = collection;
```

:::

### allowFunctionParams

使用此规则与 `{ "allowFunctionParams": false }` 选项的**错误**示例:
Expand Down

0 comments on commit 61d9cb5

Please sign in to comment.