Skip to content

Linter should ignore __tests__ folder when invoking @lwc/metadata #588

@nolanlawson

Description

@nolanlawson

Summary

Users are reporting (salesforce/sfdx-lwc-jest#350) that import { createElement } from 'lwc' is showing a red squiggly in VS Code even though this is not considered a lint error anywhere else in the system (e.g. when running eslint on the command line or publishing via SFDX).

Our team looked into this, and we believe the solution is the following:

  • The compiler ignores files that are in __tests__ folder and hence the linting rules do not apply. That explains why they are not facing any issues when saving the component.
  • The fix would be to make language server mimic the same and ignore tests folder when invoking @lwc/metadata.

Steps To Reproduce:

  1. Add import { createElement } from 'lwc' to a __tests__ (Jest) test in an SFDX project.

Expected result

No red squiggly should appear.

Actual result

A red squiggly appears.

Additional information

Please see salesforce/sfdx-lwc-jest#350 for the original bug report.

VS Code Version: Unknown

SFDX CLI Version: Unknown

OS and version: Unknown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions