Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 noUnusedVariables misreporting imports used for type definitions #104

Closed
1 task done
jpike88 opened this issue Sep 1, 2023 · 8 comments · Fixed by #495
Closed
1 task done

🐛 noUnusedVariables misreporting imports used for type definitions #104

jpike88 opened this issue Sep 1, 2023 · 8 comments · Fixed by #495
Assignees
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@jpike88
Copy link

jpike88 commented Sep 1, 2023

Environment information

CLI:
  Version:                      1.0.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v16.14.2"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "npm/8.5.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           true
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 true

Workspace:
  Open Documents:               0

Discovering running Biome servers...

Incompatible Biome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Rage discovered this running server using an incompatible version of Biome.

Server:
  Version:                      12.1.3

Incompatible Biome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Rage discovered this running server using an incompatible version of Biome.

Server:
  Version:                      <=10.0.0

Running Biome Server: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ The client isn't connected to any server but rage discovered this running Biome server.

Server:
  Version:                      1.0.0
  Name:                         rome_lsp
  CPU Architecture:             aarch64
  OS:                           macos

Workspace:
  Open Documents:               0

Other Active Server Workspaces:

Workspace:
  Open Documents:               4
  Client Name:                  Visual Studio Code
  Client Version:               1.81.1

Biome Server Log:

⚠ Please review the content of the log file before sharing it publicly as it may contain sensitive information:
  * Path names that may reveal your name, a project name, or the name of your employer.
  * Source code

INFO tower_lsp::service::layers shutdown request received, shutting down
INFO tower_lsp::service::layers exit notification received, stopping
ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
INFO rome_cli::commands::daemon Received shutdown signal
INFO rome_cli::service::unix Trying to connect to socket /var/folders/0v/w61lqyb97l37zrp46x8s24900000gn/T/rome-socket-1.0.0
INFO rome_cli::service::unix Remove socket folder /var/folders/0v/w61lqyb97l37zrp46x8s24900000gn/T/rome-socket-1.0.0
ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)
INFO rome_lsp::server Starting Biome Language Server...
WARN rome_lsp::server The Biome Server was initialized with the deprecated `root_path` parameter: this is not supported, use `root_uri` instead
WARN rome_lsp::server The Biome Server was initialized with the `workspace_folders` parameter: this is unsupported at the moment, use `root_uri` instead
INFO rome_lsp::server Attempting to load the configuration from 'biome.json' file
ERROR rome_fs::fs Could not read the file from "/rome.json", reason:
 No such file or directory (os error 2)
