File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
packages/eslint-plugin/docs/rules Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -20,5 +20,59 @@ One example of valid TypeScript specific code that would otherwise trigger the `
20
20
## Options
21
21
22
22
See [ ` eslint/no-empty-function ` options] ( https://eslint.org/docs/rules/no-empty-function#options ) .
23
+ This rule adds the following options:
24
+
25
+ ``` ts
26
+ type AdditionalAllowOptionEntries =
27
+ | ' private-constructors'
28
+ | ' protected-constructors'
29
+ | ' decoratedFunctions' ;
30
+
31
+ type AllowOptionEntries =
32
+ | BaseNoEmptyFunctionAllowOptionEntries
33
+ | AdditionalAllowOptionEntries ;
34
+
35
+ interface Options extends BaseNoEmptyFunctionOptions {
36
+ allow? : Array <AllowOptionEntries >;
37
+ }
38
+ const defaultOptions: Options = {
39
+ ... baseNoEmptyFunctionDefaultOptions ,
40
+ allow: [],
41
+ };
42
+ ```
43
+
44
+ ### allow: ` private-constructors `
45
+
46
+ Examples of correct code for the ` { "allow": ["private-constructors"] } ` option:
47
+
48
+ ``` ts
49
+ class Foo {
50
+ private constructor () {}
51
+ }
52
+ ```
53
+
54
+ ### allow: ` protected-constructors `
55
+
56
+ Examples of correct code for the ` { "allow": ["protected-constructors"] } ` option:
57
+
58
+ ``` ts
59
+ class Foo {
60
+ protected constructor () {}
61
+ }
62
+ ```
63
+
64
+ ### allow: ` decoratedFunctions `
65
+
66
+ Examples of correct code for the ` { "allow": ["decoratedFunctions"] } ` option:
67
+
68
+ ``` ts
69
+ @decorator ()
70
+ function foo() {}
71
+
72
+ class Foo {
73
+ @decorator ()
74
+ foo() {}
75
+ }
76
+ ```
23
77
24
78
<sup >Taken with ❤️ [ from ESLint core] ( https://github.com/eslint/eslint/blob/master/docs/rules/no-empty-function.md ) </sup >
You can’t perform that action at this time.
0 commit comments