mirror of https://github.com/zulip/zulip.git
eslint: Forbid unchecked casts in TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
2f95c55df4
commit
37f0a3b41b
|
@ -172,6 +172,10 @@
|
|||
// Disable base rule to avoid conflict
|
||||
"no-use-before-define": "off",
|
||||
|
||||
"@typescript-eslint/consistent-type-assertions": [
|
||||
"error",
|
||||
{"assertionStyle": "never"}
|
||||
],
|
||||
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
||||
"@typescript-eslint/consistent-type-imports": "error",
|
||||
"@typescript-eslint/explicit-function-return-type": [
|
||||
|
|
|
@ -22,6 +22,7 @@ export default class DebugRequirePlugin implements WebpackPluginInstance {
|
|||
.tap("DebugRequirePlugin", (resolver) => {
|
||||
resolver.getHook("beforeRawModule").tap("DebugRequirePlugin", (req) => {
|
||||
if (!(nameSymbol in req)) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
(req as NamedRequest)[nameSymbol] = req.request;
|
||||
}
|
||||
return undefined!;
|
||||
|
@ -31,6 +32,7 @@ export default class DebugRequirePlugin implements WebpackPluginInstance {
|
|||
if (req.path !== false) {
|
||||
const inPath = path.relative(compiler.context, req.path);
|
||||
if (!inPath.startsWith("../") && !(nameSymbol in req)) {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
(req as NamedRequest)[nameSymbol] = "./" + inPath;
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +42,7 @@ export default class DebugRequirePlugin implements WebpackPluginInstance {
|
|||
resolver
|
||||
.getHook("beforeResolved")
|
||||
.tap("DebugRequirePlugin", (req: ResolveRequest) => {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
const name = (req as NamedRequest)[nameSymbol];
|
||||
if (name !== undefined && req.path !== false) {
|
||||
const names = resolved.get(req.path);
|
||||
|
|
Loading…
Reference in New Issue