INFO rome_lsp::session Loaded workspace settings: Configuration {
    schema: Some(
        "https://biomejs.dev/schemas/1.0.0/schema.json",
    ),
    vcs: None,
    files: Some(
        FilesConfiguration {
            max_size: None,
            ignore: Some(
                StringSet(
                    {
                        "*.json",
                        "client/src/components/api.ts",
                        "seed/src/components/api.ts",
                        "client/src/components/model/translationKeys.ts",
                        "server/src/components/translations/translationKeys.ts",
                        "shared/version.ts",
                    },
                ),
            ),
            ignore_unknown: None,
        },
    ),
    formatter: Some(
        FormatterConfiguration {
            enabled: Some(
                false,
            ),
            format_with_errors: Some(
                false,
            ),
            indent_style: Some(
                Tab,
            ),
            indent_size: Some(
                2,
            ),
            line_width: Some(
                LineWidth(
                    80,
                ),
            ),
            ignore: None,
        },
    ),
    organize_imports: Some(
        OrganizeImports {
            enabled: Some(
                true,
            ),
            ignore: None,
        },
    ),
    linter: Some(
        LinterConfiguration {
            enabled: Some(
                true,
            ),
            rules: Some(
                Rules {
                    recommended: Some(
                        true,
                    ),
                    all: None,
                    a11y: None,
                    complexity: Some(
                        Complexity {
                            recommended: None,
                            all: None,
                            no_extra_boolean_cast: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_for_each: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_multiple_spaces_in_regular_expression_literals: None,
                            no_useless_catch: None,
                            no_useless_constructor: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_useless_fragments: None,
                            no_useless_label: None,
                            no_useless_rename: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_useless_switch_case: None,
                            no_useless_type_constraint: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_with: None,
                            use_flat_map: None,
                            use_literal_keys: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_optional_chain: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            use_simple_number_keys: None,
                            use_simplified_logic_expression: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                        },
                    ),
                    correctness: Some(
                        Correctness {
                            recommended: None,
                            all: None,
                            no_children_prop: None,
                            no_const_assign: None,
                            no_constructor_return: None,
                            no_empty_pattern: None,
                            no_global_object_calls: None,
                            no_inner_declarations: None,
                            no_invalid_constructor_super: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_new_symbol: None,
                            no_precision_loss: None,
                            no_render_return_value: None,
                            no_setter_return: None,
                            no_string_case_mismatch: None,
                            no_switch_declarations: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_undeclared_variables: None,
                            no_unnecessary_continue: None,
                            no_unreachable: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_unreachable_super: None,
                            no_unsafe_finally: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_unsafe_optional_chaining: None,
                            no_unused_labels: None,
                            no_unused_variables: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_void_elements_with_children: None,
                            no_void_type_return: None,
                            use_is_nan: None,
                            use_valid_for_direction: None,
                            use_yield: None,
                        },
                    ),
                    nursery: Some(
                        Nursery {
                            recommended: None,
                            all: None,
                            no_accumulating_spread: None,
                            no_aria_unsupported_elements: None,
                            no_banned_types: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_confusing_arrow: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_constant_condition: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_control_characters_in_regex: None,
                            no_duplicate_json_keys: None,
                            no_excessive_complexity: None,
                            no_fallthrough_switch_clause: None,
                            no_global_is_finite: None,
                            no_global_is_nan: None,
                            no_noninteractive_tabindex: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_nonoctal_decimal_escape: None,
                            no_redundant_roles: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_self_assign: None,
                            no_static_only_class: None,
                            no_unsafe_declaration_merging: None,
                            no_useless_empty_export: None,
                            no_useless_this_alias: None,
                            no_void: None,
                            use_aria_prop_types: None,
                            use_arrow_function: None,
                            use_exhaustive_dependencies: None,
                            use_getter_return: None,
                            use_grouped_type_import: None,
                            use_hook_at_top_level: None,
                            use_import_restrictions: None,
                            use_is_array: None,
                            use_literal_enum_members: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_naming_convention: None,
                        },
                    ),
                    performance: Some(
                        Performance {
                            recommended: None,
                            all: None,
                            no_delete: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                        },
                    ),
                    security: None,
                    style: Some(
                        Style {
                            recommended: None,
                            all: None,
                            no_arguments: None,
                            no_comma_operator: None,
                            no_implicit_boolean: None,
                            no_inferrable_types: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_namespace: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_negation_else: None,
                            no_non_null_assertion: None,
                            no_parameter_assign: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_parameter_properties: None,
                            no_restricted_globals: None,
                            no_shouty_constants: None,
                            no_unused_template_literal: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_var: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_block_statements: None,
                            use_const: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_default_parameter_last: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            use_enum_initializers: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            use_exponentiation_operator: None,
                            use_fragment_syntax: None,
                            use_numeric_literals: None,
                            use_self_closing_elements: None,
                            use_shorthand_array_type: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_single_case_statement: None,
                            use_single_var_declarator: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_template: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            use_while: None,
                        },
                    ),
                    suspicious: Some(
                        Suspicious {
                            recommended: None,
                            all: None,
                            no_array_index_key: None,
                            no_assign_in_expressions: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_async_promise_executor: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_catch_assign: None,
                            no_class_assign: None,
                            no_comment_text: None,
                            no_compare_neg_zero: None,
                            no_confusing_labels: None,
                            no_console_log: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_const_enum: None,
                            no_debugger: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_double_equals: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_duplicate_case: None,
                            no_duplicate_class_members: None,
                            no_duplicate_jsx_props: None,
                            no_duplicate_object_keys: None,
                            no_duplicate_parameters: None,
                            no_empty_interface: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_explicit_any: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_extra_non_null_assertion: None,
                            no_function_assign: None,
                            no_import_assign: None,
                            no_label_var: None,
                            no_prototype_builtins: None,
                            no_redeclare: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_redundant_use_strict: None,
                            no_self_compare: None,
                            no_shadow_restricted_names: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_sparse_array: None,
                            no_unsafe_negation: None,
                            use_default_switch_clause_last: None,
                            use_namespace_keyword: None,
                            use_valid_typeof: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                        },
                    ),
                },
            ),
            ignore: None,
        },
    ),
    javascript: Some(
        JavascriptConfiguration {
            formatter: Some(
                JavascriptFormatter {
                    quote_style: Some(
                        Single,
                    ),
                    jsx_quote_style: None,
                    quote_properties: None,
                    trailing_comma: Some(
                        Es5,
                    ),
                    semicolons: None,
                    arrow_parentheses: None,
                },
            ),
            parser: Some(
                JavascriptParser {
                    unsafe_parameter_decorators_enabled: Some(
                        true,
                    ),
                },
            ),
            globals: None,
            organize_imports: None,
        },
    ),
    json: None,
    extends: None,
}
INFO rome_lsp::session Loaded client configuration: Object {
    "lspBin": Null,
    "rename": Null,
    "requireConfiguration": Bool(true),
}
INFO rome_lsp::session Unregister capabilities "textDocument/rangeFormatting, textDocument/onTypeFormatting, workspace/didChangeWatchedFiles, textDocument/rename, textDocument/formatting, workspace/didChangeConfiguration"
INFO rome_lsp::session Register capabilities "textDocument/rangeFormatting, textDocument/onTypeFormatting, workspace/didChangeWatchedFiles, textDocument/formatting, workspace/didChangeConfiguration"
INFO rome_lsp::session Loaded client configuration: Object {
    "lspBin": Null,
    "rename": Null,
    "requireConfiguration": Bool(true),
}
INFO rome_lsp::session Unregister capabilities "textDocument/rangeFormatting, textDocument/onTypeFormatting, textDocument/rename, workspace/didChangeConfiguration, workspace/didChangeWatchedFiles, textDocument/formatting"
INFO rome_lsp::session Register capabilities "textDocument/rangeFormatting, textDocument/onTypeFormatting, workspace/didChangeConfiguration, workspace/didChangeWatchedFiles, textDocument/formatting"
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
ERROR rome_fs::fs Could not read the file from "/rome.json", reason:
 No such file or directory (os error 2)
