eslint: Enable @typescript-eslint/consistent-type-imports.

TypeScript type-only imports will probably become important eventually
for reducing our circular import problem.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-03-18 16:56:46 -07:00 committed by Anders Kaseorg
parent 6364e1b5f3
commit 0d218a4b76
5 changed files with 10 additions and 5 deletions

View File

@ -142,17 +142,20 @@
}, },
"rules": { "rules": {
// Disable base rule to avoid conflict // Disable base rule to avoid conflict
"no-duplicate-imports": "off",
"no-unused-vars": "off", "no-unused-vars": "off",
"no-useless-constructor": "off", "no-useless-constructor": "off",
"@typescript-eslint/array-type": "error", "@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error", "@typescript-eslint/await-thenable": "error",
"@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/explicit-function-return-type": [ "@typescript-eslint/explicit-function-return-type": [
"error", "error",
{"allowExpressions": true} {"allowExpressions": true}
], ],
"@typescript-eslint/member-ordering": "error", "@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-duplicate-imports": "off",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extraneous-class": "error", "@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-non-null-assertion": "off",

View File

@ -2,7 +2,8 @@ import {strict as assert} from "assert";
import "css.escape"; import "css.escape";
import path from "path"; import path from "path";
import {Browser, ElementHandle, Page, launch} from "puppeteer"; import type {Browser, ElementHandle, Page} from "puppeteer";
import {launch} from "puppeteer";
import {test_credentials} from "../../var/puppeteer/test_credentials"; import {test_credentials} from "../../var/puppeteer/test_credentials";

View File

@ -1,6 +1,6 @@
import ErrorStackParser from "error-stack-parser"; import ErrorStackParser from "error-stack-parser";
import $ from "jquery"; import $ from "jquery";
import StackFrame from "stackframe"; import type StackFrame from "stackframe";
import StackTraceGPS from "stacktrace-gps"; import StackTraceGPS from "stacktrace-gps";
import render_blueslip_stacktrace from "../templates/blueslip_stacktrace.hbs"; import render_blueslip_stacktrace from "../templates/blueslip_stacktrace.hbs";

View File

@ -1,5 +1,5 @@
import SourceMap from "source-map"; import type SourceMap from "source-map";
import StackFrame from "stackframe"; import type StackFrame from "stackframe";
declare namespace StackTraceGPS { declare namespace StackTraceGPS {
type StackTraceGPSOptions = { type StackTraceGPSOptions = {

View File

@ -4,7 +4,8 @@
import path from "path"; import path from "path";
import webpack, {Template} from "webpack"; import type webpack from "webpack";
import {Template} from "webpack";
export default class DebugRequirePlugin { export default class DebugRequirePlugin {
apply(compiler: webpack.Compiler): void { apply(compiler: webpack.Compiler): void {