Visual Studio: Cleaning up abandonent javascript functions - javascript

I have a web application in visual studio, it has several JavaScript, jQuery files, third libraries and custom files.
I am looking for any tool which will help me remove methods are not called anywhere. This is for custom code files added by another coder.
Current Approach
Copy function name - search for it, and remove methods manually.

Related

Guide for extending the Javascript language on VsCode for a 3rd party API

So I've started using VsCode over Atom recently and love it, the issue is I develop for software that uses its own JS API with no proper integration into anything.
I've started trying to implement my own autocomplete/intellisense structure using their pdf into VsCode to speed up my workflow, currently I'm simply using a JS file that is full of empty functions and objects with a bunch of JSDoc comments to help VsCode Intellisense identify what's what, that seems to be working fine so far but it means importing this "useless" file into every project I work on.
I looked into extending the JS language using a language server but that seems way too complex for what I need (plus it looks like I'd be building the entire Javascript language from scratch).
Does anyone have any recommendations ect?
Kind regards.
Edit
Sorry I also would like the ability for it to pass linting as right now it gets a bit funky with it.
You likely do not need an extension for that your example use case.
VS Code's intellisense for libraries is powered by .d.ts typing declaration files. The declaration files for the library you are using can either be written in your current workspace as you are currently doing, or—preferably—shipped with the library itself. Many npm modules ship their with typing definitions files, while other libraries have typing definition files provided by the community through DefinitelyTyped.
You alternatively bundle d.ts types file into as a separate npm package that you include in any project that needs them

Android and Web App sharing Kotlin code

One of the major “selling” points of Kotlin appears to be its ability to compile both to JVM or Android and to JavaScript for the web. To make use of this, it should be possible to have a code base where some files are shared between an Android App and a browser Web App.
However, so far I found little details on how such a thing would be set up, in particularly when working with Android Studio and its underlying Gradle setup, starting from a a run of the Android Studio New Project Wizard. I don't mind if I can only build the Web App on the command line, but I'd like to maintain the Android debugging hookups that Android Studio provides. So far I know very little about Gradle and typical idioms for its use.
I'm sure that I'm not the first person to have this idea, so I'd like to know some best practices on how to set this up. Questions that come to my mind include the following:
Do I mix the kotlin2js and the kotlin-android plugin in a single build file, or do I need to have multiple build files (perhaps I should say “modules” or “projects” except I don't know which)?
If I have multiple build files, should that be two (one Android one Web) or three (one more for shared things)?
If it is two build files, how do I reference the shared sources?
If it is three build files, which plugin(s) do I use for the shared one?
Do I need to split my sources over three different source trees? Are there any conventions how these should be called?
Do I need to split my classes into three groups of packages, or can code for different targets coexist in the same package?
What configuration settings do I need to tweak to make the IDE aware of the layout of my project?
I've read the following relevant documentation, among other:
https://kotlinlang.org/docs/reference/using-gradle.html
https://docs.gradle.org/current/userguide/intro_multi_project_builds.html
https://docs.gradle.org/current/userguide/composite_builds.html
https://kotlinlang.org/docs/tutorials/kotlin-android.html
I would recommend using IDEA wizard to create a simple multiplatfrom project for you (File -> New -> Project -> Kotlin -> Kotlin (Multiplatform - experimental) ). Community edition should suffice.
Answering your questions:
You don't mix plugins. You create a separate module for your common code and use 'kotlin-platform-common' plugin for it.
Three modules, special plugin 'kotlin-platform-common'
Use common sense for source splitting. Put whatever you want/able to reuse in the common code. Put platform-specific code in platform modules.
No package restrictions. You can put everything in the same package if you so desire =)
Pretty sure it should just work. If not, try re-importing.

How to create a truly blank project in Visual Studio (2017)

It seems like there should be a way to do this, but I just can't seem to do it. I love VS and I want to use it to develop web apps that are strictly HTML/Javascript based. In other words, no C#, no VB, no resulting /bin folder, no web config, no nothing. A blank project meaning "truly 100% blank" and not trying force me into some Microsoft technology or otherwise. I just want to use VS to write the code because it's still the best HTML/Javascript/Typescript/Everything-else-script editor out there.
Any thoughts on this? Can it even be done? Or is VS just too dependent on "Microsoft thinking" to allow this?
What you have described is indeed possible in Visual Studio 2017 Community.
Step 1) Create a new Project via File / New / Project
Step 2) Select Other Project Types / Visual Studio Solutions / Blank Solution.
Step 3) Right-click the newly created solution and select Add / New Solution Folder. This step may not seem important, but it seems that files cannot be added directly to a solution without first creating a "Solution Folder". This solution folder is virtual in that it does not correspond a physical folder location.
Step 4) Now right-click the newly created Solution Folder and select Add / Existing Item.
Step 5) Insert all the files you want to add. These may be added via the menu option in Step 4 or otherwise drag-and-dropped onto the solution folder (not the solution itself!).
Notice that even after creating the new solution and adding files, the only things created by Visual Studio 2017 are the usual .vs internal folder and the solution file itself.
I haven't heard or found a template online that will do this. I'm assuming you meant just HTML, JS/TypeScript, CSS/SASS etc. without .NET for "truly blank". Me I just delete the files I don't use :)
It seems that what you want is to start with an empty canvas like Blank Solution and then add your files in the solution. You don't actually need to have library/console/web projects in a solution, you could just have html and js and whatever you use for web development.
You can find the Blank Solution when you create a new project under the Other Project Types tab.

Exclude Javascript function within a (TFS) build

Hello I got a question regarding including or excluding specific contents of my JS file within my C# project. I developed a new JS functions which is still under development and it is based in my library.js file. Within C# you can set build flags in order to say which sections should be included whenever a build is running. FYI I am using TFS to build.
Now I was wondering is there a way within Visual Studio or TFS or some other mechanisme where I can say that a particular piece of code within my library.js file should not be included within my build? Like I can do with build flags within my C# code.
Perhaps I can use some prebuild steps or trying to come up with some JS code which check the current active buildflags?
Anyone have any ideas? I know that removing the code will solve it but that is not what I am looking for.
On TFS side, TFS build has the capability to map or cloak file, but doesn't has the feature to exclude a piece of code within a file. An easy way from TFS side is to use TFS branch to develop your own feature.

Detect duplicate code within ASP.NET MVC project in Visual Studio

Is there any way at all to detect duplicate code within ASP.NET MVC project in Visual Studio 2013 Professional???
I want to detect duplicate JavaScript functions within the cshtml files in the Views.
I've been searching forever and can't find a viable solution.
Our JavaScript CloneDR code duplication detector should be able to do this. (This obviously isn't part of VS 2013.)
Its parser can read plain Javascript, and/or html-like pages that contain JavaScript chunks in Script tags, and/or HTML script attributes (e.g., OnXXX= ). You can hand it lots of files and it will find clones across the files.
You can see examples of what it detects at the link.

Categories

Resources