Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 8b52412

Browse files
committed
Add comma-dangle rule
1 parent ed42450 commit 8b52412

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ module.exports = defineConfig({
9292
'globals',
9393
'greasemonkey',
9494
'jsdoc',
95+
'multiline',
9596
'nashorn',
9697
'phantomjs',
9798
'prototypejs',

src/rules/eslint/comma-dangle.d.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Values for comma dangle.
5+
*/
6+
export type CommaDangleOptionValue = 'never' | 'always' | 'always-multiline' | 'only-multiline' | 'ignore';
7+
8+
/**
9+
* Options.
10+
*/
11+
export type CommaDangleOption =
12+
| CommaDangleOptionValue
13+
| {
14+
arrays?: CommaDangleOptionValue;
15+
objects?: CommaDangleOptionValue;
16+
imports?: CommaDangleOptionValue;
17+
exports?: CommaDangleOptionValue;
18+
functions?: CommaDangleOptionValue;
19+
};
20+
21+
/**
22+
* Require or disallow trailing commas.
23+
*
24+
* @see [comma-dangle](https://eslint.org/docs/rules/comma-dangle)
25+
*/
26+
export type CommaDangleRuleConfig = RuleConfig<[CommaDangleOption?]>;
27+
28+
/**
29+
* Require or disallow trailing commas.
30+
*
31+
* @see [comma-dangle](https://eslint.org/docs/rules/comma-dangle)
32+
*/
33+
export interface CommaDangleRule {
34+
/**
35+
* Require or disallow trailing commas.
36+
*
37+
* @see [comma-dangle](https://eslint.org/docs/rules/comma-dangle)
38+
*/
39+
'comma-dangle': CommaDangleRuleConfig;
40+
}

src/rules/eslint/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import type { CommaDangleRule } from './comma-dangle';
12
import type { NoDebuggerRule } from './no-debugger';
23
import type { QuotesRule } from './quotes';
34
import type { SemiRule } from './semi';
45

56
/**
67
* All eslint rules.
78
*/
8-
export type EslintRules = NoDebuggerRule & QuotesRule & SemiRule;
9+
export type EslintRules = CommaDangleRule & NoDebuggerRule & QuotesRule & SemiRule;

0 commit comments

Comments
 (0)