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

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

Open
nolanlawson opened this issue Feb 22, 2024 · 3 comments
Open

Comments

@nolanlawson
Copy link
Contributor

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

@BatemanVO
Copy link

As requested from the previous thread:
VS Code Version: 1.86.2, x64
SFDX CLI Version: 2.29.5
OS and version: Windows 10 22H2 Build 19045.4046

@erocheleau
Copy link

erocheleau commented Feb 22, 2024

Same

  • VS Code Version: 1.85.1 (Universal)
    image
  • sf-cli version: @salesforce/cli/2.25.7 darwin-arm64 node-v18.19.0
  • OS: macOS Sonoma 14.2.1 (Apple M2 Max)

@EmilynPantelakis
Copy link

EmilynPantelakis commented Mar 11, 2024

I'm here to report the same issue.

  • VS Code Version:
    image
  • sf cli version: @salesforce/cli/2.9.8
  • OS: Windows 11 Pro x64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants