axilleasiv / vscode-javascript-repl-docs

JavaScript REPL is a javascript playground for Visual Studio Code with live feedback as you type, besides your code
67 stars 5 forks source link

Strict mode "use strict" #29

Open bjornet opened 3 years ago

bjornet commented 3 years ago

I'm trying to run the REPL with strict mode "use strict" which seems to break the inline evaluation.

How to reproduce

What is expected to happen

What is actually happening


I'm unsure if this is a bug or if it is a lacking feature.. anyways, it would be quite useful to be able to run the REPL in strict mode. Let me know if I misunderstood anything.

axilleasiv commented 3 years ago

Hi @bjornet, I am sorry that you are having this issue. This is a known missing feature that I would like to support at some time. I haven't yet investigated how much time I need to implement this but I think that one of the next versions of the repl extension could support the use strict mode. So I will mark this as a feature request and I will let you know when it is ready.

Thank you so much for your feedback and feel free to post again if you have any other issues or questions.

bjornet commented 3 years ago

Ah i see. Thanks again.

mån 7 juni 2021 kl. 21:34 skrev Achilleas Kiritsakas < @.***>:

Hi @bjornet https://github.com/bjornet, I am sorry that you are having this issue. This is a known missing feature that I would like to support at some time. I haven't yet investigated how much time I need to implement this but I think that one of the next versions of the repl extension could support the use strict mode. So I will mark this as a feature request and I will let you know when it is ready.

Thank you so much for your feedback and feel free to post again if you have any other issues or questions.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/axilleasiv/vscode-javascript-repl-docs/issues/29#issuecomment-856201826, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMKNI3C7AQUP53V57C3KLTRUNL3ANCNFSM46BS47BQ .

imjordanxd commented 3 years ago

also experiencing this, but in a TS repl

Evertt commented 1 year ago

This also happens for me, but I don't even have "use strict" in the repl file, so I don't know why that directive is even activated...

VimCommando commented 1 year ago

This is super easy to trip into on a Typescript projects.

Check your tsconfig.json and see if "compilerOptions.strict": true is set.

image
EvanLovely commented 1 year ago

This is super easy to trip into on a Typescript projects.

Check your tsconfig.json and see if "compilerOptions.strict": true is set.

That was what was happening to me; thanks for calling it out! Anyone know of a way to override my tsconfig.json settings for saved REPL files?

niieani commented 1 year ago

You can keep compilerOptions.strict: true, you just need to set compilerOptions.alwaysStrict: false. But yeah, this should be fixed. Ideally the extension should remove 'use strict' before executing the file internally.

jpshack-at-palomar commented 2 weeks ago

@niieani's suggestion works for me! added to tsconfig.json in project root directory :

{
  "compilerOptions": {
    "alwaysStrict": false
  }
}