VSCode: how to disable warnings about deprecated Node.js features - javascript

I'm using VSCode for a Javascript project that runs in a browser JS engine; it will never and can't run in Node.js. But Intellisense quite dramatically warns about features in my code that are deprecated in Node.js. Is there a way to tell it, that this is not a node but a browser project to get only relevant warnings?
Strikethrough in code and warning in Intellisense popup

if you use eslint as linter. You can do it in the .eslintignore file in your root directory.
take a look here: disable the warnings in VS code

Related

Is there anyway to debug typescript using the ember cli with vscode?

I searched on stackoverflow and found this post:
How to debug Javascript-Code produced and served by ember-cli?
however, it was made in 2014 and I hope maybe some features were added or anything.
I am trying to place breakpoints in vscode in my typescript files. However, it doesn't seem to work at all, because the ember cli doesn't map ts to js files that it creates.
To enable sourcemaps for TypeScript files in Ember, you must configure Babel to use inline sourcemaps. See: Enabling Sourcemaps in the ember-cli-typescript docs.

Using babel-standalone in the browser

I am using babel-standalone and I am doing the exact same thing as https://github.com/Daniel15/babel-standalone/blob/master/examples/scriptTag-src.htm, but I get the warning
You are using the in-browser Babel transformer. Be sure to precompile your scripts for production - https://babeljs.io/docs/setup/
I don't know what to do. Shouldn't it just translate all my ES6 code to code supported by older browsers?
It's just a warning, nothing to worry about.
It's just telling you that you shouldn't run Babel in the browser on production sites, because running Babel in the browser is slower than precompiling your files with Babel, because the browser will have to compile your files every time you open a page. But if you're running it for development or personal pages, or if you just don't care (e.g., you don't have that much code), you won't need to worry about this warning.

Developing TypeScript without an installed IDE or editor

I work in a place that restricts me from downloading and installing any applications, regardless of job roles. I have several web apps that I want to migrate to Angular 2 with TypeScript. I'm a C# developer in my own time and TypeScript is very appealing as it's statically typed and just compiles down to JavaScript.
How can I develop with TypeScript without having access to an installed IDE or code editor? Are there any online environments that allow the use of TypeScript definition files that provide code help/intellisense?
How can I develop with TypeScript without having access to an installed IDE or code editor
I am hoping you can do npm install typescript. If you can just run npm install typescript -g and then run typescript as tsc -w -p tsconfig.json in your code directory. This will allow you to run the compiler in the background leaving you free to use even notepad if you have to.
Alternatively you can just download the zip file from : https://github.com/Microsoft/TypeScript/releases and if you have node you can run node ./bin/tsc etc from the extracted directory.
Use Codenvy:
It needs some manual tweaks but somebody figured them out already: https://groups.google.com/a/codenvy.com/forum/#!topic/codenvy/R4myXA9MygA
You can try the playground: http://www.typescriptlang.org/Playground
Although it doesn't allow references to other files.

Is there an "immediate window" in Visual Studio Code to run Javascript?

Yes, I use F12 in the browser all the time to test out Javascript snippets with the console. I'm tired of that (for the moment anyway).
I've read that in Visual Studio you can use the immediate window to run Javascript interactively.. I've haven't tried it that hard. I think when I did it told me it can't evaluate while in design mode... ugh, what a pain.
I do like to use Visual Studio Code (sublime text historically) sometimes to just mess around with syntax of snippets. Would also be nice if I could just run Javascript there too quickly. Is there a package I could download in VSCode to do so? Or something already built in?
As of (at least) my current version of VS Code (1.5.2), the "Debug Console", while debugging, lets you run arbitrary JavaScript code as you would in the VS Immediate Window. (Similar to as you would for the Chrome Dev Tools Console.)
There is no Immediate Window unlike Visual Studio in VSCode. But you can still execute Javascript in VSCode.
Install the Code Runner Extension - https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner
Open the JavaScript file in VSCode, then use shortcut Ctrl+Alt+N, the code will run and the output will be shown in the Output Window.
I've found this extension that makes a scrathpad for JS, that runs at the same time as you are typing: https://quokkajs.com/
Works on VS Code, Jet Brains, and Atom.
If you don't want to start a debugging session or installing an extension, a simple way to have a JavaScript console is to start Node in a Terminal.
View -> Terminal
Start node (without any argument -you'll need node in your PATH)
Now you have a repl with auto-complete and value preview.
It doesn't have the features of the Chrome Console, but I find it good enough for evaluating JS code while I'm working.
Run the command node in the terminal below the editor, this will create a node environment where arbitrary JavaScript can be entered. You must first have node (and apparently npm) installed from nodejs.
This might do it: https://code.visualstudio.com/Docs/runtimes/nodejs
Node.js is a platform for building fast and scalable server applications using JavaScript. Node.js is the runtime and NPM is the Package Manager for Node.js modules.
To get started, install Node.js for your platform. The Node Package Manager is included in the Node distribution.

Debug JavaScript code in Visual Studio bundled with WebPack

I'm new to JS development and experience issues with debugging JS code in Visual Studio 2013. JS part of our web app is bundled into a single app.bundle.js file by WebPack, this file is automatically updated everytime any js file changes (we use special watch script which uses npm).
I'm able to debug JS code using Chrome and debugger; derecitve. It shows correctly mapped file under such kind of paths "webpack:///./Scripts/". It means that WebPack creates mapping correctly. But I'd like to debug directly from VS using Call Stack, break points, etc.
Any ideas?
Thanks in advance!
There is a a series of ongoing issues with Debugging webpack bundles Visual Studio. Depending on your webpack configuration and your dependency versions, this Webpack plugin may work for you. Be sure to check out the issues where can you see the ongoing conversation. If you are doing anything with Babel / ES2015+, you probably will want to upgrade to Visual Studio 2015 for syntax support.

Categories