editor/code: Sort the style to import types
see: - https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-type-imports.md - https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-import-type-side-effects.md
This commit is contained in:
parent
6f2e8aaba6
commit
445b4fc27f
18 changed files with 52 additions and 37 deletions
|
@ -33,5 +33,14 @@ module.exports = {
|
|||
"@typescript-eslint/semi": ["error", "always"],
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
|
||||
"@typescript-eslint/consistent-type-imports": [
|
||||
"error",
|
||||
{
|
||||
prefer: "type-imports",
|
||||
fixStyle: "inline-type-imports",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-import-type-side-effects": "error",
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as vscode from "vscode";
|
||||
|
||||
import { Ctx, Disposable } from "./ctx";
|
||||
import { RustEditor, isRustEditor } from "./util";
|
||||
import type { Ctx, Disposable } from "./ctx";
|
||||
import { type RustEditor, isRustEditor } from "./util";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
// FIXME: consider implementing this via the Tree View API?
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as vscode from "vscode";
|
||||
import * as os from "os";
|
||||
import { Config } from "./config";
|
||||
import type { Config } from "./config";
|
||||
import { log, isValidExecutable } from "./util";
|
||||
import { PersistentState } from "./persistent_state";
|
||||
import type { PersistentState } from "./persistent_state";
|
||||
import { exec } from "child_process";
|
||||
|
||||
export async function bootstrap(
|
||||
|
|
|
@ -6,7 +6,7 @@ import * as Is from "vscode-languageclient/lib/common/utils/is";
|
|||
import { assert } from "./util";
|
||||
import * as diagnostics from "./diagnostics";
|
||||
import { WorkspaceEdit } from "vscode";
|
||||
import { Config, prepareVSCodeConfig } from "./config";
|
||||
import { type Config, prepareVSCodeConfig } from "./config";
|
||||
import { randomUUID } from "crypto";
|
||||
import { sep as pathSeparator } from "path";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
|
|
@ -3,23 +3,23 @@ import * as lc from "vscode-languageclient";
|
|||
import * as ra from "./lsp_ext";
|
||||
import * as path from "path";
|
||||
|
||||
import { Ctx, Cmd, CtxInit, discoverWorkspace } from "./ctx";
|
||||
import { type Ctx, type Cmd, type CtxInit, discoverWorkspace } from "./ctx";
|
||||
import { applySnippetWorkspaceEdit, applySnippetTextEdits } from "./snippets";
|
||||
import { spawnSync } from "child_process";
|
||||
import { RunnableQuickPick, selectRunnable, createTask, createArgs } from "./run";
|
||||
import { type RunnableQuickPick, selectRunnable, createTask, createArgs } from "./run";
|
||||
import { AstInspector } from "./ast_inspector";
|
||||
import {
|
||||
isRustDocument,
|
||||
isCargoTomlDocument,
|
||||
sleep,
|
||||
isRustEditor,
|
||||
RustEditor,
|
||||
RustDocument,
|
||||
type RustEditor,
|
||||
type RustDocument,
|
||||
} from "./util";
|
||||
import { startDebugSession, makeDebugConfig } from "./debug";
|
||||
import { LanguageClient } from "vscode-languageclient/node";
|
||||
import type { LanguageClient } from "vscode-languageclient/node";
|
||||
import { LINKED_COMMANDS } from "./client";
|
||||
import { DependencyId } from "./dependencies_provider";
|
||||
import type { DependencyId } from "./dependencies_provider";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
export * from "./ast_inspector";
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as Is from "vscode-languageclient/lib/common/utils/is";
|
|||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
import * as vscode from "vscode";
|
||||
import { Env } from "./client";
|
||||
import type { Env } from "./client";
|
||||
import { log } from "./util";
|
||||
import { expectNotUndefined, unwrapUndefinable } from "./undefinable";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as vscode from "vscode";
|
||||
import * as lc from "vscode-languageclient/node";
|
||||
import type * as lc from "vscode-languageclient/node";
|
||||
import * as ra from "./lsp_ext";
|
||||
import * as path from "path";
|
||||
|
||||
|
@ -12,19 +12,19 @@ import {
|
|||
isRustEditor,
|
||||
LazyOutputChannel,
|
||||
log,
|
||||
RustEditor,
|
||||
type RustEditor,
|
||||
} from "./util";
|
||||
import { ServerStatusParams } from "./lsp_ext";
|
||||
import type { ServerStatusParams } from "./lsp_ext";
|
||||
import {
|
||||
Dependency,
|
||||
DependencyFile,
|
||||
type Dependency,
|
||||
type DependencyFile,
|
||||
RustDependenciesProvider,
|
||||
DependencyId,
|
||||
type DependencyId,
|
||||
} from "./dependencies_provider";
|
||||
import { execRevealDependency } from "./commands";
|
||||
import { PersistentState } from "./persistent_state";
|
||||
import { bootstrap } from "./bootstrap";
|
||||
import { ExecOptions } from "child_process";
|
||||
import type { ExecOptions } from "child_process";
|
||||
|
||||
// We only support local folders, not eg. Live Share (`vlsl:` scheme), so don't activate if
|
||||
// only those are in use. We use "Empty" to represent these scenarios
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as os from "os";
|
||||
import * as vscode from "vscode";
|
||||
import * as path from "path";
|
||||
import * as ra from "./lsp_ext";
|
||||
import type * as ra from "./lsp_ext";
|
||||
|
||||
import { Cargo, getRustcId, getSysroot } from "./toolchain";
|
||||
import { Ctx } from "./ctx";
|
||||
import type { Ctx } from "./ctx";
|
||||
import { prepareEnv } from "./run";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as vscode from "vscode";
|
||||
import * as fspath from "path";
|
||||
import * as fs from "fs";
|
||||
import { CtxInit } from "./ctx";
|
||||
import type { CtxInit } from "./ctx";
|
||||
import * as ra from "./lsp_ext";
|
||||
import { FetchDependencyListResult } from "./lsp_ext";
|
||||
import type { FetchDependencyListResult } from "./lsp_ext";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
export class RustDependenciesProvider
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
import * as anser from "anser";
|
||||
import * as vscode from "vscode";
|
||||
import { ProviderResult, Range, TextEditorDecorationType, ThemeColor, window } from "vscode";
|
||||
import { Ctx } from "./ctx";
|
||||
import {
|
||||
type ProviderResult,
|
||||
Range,
|
||||
type TextEditorDecorationType,
|
||||
ThemeColor,
|
||||
window,
|
||||
} from "vscode";
|
||||
import type { Ctx } from "./ctx";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
export const URI_SCHEME = "rust-analyzer-diagnostics-view";
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as vscode from "vscode";
|
|||
import * as lc from "vscode-languageclient/node";
|
||||
|
||||
import * as commands from "./commands";
|
||||
import { CommandFactory, Ctx, fetchWorkspace } from "./ctx";
|
||||
import { type CommandFactory, Ctx, fetchWorkspace } from "./ctx";
|
||||
import * as diagnostics from "./diagnostics";
|
||||
import { activateTaskProvider } from "./tasks";
|
||||
import { setContextValue } from "./util";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import * as vscode from "vscode";
|
||||
import type * as vscode from "vscode";
|
||||
import { log } from "./util";
|
||||
|
||||
export class PersistentState {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import * as vscode from "vscode";
|
||||
import * as lc from "vscode-languageclient";
|
||||
import type * as lc from "vscode-languageclient";
|
||||
import * as ra from "./lsp_ext";
|
||||
import * as tasks from "./tasks";
|
||||
|
||||
import { CtxInit } from "./ctx";
|
||||
import type { CtxInit } from "./ctx";
|
||||
import { makeDebugConfig } from "./debug";
|
||||
import { Config, RunnableEnvCfg } from "./config";
|
||||
import type { Config, RunnableEnvCfg } from "./config";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
const quickPickButtons = [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as vscode from "vscode";
|
||||
import * as toolchain from "./toolchain";
|
||||
import { Config } from "./config";
|
||||
import type { Config } from "./config";
|
||||
import { log } from "./util";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as vscode from "vscode";
|
||||
import { strict as nativeAssert } from "assert";
|
||||
import { exec, ExecOptions, spawnSync } from "child_process";
|
||||
import { exec, type ExecOptions, spawnSync } from "child_process";
|
||||
import { inspect } from "util";
|
||||
|
||||
export function assert(condition: boolean, explanation: string): asserts condition {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as assert from "assert";
|
||||
import { Cargo } from "../../src/toolchain";
|
||||
import { Context } from ".";
|
||||
import type { Context } from ".";
|
||||
|
||||
export async function getTests(ctx: Context) {
|
||||
await ctx.suite("Launch configuration/Lens", (suite) => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as assert from "assert";
|
||||
import { prepareEnv } from "../../src/run";
|
||||
import { RunnableEnvCfg } from "../../src/config";
|
||||
import { Context } from ".";
|
||||
import * as ra from "../../src/lsp_ext";
|
||||
import type { RunnableEnvCfg } from "../../src/config";
|
||||
import type { Context } from ".";
|
||||
import type * as ra from "../../src/lsp_ext";
|
||||
|
||||
function makeRunnable(label: string): ra.Runnable {
|
||||
return {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as assert from "assert";
|
||||
import { Context } from ".";
|
||||
import type { Context } from ".";
|
||||
import { substituteVariablesInEnv } from "../../src/config";
|
||||
|
||||
export async function getTests(ctx: Context) {
|
||||
|
|
Loading…
Add table
Reference in a new issue