Is there a way to automatically fix all ESLint errors in Visual Studio? - visual-studio-2017

Opened up an old javascript file in a project I'm working on, and there are well over 100 ESLint warnings and errors. Stuff like
Missing semicolon
Unexpected trailing comma
Expected '===' and saw '=='
Is there a way to automatically fix all these errors at once? Or do I have to go through and manually fix each one by hand?

A slight change to the answer to work -as in my case it didn't- would be adding the directory which has the js files which you want to apply linting to, or the file itself .
npm i -g eslint
eslint --fix .
OR
npm i -g eslint
eslint --fix file.js

you can use eslint cli directly which would be faster, just run eslint --fix in the terminal
just make sure you installed eslint globally npm i -g eslint

Related

WebStorm isn't allowing me to put a project on GitHub

So I'm using WebStorm and trying to put a project on GitHub, but every time I select "Share Project on GitHub" from the VCS menu, I get the following error message:
Errors while executing git --version. exitCode=1 errors: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Now, at the time of writing this I'm not even positive that I linked my WebStorm to a GitHub account. Would this message be related to that if I don't? If so, where would I go to check if I linked it?
Please open try running
xcode-select --install
In your OS terminal - this will download and install xcode developer tools and fix the problem. The problem likely is that one needs to explicitly agree to the license agreement.
see Command Line Tools not working - OS X El Capitan/macOS Sierra/macOS High Sierra:

Xcode 9.4.1 Could not build module and redefinition of module - Can't Build

Encountering this issue in Xcode, solutions I've tried:
Enabled modules to YES and NO
Reinstalled Xcode 9.4.1 by deleting 9.4.1 and ~/Library/Developer
Downgraded command lines tools to 9.4.1
Downgraded Cocoapods to 1.4.0 from 1.5.3
I'm at a loss at this point can someone point me to the right direction here? I've already spent an entire day on this. Other projects build fine though.
I SOLVED IT!
XCode was adding the following Header Search Paths:
/usr/include/libxml2 recursive
/usr/include/libxml2 non-recursive
But libxml2 is already included in the SDK from XCode.app via $(inherited) search path so everything was conflicting.
Removed those two /usr/include/libxml2 paths at the top of my folder hierarchy fixed it!
Thank the XCode gods.
Error: redefinition of module
I got redefinition of module when was working on own framework and added a first .m file (as a part of Cocoa Touch Class) and created module.modulemap file. Please note that this error is shown even if you do not add a path into Module Map File
To solve this issue I just renamed a module.modulemap to ModuleName.modulemap
Try removing Command-line tools and build your project
sudo rm -rf /Library/Developer/CommandLineTools
To Reinstall:
xcode-select --install

How do you compile V8 with Visual Studio?

I've been trying to compile V8. I've obtained a copy of the v8-master folder from GitHub, but I can't figure out how to compile it. A lot of the documentation I could find online are conflicting.
From what I've gathered, it appears as if my best chance of getting it to compile (out of the various methods I've found, though I couldn't get any of them to work) is to create the project files by calling the gyp_v8 script (located in the build folder of v8-master). But it simply gives me File "gyp_v8", line 86 print 'Error running GYP' SyntaxError: Missing parentheses in call to 'print'. From there, I tried to install Gyp (since according to the documentation, I'm led to believe that's what's causing the error). That required me to install depot_tools and do gclient sync. That failed with the error Error: client not configured; see 'gclient config'. And gclient config fails with the erropr gclient.py: error: Inconsistency arguments. Use either --spec or one or 2 args.
Honestly, I'm lost at this point. Is there any way I could just use CMake or something? Or at least a build tutorial that doesn't assume you have a bunch of Google-specific build tools involved?
Confirm Git is installed. git 2.2.1+ recommended.
Temporarily, disable Windows Indexing.
Install "Microsoft Visual C++ 2008 Redistributable Package"
Run bat file as administrator
Bat file:
#echo on
CD /D %~dp0
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
SET DEPOT_TOOLS=%CD%/depot_tools
SET PYTHONHOME=%DEPOT_TOOLS%/python276_bin
SET PYTHONPATH=%CD%/v8/build/gyp
SET PATH=%DEPOT_TOOLS%;%PYTHONHOME%;%PATH%
SET GYP_DEFINES=target_arch=x64
REM SET GYP_DEFINES=target_arch=x64 component=shared_library v8_use_snapshot=false
REM About GYP_DEFINES: https://github.com/v8/v8/wiki/Building-with-Gyp
IF EXIST %DEPOT_TOOLS% (
ECHO Updating depot_tools
CD %DEPOT_TOOLS%
CALL git pull
CD ..
) ELSE (
ECHO Getting depot_tools
CALL git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
)
CALL gclient
CALL gclient config https://chromium.googlesource.com/v8/v8.git
CALL gclient sync
I've previously built V8 from source for Visual Studio 2010 and then for Visual Studio 2013. Very time consuming tasks in both cases. However for Visual Studio 2017 I found that the headers and prebuilt libraries are available from NuGet. I no longer needed to build from source.

How to build cmake-project with atom text editor?

I've installed packages build and build-make, and it's not obvious what to do next.
Build-tools package is bugged and impossible to install now.
I have cmake project, sucsessfully build in different IDE: QTCreator, VisualStudio, via bash. So i want to make it with atom, and there is no instruction how to use it's build-make package. Documentation to this package is empty.
in bash i call: cmake ../src from my build dir.
So in .atom-build.json i put this command and point directory as working - and nothing happens, on f9 i've god "Cannot read peoperty "exec" or undefined"
Actually, there is a cmake package for Atom.
Here you go:
https://atom.io/packages/build-cmake
Firstly, CMake and make are two different things.
What you are looking for is a CMake plugin for Atom, of which there are currently none. (Some for syntax highlighting but none for running graphically...)
If you have CMake working in other IDEs then you shouldn't have a problem running CMake from the command line:
cd /path/to/project
cmake .

using CMake to build Google Test

I am trying to use CMake to build Google Test.
As mentioned in the README of Google Test,
I have issued following commands:
mkdir mybuild # Create a directory to hold the build output.
cd mybuild
cmake D:\gtest-1.6.0 # (in the README this was set as:cmake ${GTEST_DIR}, but since on my machine D:\gtest-1.6.0 is where I have downloaded gtest, I have used that in command prompt.
And here is the error I get:
Any help? any help would be greatly appreciated as I am stuck with it and can't move forward...... Thanks.
ps. I have Visual Studio 10 installed on my machine.
If you use Visual c++ compiler with cmake you must launch it from the Visual c++ command prompt. Otherwise cmake will not found your compiler.