Log to console in a Lightning Web ComponentHow to force a refresh of a custom console componentLightning App:...

How do I add a strong "onion flavor" to the biryani (in restaurant style)?

Can I do anything else with aspersions other than cast them?

What is the name of this perspective and how is it constructed?

Why is Shelob considered evil?

Boss asked me to sign a resignation paper without a date on it along with my new contract

The Longest Chess Game

Build ASCII Podiums

How many copper coins fit inside a cubic foot?

How do I split ammo?

What does "don't have a baby" imply or mean in this sentence?

Fundamental Theorem of Calculus I help!

Why is Bernie Sanders maximum accepted donation on actblue $5600?

Why is the meaning of kanji 閑 "leisure"?

A cancellation property for permutations

Empty optional argument or Not giving optional argument at all?

Is it common to refer to someone as "Prof. Dr. [LastName]"?

How can guns be countered by melee combat without raw-ability or exceptional explanations?

Identical projects by students at two different colleges: still plagiarism?

Do error bars on probabilities have any meaning?

Is it ethical to apply for a job on someone's behalf?

Why are `&array` and `array` pointing to the same address?

Why write a book when there's a movie in my head?

How do I handle a blinded enemy which wants to attack someone it's sure is there?

What does it mean when an external ID field follows a DML Statement?



Log to console in a Lightning Web Component


How to force a refresh of a custom console componentLightning App: how to fix [Exception, DomainNotPropagated] errorToo many namespaces errorHow do I Call Methods in the Console Integration Toolkit from a Lightning Component?Lightning: WARNING: error in server action and FATAL_ERROR System.StringException: Invalid id:Display Output Panel from Console Component to Window.TopAdding meta tab for CSP issues in lighting web componentHow to delete a Lightning Web Component?Get Record Data for Custom ObjectSyntax guide for working with Salesforce Web Components













3















I am attempting to write a Lightning Web Component, but continually run into errors in my Javascript that I can't debug.



I've been trying to log my error but when I put console.log() anywhere in the methods that are failing, I get the error:




Unexpected console statement.











share|improve this question




















  • 1





    Surprisingly console.log() work in playground

    – Pranay Jaiswal
    58 mins ago






  • 1





    That must be the ESLint error. You can still use console.log() or say alert() statements for any debugging purposes (I can confirm this as I have used this in couple of my LWCs).

    – Jayant Das
    55 mins ago











  • @JayantDas anything to supress linter error?

    – Pranay Jaiswal
    52 mins ago











  • @PranayJaiswal I have utilized it right within the editor by suppressing those. But there must be a config file to do it globally though.

    – Jayant Das
    47 mins ago






  • 1





    @PranayJaiswal Looks like there's one for such cases.

    – Jayant Das
    46 mins ago


















3















I am attempting to write a Lightning Web Component, but continually run into errors in my Javascript that I can't debug.



I've been trying to log my error but when I put console.log() anywhere in the methods that are failing, I get the error:




Unexpected console statement.











share|improve this question




















  • 1





    Surprisingly console.log() work in playground

    – Pranay Jaiswal
    58 mins ago






  • 1





    That must be the ESLint error. You can still use console.log() or say alert() statements for any debugging purposes (I can confirm this as I have used this in couple of my LWCs).

    – Jayant Das
    55 mins ago











  • @JayantDas anything to supress linter error?

    – Pranay Jaiswal
    52 mins ago











  • @PranayJaiswal I have utilized it right within the editor by suppressing those. But there must be a config file to do it globally though.

    – Jayant Das
    47 mins ago






  • 1





    @PranayJaiswal Looks like there's one for such cases.

    – Jayant Das
    46 mins ago
















3












3








3








I am attempting to write a Lightning Web Component, but continually run into errors in my Javascript that I can't debug.



I've been trying to log my error but when I put console.log() anywhere in the methods that are failing, I get the error:




Unexpected console statement.











share|improve this question
















I am attempting to write a Lightning Web Component, but continually run into errors in my Javascript that I can't debug.



I've been trying to log my error but when I put console.log() anywhere in the methods that are failing, I get the error:




Unexpected console statement.








error console lightning-web-components






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 43 mins ago









Jayant Das

15.2k2824




15.2k2824










asked 1 hour ago









BlondeSwanBlondeSwan

905




905








  • 1





    Surprisingly console.log() work in playground

    – Pranay Jaiswal
    58 mins ago






  • 1





    That must be the ESLint error. You can still use console.log() or say alert() statements for any debugging purposes (I can confirm this as I have used this in couple of my LWCs).

    – Jayant Das
    55 mins ago











  • @JayantDas anything to supress linter error?

    – Pranay Jaiswal
    52 mins ago











  • @PranayJaiswal I have utilized it right within the editor by suppressing those. But there must be a config file to do it globally though.

    – Jayant Das
    47 mins ago






  • 1





    @PranayJaiswal Looks like there's one for such cases.

    – Jayant Das
    46 mins ago
















  • 1





    Surprisingly console.log() work in playground

    – Pranay Jaiswal
    58 mins ago






  • 1





    That must be the ESLint error. You can still use console.log() or say alert() statements for any debugging purposes (I can confirm this as I have used this in couple of my LWCs).

    – Jayant Das
    55 mins ago











  • @JayantDas anything to supress linter error?

    – Pranay Jaiswal
    52 mins ago











  • @PranayJaiswal I have utilized it right within the editor by suppressing those. But there must be a config file to do it globally though.

    – Jayant Das
    47 mins ago






  • 1





    @PranayJaiswal Looks like there's one for such cases.

    – Jayant Das
    46 mins ago










