Urara-Blog/node_modules/.pnpm-store/v3/files/43/08c1289e9db4bcbf47e8d47142b0b76031395603a6c5f64776c507a03e198b459233cabeee3da0b9f7df4af2e3395212ffdad7a91903e32c7b3dd310ff5482
2022-08-14 01:14:53 +08:00

44 lines
1.3 KiB
Text

---
description: 'Require or disallow trailing commas.'
---
> 🛑 This file is source code, not the primary documentation location! 🛑
>
> See **https://typescript-eslint.io/rules/comma-dangle** for documentation.
## Rule Details
This rule extends the base [`eslint/comma-dangle`](https://eslint.org/docs/rules/comma-dangle) rule.
It adds support for TypeScript syntax.
See the [ESLint documentation](https://eslint.org/docs/rules/comma-dangle) for more details on the `comma-dangle` rule.
## How to Use
```jsonc
{
// note you must disable the base rule as it can report incorrect errors
"comma-dangle": "off",
"@typescript-eslint/comma-dangle": ["error"]
}
```
In addition to the options supported by the `comma-dangle` rule in ESLint core, the rule adds the following options:
## Options
This rule has a string option and an object option.
- Object option:
- `"enums"` is for trailing comma in enum. (e.g. `enum Foo = {Bar,}`)
- `"generics"` is for trailing comma in generic. (e.g. `function foo<T,>() {}`)
- `"tuples"` is for trailing comma in tuple. (e.g. `type Foo = [string,]`)
- [See the other options allowed](https://eslint.org/docs/rules/comma-dangle#options)
<sup>
Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/main/docs/rules/comma-dangle.md)
</sup>