INFO rome_lsp::session Loaded workspace settings: Configuration {
    schema: Some(
        "https://biomejs.dev/schemas/1.0.0/schema.json",
    ),
    vcs: None,
    files: Some(
        FilesConfiguration {
            max_size: None,
            ignore: Some(
                StringSet(
                    {
                        "*.json",
                        "client/src/components/api.ts",
                        "seed/src/components/api.ts",
                        "client/src/components/model/translationKeys.ts",
                        "server/src/components/translations/translationKeys.ts",
                        "shared/version.ts",
                    },
                ),
            ),
            ignore_unknown: None,
        },
    ),
    formatter: Some(
        FormatterConfiguration {
            enabled: Some(
                false,
            ),
            format_with_errors: Some(
                false,
            ),
            indent_style: Some(
                Tab,
            ),
            indent_size: Some(
                2,
            ),
            line_width: Some(
                LineWidth(
                    80,
                ),
            ),
            ignore: None,
        },
    ),
    organize_imports: Some(
        OrganizeImports {
            enabled: Some(
                true,
            ),
            ignore: None,
        },
    ),
    linter: Some(
        LinterConfiguration {
            enabled: Some(
                true,
            ),
            rules: Some(
                Rules {
                    recommended: Some(
                        true,
                    ),
                    all: None,
                    a11y: None,
                    complexity: Some(
                        Complexity {
                            recommended: None,
                            all: None,
                            no_extra_boolean_cast: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_for_each: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_multiple_spaces_in_regular_expression_literals: None,
                            no_useless_catch: None,
                            no_useless_constructor: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_useless_fragments: None,
                            no_useless_label: None,
                            no_useless_rename: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_useless_switch_case: None,
                            no_useless_type_constraint: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_with: None,
                            use_flat_map: None,
                            use_literal_keys: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_optional_chain: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            use_simple_number_keys: None,
                            use_simplified_logic_expression: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                        },
                    ),
                    correctness: Some(
                        Correctness {
                            recommended: None,
                            all: None,
                            no_children_prop: None,
                            no_const_assign: None,
                            no_constructor_return: None,
                            no_empty_pattern: None,
                            no_global_object_calls: None,
                            no_inner_declarations: None,
                            no_invalid_constructor_super: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_new_symbol: None,
                            no_precision_loss: None,
                            no_render_return_value: None,
                            no_setter_return: None,
                            no_string_case_mismatch: None,
                            no_switch_declarations: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_undeclared_variables: None,
                            no_unnecessary_continue: None,
                            no_unreachable: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_unreachable_super: None,
                            no_unsafe_finally: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_unsafe_optional_chaining: None,
                            no_unused_labels: None,
                            no_unused_variables: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_void_elements_with_children: None,
                            no_void_type_return: None,
                            use_is_nan: None,
                            use_valid_for_direction: None,
                            use_yield: None,
                        },
                    ),
                    nursery: Some(
                        Nursery {
                            recommended: None,
                            all: None,
                            no_accumulating_spread: None,
                            no_aria_unsupported_elements: None,
                            no_banned_types: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_confusing_arrow: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_constant_condition: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_control_characters_in_regex: None,
                            no_duplicate_json_keys: None,
                            no_excessive_complexity: None,
                            no_fallthrough_switch_clause: None,
                            no_global_is_finite: None,
                            no_global_is_nan: None,
                            no_noninteractive_tabindex: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_nonoctal_decimal_escape: None,
                            no_redundant_roles: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_self_assign: None,
                            no_static_only_class: None,
                            no_unsafe_declaration_merging: None,
                            no_useless_empty_export: None,
                            no_useless_this_alias: None,
                            no_void: None,
                            use_aria_prop_types: None,
                            use_arrow_function: None,
                            use_exhaustive_dependencies: None,
                            use_getter_return: None,
                            use_grouped_type_import: None,
                            use_hook_at_top_level: None,
                            use_import_restrictions: None,
                            use_is_array: None,
                            use_literal_enum_members: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_naming_convention: None,
                        },
                    ),
                    performance: Some(
                        Performance {
                            recommended: None,
                            all: None,
                            no_delete: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                        },
                    ),
                    security: None,
                    style: Some(
                        Style {
                            recommended: None,
                            all: None,
                            no_arguments: None,
                            no_comma_operator: None,
                            no_implicit_boolean: None,
                            no_inferrable_types: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_namespace: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_negation_else: None,
                            no_non_null_assertion: None,
                            no_parameter_assign: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_parameter_properties: None,
                            no_restricted_globals: None,
                            no_shouty_constants: None,
                            no_unused_template_literal: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_var: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_block_statements: None,
                            use_const: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_default_parameter_last: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            use_enum_initializers: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            use_exponentiation_operator: None,
                            use_fragment_syntax: None,
                            use_numeric_literals: None,
                            use_self_closing_elements: None,
                            use_shorthand_array_type: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_single_case_statement: None,
                            use_single_var_declarator: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            use_template: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            use_while: None,
                        },
                    ),
                    suspicious: Some(
                        Suspicious {
                            recommended: None,
                            all: None,
                            no_array_index_key: None,
                            no_assign_in_expressions: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_async_promise_executor: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_catch_assign: None,
                            no_class_assign: None,
                            no_comment_text: None,
                            no_compare_neg_zero: None,
                            no_confusing_labels: None,
                            no_console_log: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_const_enum: None,
                            no_debugger: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_double_equals: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_duplicate_case: None,
                            no_duplicate_class_members: None,
                            no_duplicate_jsx_props: None,
                            no_duplicate_object_keys: None,
                            no_duplicate_parameters: None,
                            no_empty_interface: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                            no_explicit_any: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_extra_non_null_assertion: None,
                            no_function_assign: None,
                            no_import_assign: None,
                            no_label_var: None,
                            no_prototype_builtins: None,
                            no_redeclare: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_redundant_use_strict: None,
                            no_self_compare: None,
                            no_shadow_restricted_names: Some(
                                Plain(
                                    Off,
                                ),
                            ),
                            no_sparse_array: None,
                            no_unsafe_negation: None,
                            use_default_switch_clause_last: None,
                            use_namespace_keyword: None,
                            use_valid_typeof: Some(
                                Plain(
                                    Error,
                                ),
                            ),
                        },
                    ),
                },
            ),
            ignore: None,
        },
    ),
    javascript: Some(
        JavascriptConfiguration {
            formatter: Some(
                JavascriptFormatter {
                    quote_style: Some(
                        Single,
                    ),
                    jsx_quote_style: None,
                    quote_properties: None,
                    trailing_comma: Some(
                        Es5,
                    ),
                    semicolons: None,
                    arrow_parentheses: None,
                },
            ),
            parser: Some(
                JavascriptParser {
                    unsafe_parameter_decorators_enabled: Some(
                        true,
                    ),
                },
            ),
            globals: None,
            organize_imports: None,
        },
    ),
    json: None,
    extends: None,
}
INFO rome_lsp::session Unregister capabilities "workspace/didChangeWatchedFiles, textDocument/rangeFormatting, textDocument/rename, textDocument/formatting, workspace/didChangeConfiguration, textDocument/onTypeFormatting"
INFO rome_lsp::session Register capabilities "workspace/didChangeWatchedFiles, textDocument/rangeFormatting, textDocument/formatting, workspace/didChangeConfiguration, textDocument/onTypeFormatting"
INFO rome_lsp::server Starting Biome Language Server...
ERROR tower_lsp::transport failed to encode message: failed to encode response: Socket is not connected (os error 57)