1




1





Surprisingly console.log() work in playground

– Pranay Jaiswal
58 mins ago





Surprisingly console.log() work in playground

– Pranay Jaiswal
58 mins ago




1




1





That must be the ESLint error. You can still use console.log() or say alert() statements for any debugging purposes (I can confirm this as I have used this in couple of my LWCs).

– Jayant Das
55 mins ago





That must be the ESLint error. You can still use console.log() or say alert() statements for any debugging purposes (I can confirm this as I have used this in couple of my LWCs).

– Jayant Das
55 mins ago













@JayantDas anything to supress linter error?

– Pranay Jaiswal
52 mins ago





@JayantDas anything to supress linter error?

– Pranay Jaiswal
52 mins ago













@PranayJaiswal I have utilized it right within the editor by suppressing those. But there must be a config file to do it globally though.

– Jayant Das
47 mins ago





@PranayJaiswal I have utilized it right within the editor by suppressing those. But there must be a config file to do it globally though.

– Jayant Das
47 mins ago




1




1





@PranayJaiswal Looks like there's one for such cases.

– Jayant Das
46 mins ago







@PranayJaiswal Looks like there's one for such cases.

– Jayant Das
46 mins ago












1 Answer
1






active

oldest

votes


















5














You are most likely encountering ESLint errors in VS Code.



As an example below is how my code looks like with those warnings. However I am still able to save the component and utilize alert or console.log statements specifically for debugging purposes.



You can also choose to suppress those warnings by right clicking on those warnings



OR



By editing the .eslintrc.json available in your project by adding the below rules:



"rules": {
"no-console": "off",
"no-alert": "off"
}




Console showing errors



enter image description here





Option to disable the rules by right clicking on the alert



enter image description here






share|improve this answer


























  • +1. Thanks. I tried same in Illuminated Cloud for LWC, it showed SUCCEEDED_PARTIAL

    – Pranay Jaiswal
    46 mins ago






  • 1





    @PranayJaiswal I updated my answer to include how to add the rules in .eslintrc.json in VS Code.

    – Jayant Das
    40 mins ago











  • @JayantDas thanks. btw, thanks for all your help. I don't mean to be a bug asking all these questions, it's just hard finding documentation for non-aura components.

    – BlondeSwan
    33 mins ago











  • @BlondeSwan You have been helping me/us to learn/know all this! So equally thanks to you :)

    – Jayant Das
    32 mins ago






  • 1





    Thanks Jayant. Much appreciated

    – Pranay Jaiswal
    22 mins ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f251270%2flog-to-console-in-a-lightning-web-component%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














You are most likely encountering ESLint errors in VS Code.



As an example below is how my code looks like with those warnings. However I am still able to save the component and utilize alert or console.log statements specifically for debugging purposes.



You can also choose to suppress those warnings by right clicking on those warnings



OR



By editing the .eslintrc.json available in your project by adding the below rules:



"rules": {
"no-console": "off",
"no-alert": "off"
}




Console showing errors



enter image description here





Option to disable the rules by right clicking on the alert



enter image description here






share|improve this answer


























  • +1. Thanks. I tried same in Illuminated Cloud for LWC, it showed SUCCEEDED_PARTIAL

    – Pranay Jaiswal
    46 mins ago






  • 1





    @PranayJaiswal I updated my answer to include how to add the rules in .eslintrc.json in VS Code.

    – Jayant Das
    40 mins ago











  • @JayantDas thanks. btw, thanks for all your help. I don't mean to be a bug asking all these questions, it's just hard finding documentation for non-aura components.

    – BlondeSwan
    33 mins ago











  • @BlondeSwan You have been helping me/us to learn/know all this! So equally thanks to you :)

    – Jayant Das
    32 mins ago






  • 1





    Thanks Jayant. Much appreciated

    – Pranay Jaiswal
    22 mins ago
















5














You are most likely encountering ESLint errors in VS Code.



As an example below is how my code looks like with those warnings. However I am still able to save the component and utilize alert or console.log statements specifically for debugging purposes.



You can also choose to suppress those warnings by right clicking on those warnings



OR



By editing the .eslintrc.json available in your project by adding the below rules:



"rules": {
"no-console": "off",
"no-alert": "off"
}




Console showing errors



enter image description here





Option to disable the rules by right clicking on the alert



enter image description here






