Explicitly import the specific method needed
1import * as vscode from "vscode"; 2
3export const py2Statement =
4 "# coding: utf-8\nfrom __future__ import print_function\n";
Explicitly import the specific method needed
1import * as vscode from "vscode";
2import * as config from "./config"; 3
4type BracketType = {
5 opening: string;
Explicitly import the specific method needed
1import * as vscode from "vscode"; 2import * as config from "./config";
3
4type BracketType = {
Explicitly import the specific method needed
1import * as vscode from "vscode";
2import * as path from "path";
3
4import * as config from "./config"; 5
6export class DataModel {
7 public config: config.Config;
Explicitly import the specific method needed
1import * as vscode from "vscode";
2import * as path from "path"; 3
4import * as config from "./config";
5
Explicitly import the specific method needed
1import * as vscode from "vscode"; 2import * as path from "path";
3
4import * as config from "./config";
Explicitly import the specific method needed
1import * as vscode from "vscode";
2import * as utils from "./utils";
3import * as doc from "./document_parser"; 4
5import { SelectedText } from "./selected_text";
6import { printConstructor } from "./print_constructor";
Explicitly import the specific method needed
1import * as vscode from "vscode";
2import * as utils from "./utils"; 3import * as doc from "./document_parser";
4
5import { SelectedText } from "./selected_text";
Explicitly import the specific method needed
1import * as vscode from "vscode"; 2import * as utils from "./utils";
3import * as doc from "./document_parser";
4
Explicitly import the specific method needed
1import * as vscode from "vscode";
2import * as config from "./config"; 3
4type LineObject = {
5 text: string;
Explicitly import the specific method needed
1import * as vscode from "vscode"; 2import * as config from "./config";
3
4type LineObject = {
Explicitly import the specific method needed
1import * as vscode from "vscode"; 2
3export const DEFAULTS = {
4 printSymbol: "➡",
Description
Wildcard imports are easier to write, but make it harder to pick out the specific functions or objects from a dependency that are used in a file.
import * from 'module';
// there is no clear way to tell if
// `someFunction` has been imported
// from 'module'.
someFunction();
Therefore, it is recommended to explicit imports wherever possible.
NOTE: Some libraries do not expose themselves as ESModules. In cases like these, it is recommended to use a skipcq comment to suppress this issue.
Bad Practice
import * as axios from 'axios'
import * as Sentry from '@sentry/node'
try {
const result = await axios.get();
// ...
} catch (err) {
Sentry.captureException(err);
}
Recommended
import axios from 'axios'
// skipcq: JS-C1003 - sentry does not expose itself as an ES Module.
import * as Sentry from '@sentry/node'
try {
const result = await axios.get();
// ...
} catch (err) {
Sentry.captureException(err);
}