What happened?

see code example. imports sometimes are useful for type references, shouldn't be throwing an error here.

Screenshot 2023-09-01 at 09 56 41

Expected result

should let me use the import as a type only

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Conaclos Conaclos added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug labels Sep 3, 2023
@GabenGar
Copy link
Contributor

GabenGar commented Sep 7, 2023

Actually you have to mark a type-only import either as import type {...} from "..." or import { type SymbolName } from "...". The new verbatimModuleSyntax option in typescript is pretty anal about how you write your import statements. In this case Biome (formerly Rome) is right to error out, but should have a separate rule for concrete and type imports with the same symbol name (like all classes have) and say something along the lines of ${symbolName} is exported as a concrete and a type symbol but only type symbol is used..

@Conaclos
Copy link
Member

Conaclos commented Sep 26, 2023

Actually, this caused by the use of a parameter name identical to the type name.

See a simpler example in the playground.

EDIT: See also rome#4660

@jpike88
Copy link
Author

jpike88 commented Sep 27, 2023

correct, just confirmed on my side too

@GabenGar
Copy link
Contributor

Actually, this caused by the use of a parameter name identical to the type name.

Which is all class declarations.

@Conaclos
Copy link
Member

Which is all class declarations.

I don't understand what you mean.

@GabenGar
Copy link
Contributor

Classes create a concrete symbol and a type with the same name. And therefore a construct like import { SymbolName } from "..." becomes ambiguous without tracking the usage. And that means it's impossible to statically analyze the module without running typescript.

@Conaclos
Copy link
Member

Classes create a concrete symbol and a type with the same name. And therefore a construct like import { SymbolName } from "..." becomes ambiguous without tracking the usage. And that means it's impossible to statically analyze the module without running typescript.

You are right. However, it is not related to the current issue.

@GabenGar
Copy link
Contributor

It is, because biome sees import { FormMasterComponent } from "...", but, because of dual nature of class declarations in typescript, it also doubles up as a concrete import (potentially with side effects). The concrete symbol is not used, hence the error. It wouldn't matter maybe 2 or 3 years ago, when typescript was just automagically eliding type imports based on usage, but the behaviour of this statement heavily depends on typescript configuration now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
3 participants