File tree Expand file tree Collapse file tree 8 files changed +429
-0
lines changed Expand file tree Collapse file tree 8 files changed +429
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ Pro Tip: For larger codebases you may want to consider splitting our linting int
121
121
| [ ` @typescript-eslint/no-explicit-any ` ] ( ./docs/rules/no-explicit-any.md ) | Disallow usage of the ` any ` type | :heavy_check_mark : | :wrench : | |
122
122
| [ ` @typescript-eslint/no-extra-non-null-assertion ` ] ( ./docs/rules/no-extra-non-null-assertion.md ) | Disallow extra non-null assertion | | | |
123
123
| [ ` @typescript-eslint/no-extra-parens ` ] ( ./docs/rules/no-extra-parens.md ) | Disallow unnecessary parentheses | | :wrench : | |
124
+ | [ ` @typescript-eslint/no-extra-semi ` ] ( ./docs/rules/no-extra-semi.md ) | Disallow unnecessary semicolons | | :wrench : | |
124
125
| [ ` @typescript-eslint/no-extraneous-class ` ] ( ./docs/rules/no-extraneous-class.md ) | Forbids the use of classes as namespaces | | | |
125
126
| [ ` @typescript-eslint/no-floating-promises ` ] ( ./docs/rules/no-floating-promises.md ) | Requires Promise-like values to be handled appropriately. | | | :thought_balloon : |
126
127
| [ ` @typescript-eslint/no-for-in-array ` ] ( ./docs/rules/no-for-in-array.md ) | Disallow iterating over an array with a for-in loop | :heavy_check_mark : | | :thought_balloon : |
Original file line number Diff line number Diff line change
1
+ # Disallow unnecessary semicolons
2
+
3
+ ## Rule Details
4
+
5
+ This rule extends the base [ ` eslint/no-extra-semi ` ] ( https://eslint.org/docs/rules/no-extra-semi ) rule.
6
+
7
+ ## How to use
8
+
9
+ ``` cjson
10
+ {
11
+ // note you must disable the base rule as it can report incorrect errors
12
+ "no-extra-semi": "off",
13
+ "@typescript-eslint/no-extra-semi": ["error"]
14
+ }
15
+ ```
16
+
17
+ <sup >Taken with ❤️ [ from ESLint core] ( https://github.com/eslint/eslint/blob/master/docs/rules/no-extra-semi.md ) </sup >
Original file line number Diff line number Diff line change 34
34
"@typescript-eslint/no-extra-non-null-assertion" : " error" ,
35
35
"no-extra-parens" : " off" ,
36
36
"@typescript-eslint/no-extra-parens" : " error" ,
37
+ "no-extra-semi" : " off" ,
38
+ "@typescript-eslint/no-extra-semi" : " error" ,
37
39
"@typescript-eslint/no-extraneous-class" : " error" ,
38
40
"@typescript-eslint/no-floating-promises" : " error" ,
39
41
"@typescript-eslint/no-for-in-array" : " error" ,
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import noEmptyInterface from './no-empty-interface';
24
24
import noExplicitAny from './no-explicit-any' ;
25
25
import noExtraNonNullAssertion from './no-extra-non-null-assertion' ;
26
26
import noExtraParens from './no-extra-parens' ;
27
+ import noExtraSemi from './no-extra-semi' ;
27
28
import noExtraneousClass from './no-extraneous-class' ;
28
29
import noFloatingPromises from './no-floating-promises' ;
29
30
import noForInArray from './no-for-in-array' ;
@@ -100,6 +101,7 @@ export default {
100
101
'no-explicit-any' : noExplicitAny ,
101
102
'no-extra-non-null-assertion' : noExtraNonNullAssertion ,
102
103
'no-extra-parens' : noExtraParens ,
104
+ 'no-extra-semi' : noExtraSemi ,
103
105
'no-extraneous-class' : noExtraneousClass ,
104
106
'no-floating-promises' : noFloatingPromises ,
105
107
'no-for-in-array' : noForInArray ,
Original file line number Diff line number Diff line change
1
+ import baseRule from 'eslint/lib/rules/no-extra-semi' ;
2
+ import * as util from '../util' ;
3
+
4
+ type Options = util . InferOptionsTypeFromRule < typeof baseRule > ;
5
+ type MessageIds = util . InferMessageIdsTypeFromRule < typeof baseRule > ;
6
+
7
+ export default util . createRule < Options , MessageIds > ( {
8
+ name : 'no-extra-semi' ,
9
+ meta : {
10
+ type : 'suggestion' ,
11
+ docs : {
12
+ description : 'Disallow unnecessary semicolons' ,
13
+ category : 'Possible Errors' ,
14
+ recommended : false ,
15
+ } ,
16
+ fixable : 'code' ,
17
+ schema : baseRule . meta . schema ,
18
+ messages : baseRule . meta . messages ,
19
+ } ,
20
+ defaultOptions : [ ] ,
21
+ create ( context ) {
22
+ const rules = baseRule . create ( context ) ;
23
+
24
+ return {
25
+ ...rules ,
26
+ ClassProperty ( node ) : void {
27
+ rules . MethodDefinition ( node as never ) ;
28
+ } ,
29
+ } ;
30
+ } ,
31
+ } ) ;
You can’t perform that action at this time.
0 commit comments