6

I'm working up to the LWC super badge and I'm on the prerequisite trail: Use Lightning Data Service to Work with Data

I'm seeing the following error:

We can’t find the 'FirstName', 'LastName', and 'Email' fields imported into contactCreator.js.

I've structured my imports like this, for example:

import FIRSTNAME_FIELD from "@salesforce/schema/Contact.FirstName";

I've tried renaming the imports to 'FirstName', 'LastName', and 'Email' and placing the imports in a different order. What am I missing?

1
  • 1
    I've edited this question to include less code and be clearer that it's not Superbadge content, per discussions on Meta. I believe this question and answer adds value to the community without inappropriately disclosing badge solutions.
    – David Reed
    Jul 19, 2020 at 15:04

1 Answer 1

8

Use single-quotes (which is a Prettier setting).

6
  • 1
    I flipped the prettier setting, saved/deployed and it worked... Thank you! The component was working as expected, is this something specific to the trailheads/superbadges?
    – MPStimpson
    Jun 24, 2020 at 21:38
  • Kinda. The challenge checks to verficiations. And depending if it's single-quote or double-quote... well, we as devs know how that can run... ;-) Jun 24, 2020 at 22:28
  • 1
    @muenzpraeger thanks for that... I got really frustrated yesterday... Could not get around that... But is there any difference between " and ' ? Or is just a styling preference? I'm asking because in other challenges apparently they don't bother about it.
    – Marco
    Jun 25, 2020 at 9:12
  • God bless you, @muenzpraeger Jun 25, 2020 at 17:03
  • 3
    @muenzpraeger - FYI, creating a sandbox project via sfdx-cli provides the project with a .prettierrc that gives defaults that lead to this error. Might be the root cause of these compilation checks on the badges. IMO, project creation file defaults should align to those found in lwc-recipes.
    – tsalb
    Jun 27, 2020 at 17:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.