-
Notifications
You must be signed in to change notification settings - Fork 20
/
tsconfig.json
106 lines (106 loc) · 6.32 KB
/
tsconfig.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
// this file is only used for typechecking with IDEs
// it enables typechecking everywhere expect within directories listed below
"exclude": ["node_modules", "storybook-static", "dist", "**/*.test.js"],
"compilerOptions": {
// Necessary because we use `paths`
"baseUrl": ".",
"paths": {
// since we don't directly import leaflet within `leaflet-esm`, we have to tell the compiler where to find the types
"leaflet/src/Leaflet.js": [
"./node_modules/@types/leaflet/index.d.ts",
"./node_modules/@types/leaflet.heat/index.d.ts"
]
},
/* Visit https://www.typescriptlang.org/tsconfig to read more about this file */
/* Language and Environment */
"target": "ES2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": [
"ES2021",
"DOM",
"DOM.Iterable"
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
/* Modules */
"module": "nodenext" /* Specify what module code is generated. */,
"moduleDetection": "force" /* Make TypeScript treat every file as a module even if it does not have any imports or export (see https://www.totaltypescript.com/cannot-redeclare-block-scoped-variable) */,
/* JavaScript Support */
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
"checkJs": true /* Enable error reporting in type-checked JavaScript files. */,
/* Emit */
"noEmit": true /* Disable emitting files from a compilation. We only need the typechecking and we are not compiling. */,
/* Interop Constraints */
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
"strict": true /* Enable all strict type-checking options. */,
// all properties below are true by default if strict is enabled, this means we should only specify the ones we want to disable below if we set the property above to `true`
// we want to be able to use `null` & `undefined` as if they were the same
"strictNullChecks": false /* When type checking, take into account 'null' and 'undefined'. */,
"strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */,
"strictBindCallApply": true /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */,
"noImplicitThis": true /* Enable error reporting when 'this' is given the type 'any'. */,
"useUnknownInCatchVariables": true /* Default catch clause variables as 'unknown' instead of 'any'. */,
"alwaysStrict": true /* Ensure 'use strict' is always emitted. */,
// end of strict related properties
"noUnusedLocals": true /* Enable error reporting when local variables aren't read. */,
"noUnusedParameters": true /* Raise an error when a function parameter isn't read. */,
// This option can only be enabled if we also enable `strictNullChecks`
"exactOptionalPropertyTypes": false /* Interpret optional property types as written, rather than adding 'undefined'. */,
"noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
"noFallthroughCasesInSwitch": true /* Enable error reporting for fallthrough cases in switch statements. */,
// this causes issues with our current i18n implementation
"noUncheckedIndexedAccess": false /* Add 'undefined' to a type when accessed using an index. */,
// this causes issues with LitElement methods (lifecycle hooks for instance)
"noImplicitOverride": false /* Ensure overriding members in derived classes are marked with an override modifier. */,
// this causes issues with our current i18n implementation
"noPropertyAccessFromIndexSignature": false /* Enforces using indexed accessors for keys declared using an indexed type. */,
"allowUnusedLabels": false /* Disable error reporting for unused labels. */,
"allowUnreachableCode": false /* Disable error reporting for unreachable code. */,
"jsx": "react" /* useful when dealing with storybook specific components */,
"plugins": [
{
"name": "ts-lit-plugin",
"rules": {
"no-unknown-tag-name": "error",
"no-missing-import": "error",
"no-unclosed-tag": "error",
"no-unknown-attribute": "error",
"no-unknown-property": "error",
"no-unknown-event": "error",
"no-unknown-slot": "error",
"no-invalid-boolean-binding": "error",
"no-expressionless-property-binding": "error",
"no-noncallable-event-binding": "error",
"no-boolean-in-attribute-binding": "error",
"no-complex-attribute-binding": "error",
// in some special cases, it doesn't know enough to work
// it does not seem to recognize `ifDefined`
"no-nullable-attribute-binding": "off",
// There are false positives and false negatives with this rule :-(
// https://github.com/runem/web-component-analyzer/issues/104
"no-incompatible-type-binding": "off",
"no-invalid-directive-binding": "error",
"no-unintended-mixed-binding": "error",
"no-incompatible-property-type": "error",
"no-unknown-property-converter": "error",
"no-invalid-attribute-name": "error",
"no-invalid-tag-name": "error",
"no-invalid-css": "error"
},
"globalEvents": [
// HACK: Right now, we don't have a clean way to recognize Shoelace events so this is not perfect.
"sl-change",
// some events aren't recognized :-(
// https://github.com/runem/lit-analyzer/issues/145
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/animationend_event
// https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseenter_event
"wheel",
"copy",
"paste",
// HACK: Right now, we don't have a clean way to recognize events fired from something else than a component.
// those events are fired by the `form-submit-directive` through `form-submit-handler`
"form:valid",
"form:invalid"
]
}
]
}
}