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

Commit 5e054a0

Browse files
committed
Add rule indent
1 parent 5df5650 commit 5e054a0

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
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
'browserify',
9393
'cjs',
9494
'commonjs',
95+
'declarator',
9596
'denylist',
9697
'dom',
9798
'ecma',

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"cSpell.words": [
3+
"IIFE",
34
"Quadflieg",
45
"applescript",
56
"asyncgenerator",

src/rules/eslint/indent.d.ts

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Indent Config.
5+
*/
6+
export interface IndentConfig {
7+
/**
8+
* @see [ignoredNodes](https://eslint.org/docs/rules/indent#ignorednodes)
9+
*/
10+
ignoredNodes?: string[];
11+
/**
12+
* @see [SwitchCase](https://eslint.org/docs/rules/indent#switchcase)
13+
*/
14+
SwitchCase?: number;
15+
/**
16+
* @see [VariableDeclarator](https://eslint.org/docs/rules/indent#variabledeclarator)
17+
*/
18+
VariableDeclarator?: number | 'first' | { var?: number; let?: number; const?: number };
19+
/**
20+
* @see [outerIIFEBody](https://eslint.org/docs/rules/indent#outeriifebody)
21+
*/
22+
outerIIFEBody?: number | 'off';
23+
/**
24+
* @see [MemberExpression](https://eslint.org/docs/rules/indent#memberexpression)
25+
*/
26+
MemberExpression?: number;
27+
/**
28+
* @see [FunctionDeclaration](https://eslint.org/docs/rules/indent#functiondeclaration)
29+
*/
30+
FunctionDeclaration?: { body?: number; parameters?: number | 'first' };
31+
/**
32+
* @see [CallExpression](https://eslint.org/docs/rules/indent#callexpression)
33+
*/
34+
CallExpression?: { arguments?: number | 'first' };
35+
/**
36+
* @see [ArrayExpression](https://eslint.org/docs/rules/indent#arrayexpression)
37+
*/
38+
ArrayExpression?: number | 'first';
39+
/**
40+
* @see [ObjectExpression](https://eslint.org/docs/rules/indent#objectexpression)
41+
*/
42+
ObjectExpression?: number | 'first';
43+
/**
44+
* @see [ImportDeclaration](https://eslint.org/docs/rules/indent#importdeclaration)
45+
*/
46+
ImportDeclaration?: number | 'first';
47+
/**
48+
* @see [flatTernaryExpressions](https://eslint.org/docs/rules/indent#flatternaryexpressions)
49+
*/
50+
flatTernaryExpressions?: boolean;
51+
/**
52+
* @see [offsetTernaryExpressions](https://eslint.org/docs/rules/indent#offsetternaryexpressions)
53+
*/
54+
offsetTernaryExpressions?: boolean;
55+
/**
56+
* @see [ignoreComments](https://eslint.org/docs/rules/indent#ignorecomments)
57+
*/
58+
ignoreComments?: boolean;
59+
}
60+
61+
/**
62+
* Option.
63+
*/
64+
export type IndentOption = number | 'tab';
65+
66+
/**
67+
* Options.
68+
*/
69+
export type IndentOptions = [IndentOption?];
70+
71+
/**
72+
* Enforce consistent indentation.
73+
*
74+
* @see [indent](https://eslint.org/docs/rules/indent)
75+
*/
76+
export type IndentRuleConfig = RuleConfig<IndentOptions>;
77+
78+
/**
79+
* Enforce consistent indentation.
80+
*
81+
* @see [indent](https://eslint.org/docs/rules/indent)
82+
*/
83+
export interface IndentRule {
84+
/**
85+
* Enforce consistent indentation.
86+
*
87+
* @see [indent](https://eslint.org/docs/rules/indent)
88+
*/
89+
indent: IndentRuleConfig;
90+
}

src/rules/eslint/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { CommaDangleRule } from './comma-dangle';
22
import type { CurlyRule } from './curly';
33
import type { GroupedAccessorPairsRule } from './grouped-accessor-pairs';
44
import type { IdDenylistRule } from './id-denylist';
5+
import type { IndentRule } from './indent';
56
import type { LinebreakStyleRule } from './linebreak-style';
67
import type { MaxClassesPerFileRule } from './max-classes-per-file';
78
import type { MaxLenRule } from './max-len';
@@ -23,6 +24,7 @@ export type EslintRules = CommaDangleRule &
2324
CurlyRule &
2425
GroupedAccessorPairsRule &
2526
IdDenylistRule &
27+
IndentRule &
2628
LinebreakStyleRule &
2729
MaxClassesPerFileRule &
2830
MaxLenRule &

0 commit comments

Comments
 (0)