1
1
const restrictedGlobals = require ( "confusing-browser-globals" )
2
2
3
- // vychazi z https://github.com/typescript-eslint/typescript-eslint/blob/v3.4.0/packages/eslint-plugin/docs/rules/ban-types.md
4
- // odstranuje kontrolu {} (kvuli prazdnym props v React komponentach)
5
- const defaultTypes = {
6
- String : {
7
- message : "Use string instead" ,
8
- fixWith : "string" ,
9
- } ,
10
- Boolean : {
11
- message : "Use boolean instead" ,
12
- fixWith : "boolean" ,
13
- } ,
14
- Number : {
15
- message : "Use number instead" ,
16
- fixWith : "number" ,
17
- } ,
18
- Symbol : {
19
- message : "Use symbol instead" ,
20
- fixWith : "symbol" ,
21
- } ,
22
-
23
- Function : {
24
- message : [
25
- "The `Function` type accepts any function-like value." ,
26
- "It provides no type safety when calling the function, which can be a common source of bugs." ,
27
- "It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`." ,
28
- "If you are expecting the function to accept certain arguments, you should explicitly define the function shape." ,
29
- ] . join ( "\n" ) ,
30
- } ,
31
- Object : {
32
- message : [
33
- 'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.' ,
34
- '- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.' ,
35
- '- If you want a type meaning "any value", you probably want `unknown` instead.' ,
36
- ] . join ( "\n" ) ,
37
- } ,
38
- object : {
39
- message : [
40
- "The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732))." ,
41
- "Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys." ,
42
- ] . join ( "\n" ) ,
43
- } ,
44
- }
45
-
46
3
// castecne vychazi z:
47
4
// https://github.com/facebook/create-react-app/blob/master/packages/eslint-config-react-app/index.js
48
5
module . exports = {
@@ -64,7 +21,7 @@ module.exports = {
64
21
} ,
65
22
] ,
66
23
// ignorace souboru v urovni s konfiguraci
67
- ignorePatterns : [ "/*.js" , "/*.ts" , "build/*" , "node_modules/*" ] ,
24
+ ignorePatterns : [ "/*.js" , "/*.ts" , "build/*" , "node_modules/*" , "__mocks__/*" ] ,
68
25
parserOptions : {
69
26
ecmaFeatures : {
70
27
jsx : true ,
@@ -73,7 +30,7 @@ module.exports = {
73
30
sourceType : "module" ,
74
31
75
32
tsconfigRootDir : __dirname ,
76
- project : true ,
33
+ projectService : true ,
77
34
} ,
78
35
plugins : [
79
36
"import" ,
@@ -137,7 +94,6 @@ module.exports = {
137
94
"react-hooks/rules-of-hooks" : "error" ,
138
95
139
96
"@typescript-eslint/no-shadow" : [ "error" ] ,
140
- "@typescript-eslint/ban-types" : [ "error" , { types : defaultTypes , extendDefaults : false } ] ,
141
97
"@typescript-eslint/consistent-type-definitions" : [ "error" , "type" ] ,
142
98
"@typescript-eslint/no-explicit-any" : 0 ,
143
99
"@typescript-eslint/no-floating-promises" : 0 , // TODO aktivovat po oprave #66
@@ -147,6 +103,7 @@ module.exports = {
147
103
"@typescript-eslint/no-unsafe-return" : 0 ,
148
104
"@typescript-eslint/no-use-before-define" : [ "error" , { functions : false } ] ,
149
105
"@typescript-eslint/restrict-template-expressions" : 0 ,
106
+ "@typescript-eslint/no-empty-object-type" : "off" ,
150
107
151
108
// vlastni pravidla camelCase,
152
109
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
0 commit comments