|
1 | 1 | import type { RuleConfig } from '../rule-config'; |
2 | 2 |
|
3 | 3 | /** |
| 4 | + * Always Config. |
| 5 | + */ |
| 6 | +export interface SemiAlwaysConfig { |
| 7 | + /** |
| 8 | + * Ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line. |
| 9 | + */ |
| 10 | + omitLastInOneLineBlock?: boolean; |
| 11 | +} |
| 12 | + |
| 13 | +/** |
| 14 | + * Always Options. |
| 15 | + */ |
| 16 | +export type SemiAlwaysOptions = ['always'] | ['always', SemiAlwaysConfig]; |
| 17 | + |
| 18 | +/** |
| 19 | + * Never Config. |
| 20 | + */ |
| 21 | +export interface SemiNeverConfig { |
| 22 | + /** |
| 23 | + * - `'any'` - Ignores semicolons (or lacking semicolon) at the end of statements if the next line starts with `[`, `(`, `/`, `+`, or `-`. |
| 24 | + * - `'always'` - Requires semicolons at the end of statements if the next line starts with `[`, `(`, `/`, `+`, or `-`. |
| 25 | + * - `'never'` - Disallows semicolons as the end of statements if it doesn't make ASI hazard even if the next line starts with `[`, `(`, `/`, `+`, or `-`. |
| 26 | + */ |
| 27 | + beforeStatementContinuationChars?: 'any' | 'always' | 'never'; |
| 28 | +} |
| 29 | + |
| 30 | +/** |
| 31 | + * Never Options. |
| 32 | + */ |
| 33 | +export type SemiNeverOptions = ['never'] | ['never', SemiNeverConfig]; |
| 34 | + |
| 35 | +/** |
| 36 | + * Options. |
| 37 | + */ |
| 38 | +export type SemiOptions = SemiAlwaysOptions | SemiNeverOptions; |
| 39 | + |
| 40 | +/** |
| 41 | + * Require or disallow semicolons instead of ASI. |
4 | 42 | * |
| 43 | + * @see [semi](https://eslint.org/docs/rules/semi) |
5 | 44 | */ |
6 | | -export type SemiRuleConfig = RuleConfig<['always' | 'never' /* ... */]>; |
| 45 | +export type SemiRuleConfig = RuleConfig<SemiOptions>; |
7 | 46 |
|
8 | 47 | /** |
| 48 | + * Require or disallow semicolons instead of ASI. |
9 | 49 | * |
| 50 | + * @see [semi](https://eslint.org/docs/rules/semi) |
10 | 51 | */ |
11 | 52 | export interface SemiRule { |
12 | 53 | /** |
|
0 commit comments