@@ -5,11 +5,102 @@ import notice from "eslint-plugin-notice";
5
5
import jsdoc from 'eslint-plugin-jsdoc' ;
6
6
import deprecationPlugin from "eslint-plugin-deprecation" ;
7
7
import { fixupPluginRules } from "@eslint/compat" ;
8
+ import reactRefresh from "eslint-plugin-react-refresh" ;
9
+
10
+ const commonRules = {
11
+ "notice/notice" : [
12
+ "error" ,
13
+ {
14
+ template : `/*---------------------------------------------------------------------------------------------
15
+ * Copyright (c) Microsoft Corporation. All rights reserved.
16
+ * Licensed under the MIT License. See License.txt in the project root for license information.
17
+ *--------------------------------------------------------------------------------------------*/
18
+
19
+ ` ,
20
+ }
21
+ ] ,
22
+ "no-undef" : "off" ,
23
+ "no-unused-vars" : "off" ,
24
+ "constructor-super" : "warn" ,
25
+ "curly" : "off" ,
26
+ "eqeqeq" : "warn" ,
27
+ "no-buffer-constructor" : "warn" ,
28
+ "no-caller" : "warn" ,
29
+ "no-debugger" : "warn" ,
30
+ "no-duplicate-case" : "warn" ,
31
+ "no-duplicate-imports" : "off" ,
32
+ "no-eval" : "warn" ,
33
+ "no-async-promise-executor" : "off" ,
34
+ "no-extra-semi" : "warn" ,
35
+ "no-new-wrappers" : "warn" ,
36
+ "no-redeclare" : "off" ,
37
+ "no-sparse-arrays" : "warn" ,
38
+ "no-throw-literal" : "off" ,
39
+ "no-unsafe-finally" : "warn" ,
40
+ "no-unused-labels" : "warn" ,
41
+ "no-restricted-globals" : [
42
+ "warn" ,
43
+ "name" ,
44
+ "length" ,
45
+ "event" ,
46
+ "closed" ,
47
+ "external" ,
48
+ "status" ,
49
+ "origin" ,
50
+ "orientation" ,
51
+ "context"
52
+ ] , // non-complete list of globals that are easy to access unintentionally
53
+ "no-var" : "off" ,
54
+ "semi" : "off" ,
55
+ "jsdoc/no-types" : "warn" ,
56
+ "no-restricted-syntax" : [
57
+ 'warn' ,
58
+ "Literal[raw='null']"
59
+ ] ,
60
+ "@typescript-eslint/no-explicit-any" : "warn" ,
61
+ // Not really that useful, there are valid reasons to have empty functions
62
+ "@typescript-eslint/no-empty-function" : "off" ,
63
+ "@typescript-eslint/no-inferrable-types" : [
64
+ "warn" ,
65
+ {
66
+ "ignoreParameters" : true ,
67
+ "ignoreProperties" : true
68
+ }
69
+ ] ,
70
+ "@typescript-eslint/no-unused-vars" : [
71
+ "warn" ,
72
+ {
73
+ "argsIgnorePattern" : "^_"
74
+ }
75
+ ] ,
76
+ "deprecation/deprecation" : "warn" ,
77
+ "@typescript-eslint/no-floating-promises" : [
78
+ "warn" ,
79
+ {
80
+ "ignoreVoid" : true
81
+ }
82
+ ] ,
83
+ "@typescript-eslint/naming-convention" : [
84
+ "warn" ,
85
+ {
86
+ "selector" : "property" ,
87
+ "modifiers" : [
88
+ "private"
89
+ ] ,
90
+ "format" : [
91
+ "camelCase"
92
+ ] ,
93
+ "leadingUnderscore" : "require"
94
+ }
95
+ ] ,
96
+ } ;
97
+
98
+
8
99
9
100
export default [
10
101
{
11
- files : [ '**/*.ts' , '**/*.tsx' ] ,
12
- ignores : [ 'src/prompts/**/*.ts' , 'typings/**.*.d.ts' ] , // Ignore prompts files as they are copied from other repos
102
+ files : [ '**/*.ts' ] ,
103
+ ignores : [ 'src/prompts/**/*.ts' , 'typings/**.*.d.ts' , 'src/reactviews/**/*' ] , // Ignore prompts files as they are copied from other repos
13
104
languageOptions : {
14
105
parser : tseslint . parser ,
15
106
parserOptions : {
@@ -24,96 +115,30 @@ export default [
24
115
[ "deprecation" ] : fixupPluginRules ( deprecationPlugin ) ,
25
116
} ,
26
117
rules : {
27
- "notice/notice" : [
28
- "error" ,
29
- {
30
- template : `/*---------------------------------------------------------------------------------------------
31
- * Copyright (c) Microsoft Corporation. All rights reserved.
32
- * Licensed under the MIT License. See License.txt in the project root for license information.
33
- *--------------------------------------------------------------------------------------------*/
34
-
35
- ` ,
36
- onNonMatchingHeader : 'prepend' ,
37
- messages : {
38
- whenFailedToMatch : "Missing or incorrectly formatted copyright statement." ,
39
- }
40
- } ,
41
-
42
- ] ,
43
- "no-undef" : "off" ,
44
- "no-unused-vars" : "off" ,
45
- "constructor-super" : "warn" ,
46
- "curly" : "off" ,
47
- "eqeqeq" : "warn" ,
48
- "no-buffer-constructor" : "warn" ,
49
- "no-caller" : "warn" ,
50
- "no-debugger" : "warn" ,
51
- "no-duplicate-case" : "warn" ,
52
- "no-duplicate-imports" : "off" ,
53
- "no-eval" : "warn" ,
54
- "no-async-promise-executor" : "off" ,
55
- "no-extra-semi" : "warn" ,
56
- "no-new-wrappers" : "warn" ,
57
- "no-redeclare" : "off" ,
58
- "no-sparse-arrays" : "warn" ,
59
- "no-throw-literal" : "off" ,
60
- "no-unsafe-finally" : "warn" ,
61
- "no-unused-labels" : "warn" ,
62
- "no-restricted-globals" : [
63
- "warn" ,
64
- "name" ,
65
- "length" ,
66
- "event" ,
67
- "closed" ,
68
- "external" ,
69
- "status" ,
70
- "origin" ,
71
- "orientation" ,
72
- "context"
73
- ] , // non-complete list of globals that are easy to access unintentionally
74
- "no-var" : "off" ,
75
- "semi" : "off" ,
76
- "jsdoc/no-types" : "warn" ,
77
- "no-restricted-syntax" : [
118
+ ...commonRules
119
+ } ,
120
+ } , {
121
+ files : [ '**/*.tsx' ] ,
122
+ languageOptions : {
123
+ parser : '@typescript-eslint/parser' ,
124
+ parserOptions : {
125
+ project : './tsconfig.react.json' ,
126
+ } ,
127
+ } ,
128
+ rules : {
129
+ 'react-refresh/only-export-components' : [
78
130
'warn' ,
79
- "Literal[raw='null']"
80
- ] ,
81
- "@typescript-eslint/no-explicit-any" : "warn" ,
82
- // Not really that useful, there are valid reasons to have empty functions
83
- "@typescript-eslint/no-empty-function" : "off" ,
84
- "@typescript-eslint/no-inferrable-types" : [
85
- "warn" ,
86
- {
87
- "ignoreParameters" : true ,
88
- "ignoreProperties" : true
89
- }
131
+ { allowConstantExport : true } ,
90
132
] ,
91
- "@typescript-eslint/no-unused-vars" : [
92
- "warn" ,
93
- {
94
- "argsIgnorePattern" : "^_"
95
- }
96
- ] ,
97
- "deprecation/deprecation" : "warn" ,
98
- "@typescript-eslint/no-floating-promises" : [
99
- "warn" ,
100
- {
101
- "ignoreVoid" : true
102
- }
103
- ] ,
104
- "@typescript-eslint/naming-convention" : [
105
- "warn" ,
106
- {
107
- "selector" : "property" ,
108
- "modifiers" : [
109
- "private"
110
- ] ,
111
- "format" : [
112
- "camelCase"
113
- ] ,
114
- "leadingUnderscore" : "require"
115
- }
116
- ]
133
+ ...commonRules
117
134
} ,
135
+ plugins : {
136
+ notice,
137
+ jsdoc,
138
+ [ '@typescript-eslint' ] : tseslint . plugin ,
139
+ // @ts -ignore
140
+ [ "deprecation" ] : fixupPluginRules ( deprecationPlugin ) ,
141
+ [ 'react-refresh' ] : reactRefresh
142
+ }
118
143
}
119
144
] ;
0 commit comments