share|improve this answer


























  • +1. Thanks. I tried same in Illuminated Cloud for LWC, it showed SUCCEEDED_PARTIAL

    – Pranay Jaiswal
    46 mins ago






  • 1





    @PranayJaiswal I updated my answer to include how to add the rules in .eslintrc.json in VS Code.

    – Jayant Das
    40 mins ago











  • @JayantDas thanks. btw, thanks for all your help. I don't mean to be a bug asking all these questions, it's just hard finding documentation for non-aura components.

    – BlondeSwan
    33 mins ago











  • @BlondeSwan You have been helping me/us to learn/know all this! So equally thanks to you :)

    – Jayant Das
    32 mins ago






  • 1





    Thanks Jayant. Much appreciated

    – Pranay Jaiswal
    22 mins ago














5












5








5







You are most likely encountering ESLint errors in VS Code.



As an example below is how my code looks like with those warnings. However I am still able to save the component and utilize alert or console.log statements specifically for debugging purposes.



You can also choose to suppress those warnings by right clicking on those warnings



OR



By editing the .eslintrc.json available in your project by adding the below rules:



"rules": {
"no-console": "off",
"no-alert": "off"
}




Console showing errors



enter image description here





Option to disable the rules by right clicking on the alert



enter image description here






share|improve this answer















You are most likely encountering ESLint errors in VS Code.



As an example below is how my code looks like with those warnings. However I am still able to save the component and utilize alert or console.log statements specifically for debugging purposes.



You can also choose to suppress those warnings by right clicking on those warnings



OR



By editing the .eslintrc.json available in your project by adding the below rules:



"rules": {
"no-console": "off",
"no-alert": "off"
}




Console showing errors



enter image description here





Option to disable the rules by right clicking on the alert



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 33 mins ago

























answered 48 mins ago









Jayant DasJayant Das

15.2k2824




15.2k2824













  • +1. Thanks. I tried same in Illuminated Cloud for LWC, it showed SUCCEEDED_PARTIAL

    – Pranay Jaiswal
    46 mins ago






  • 1





    @PranayJaiswal I updated my answer to include how to add the rules in .eslintrc.json in VS Code.

    – Jayant Das
    40 mins ago











  • @JayantDas thanks. btw, thanks for all your help. I don't mean to be a bug asking all these questions, it's just hard finding documentation for non-aura components.

    – BlondeSwan
    33 mins ago











  • @BlondeSwan You have been helping me/us to learn/know all this! So equally thanks to you :)

    – Jayant Das
    32 mins ago






  • 1





    Thanks Jayant. Much appreciated

    – Pranay Jaiswal
    22 mins ago



















  • +1. Thanks. I tried same in Illuminated Cloud for LWC, it showed SUCCEEDED_PARTIAL

    – Pranay Jaiswal
    46 mins ago






  • 1





    @PranayJaiswal I updated my answer to include how to add the rules in .eslintrc.json in VS Code.

    – Jayant Das
    40 mins ago











  • @JayantDas thanks. btw, thanks for all your help. I don't mean to be a bug asking all these questions, it's just hard finding documentation for non-aura components.

    – BlondeSwan
    33 mins ago











  • @BlondeSwan You have been helping me/us to learn/know all this! So equally thanks to you :)

    – Jayant Das
    32 mins ago






  • 1





    Thanks Jayant. Much appreciated

    – Pranay Jaiswal
    22 mins ago

















+1. Thanks. I tried same in Illuminated Cloud for LWC, it showed SUCCEEDED_PARTIAL

– Pranay Jaiswal
46 mins ago





+1. Thanks. I tried same in Illuminated Cloud for LWC, it showed SUCCEEDED_PARTIAL

– Pranay Jaiswal
46 mins ago




1




1





@PranayJaiswal I updated my answer to include how to add the rules in .eslintrc.json in VS Code.

– Jayant Das
40 mins ago





@PranayJaiswal I updated my answer to include how to add the rules in .eslintrc.json in VS Code.

– Jayant Das
40 mins ago













@JayantDas thanks. btw, thanks for all your help. I don't mean to be a bug asking all these questions, it's just hard finding documentation for non-aura components.

– BlondeSwan
33 mins ago





@JayantDas thanks. btw, thanks for all your help. I don't mean to be a bug asking all these questions, it's just hard finding documentation for non-aura components.

– BlondeSwan
33 mins ago













@BlondeSwan You have been helping me/us to learn/know all this! So equally thanks to you :)

– Jayant Das
32 mins ago





@BlondeSwan You have been helping me/us to learn/know all this! So equally thanks to you :)

– Jayant Das
32 mins ago




1




1





Thanks Jayant. Much appreciated

– Pranay Jaiswal
22 mins ago





Thanks Jayant. Much appreciated

– Pranay Jaiswal
22 mins ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Salesforce Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f251270%2flog-to-console-in-a-lightning-web-component%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Anexo:Material bélico de la Fuerza Aérea de Chile Índice Aeronaves Defensa...

Always On Availability groups resolving state after failover - Remote harden of transaction...

update json value to null Announcing the arrival of Valued Associate #679: Cesar Manara ...