eslint not running in VS code - macos

I moved to a new machine (both macOs) with my two Javascript Projects, one npm package and one Meteor project. In the npm package eslint does not show any errors, whereas in the Meteor project eslint works as expected. On my old machine, there wasn't such a problem with exact the same package.json and .eslintrc and VS code version.
What I tried till now:
Adding these lines to settings.json of VS code:
"eslint.validate": [
        "vue",
        "html",
        "javascript",
        "js",
        "typescript",
        "javascriptreact",
        "typescriptreact"
    ],
I even copied the complete settings.json to the new machine
Installing eslint globally and uninstall it (neither brought the solution)
Updating eslint from 3.19.0 -> 7.1.0

Related

Visual Studio does not bundle SVGs when using npm link and a local version of my NPM package, but using the published cloud version is fine?

I have a MFE that is published as an npm package. The mfe is rendered inside a webview. I use Visusal studio to build local versions of the iOS app. When using regular npm install, the svg's get bundled and are fine, but when i use npm link to test my local changes, the are not bundled into the application output folder. There are two PNG's in the same folder that get bundled just fine in both instances. What could be causing this issue ?
Tried opening the resources folder of the built app with finder, confirmed the svgs are not in there.
EDIT: I noticed the two builds are trying to retrieve the svg from different file paths ? not sure why this would be the case
the build using npm link tries to get call to this path
file:///private/var/containers/Bundle/Application/?xxsxasx-xxxx-4D33-A6E9-xxxxxxxxxxxxxx/Redbox.iOS.app/825a932aef6026942803.svg
while the npm i build gets a 200 from this path
data:image/svg+xml, %3csvg width='24' height='24' vi … fill='%23007239'/%3e %3c/svg%3e
working (using npm i)
not working (using npm link)

Electron: Sharing the same project folder between macOS and Windows

Goal
I've read many Electron tutorials about app bootstrapping and build pipeline and had assumed that you could have a single project to handle a cross-platform action.
But after numerous failures in the packaging and build process, I finally realized that maybe my assumption is wrong.
Problem
Here is my desired workflow based on electron-forge:
1. Create app skeleton on Windows
yarn create electron-app my-app
cd my-app
yarn add my-dependency
yarn start
yarn make
This all went well. Now onto macOS
2. Transfer project to macOS for a ride
On macOS, running the app will lead to an error
cd my-app
yarn start
The error looks like this
$ yarn start
yarn run v1.22.4
$ electron-forge start
✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies: 1 / 1
✔ Launching Application
/path/to/my-app/node_modules/electron/dist/electron.exe: /path/to/my-app/node_modules/electron/dist/electron.exe: cannot execute binary file
error Command failed with exit code 126.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
So I blindly reinstall electron on macOS
yarn add electron
yarn start
yarn make
Things work fine on macOS.
Now back to Windows.
3. Travel back to Windows to double-check
This time. I got the similar problem as in Step #2. The Windows distribution now has the wrong Electron binary.
Findings
I found this file constantly getting overwritten even if I merge carefully when transferring project files between Windows and macOS.
my-app/node_modules/electron/path.txt
It contains a hardcoded path to Electron executable:
macOS
Electron.app/Contents/MacOS/Electron
Windows:
electron.exe
Workarounds
I could add pre-build steps against this by copying predefined metadata to the project folder depending on the current platform. But a hack like this sounds lame for a framework like Electron.
Question
So to me this metadata arrangement makes it difficult to share the same project between Windows and macOS. I can't imagine Electron developers working like this.
So What am I missing?
Basically, you shouldn't commit node_modules at all. Some post installation scripts may compile packages for a specific OS and the folder is usually huge.
Also, you shouldn't commit any result of a build, package or compile command. Typically, dist folders should be ignored.
Your repository should only contains code and configuration files.
The idea is that it makes no sense to commit these files and folders as you have all the required steps in order to reproduce the result on any machine: your windows computer, your macOS computer, your CI environment, etc. For example (these are pseudo-commands):
npm i or npm ci
npm run build
electron package
etc
So you should add all these folders to you .gitignore file:
# compiled output
/dist
/tmp
/out-tsc
/packages
# dependencies
/node_modules

IntelliJ Mac - LESS Compiling with Autoprefixer

I was using a file watcher in IntelliJ which automatically compiled my less files into css files. I added an argument to the file watcher which used the autoprefix plugin to add all the prefixes to the compiled css file.
I now switched from a windows machine to mac and I can't get it to work like this there. I installed the autoprefix plugin via npm: https://github.com/less/less-plugin-autoprefix
And I set everything like it was on my windows machine: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000659610-Autoprefixer-in-file-watcher
But now I only get the error message:
"Unable to load plugin autoprefix please make sure that it is
installed under or at the same level as less"
Same error occurs when calling the compiling with plugin from the command line. LESS compiling itself is working fine.
Does anyone has an idea what I'm missing? I'm pretty new on Mac so I don't know if I miss some environment variables or something? Or how can I check where the plugin is installed and where do I have to install it?
Thanks to an answer which seems to has been deleted in the meantime I found the solution.
The current autoprefix plugin needs an older version of less. It's not compatible with less 3.0.1.
After uninstalling less and installing version 2.7.3 with
npm install -g less#2.7.3
it is working again.
Found the solution here: https://github.com/less/less-plugin-autoprefix/issues/30

npm dependencies not updating in Visual Studio Solution Explorer

I have updated my package.json in my Angular SPA .Net Core Template.
I have then right clicked on the package.json file and selected 'restore packages'.
(I get the message installing packages and then installing packages completed in the bottom left hand corner of the program with no errors).
However, when I view the dependencies under the solution explorer they are still showing the old versions? (see the picture below);
Can anyone tell me how I can get the npm in the list to match please?
Go into cmd (preferably as administrator), navigate to the folder containing the package.json, then run npm install.
If you dont see packages updating, check for a package-lock.json file in either the same folder or one folder up and delete it. Retry running the npm install again and it should work.

PhpStorm cannot load project after running npm install

In my Laravel project I want to try use npm. After running npm install and restarting PhpStorm it stuck at loading project look like this:
And my Windows 10 CPU runs high. (the dialog can not be cancelled, I have to force close it)
I have tried this:
Setting -> Editor -> File Types -- added node_modules to "Ignore files and folders".
Setting -> Directories -- marked node_modules as Excluded Folder.
Both did not work!
I have stuck in this problem in a few days, hope somebody can take sometime to help me out!
PC: Windows 10 x64
PhpStorm 2017.1.2
node.exe: v7.6.0
It may be indexing the node_modules folder. You need to remove this from the project.
If you get it to open, you can do this in PHPStorm by right clicking the folder-> Mark Directory As -> Excluded.
You could delete the contents of the folder, then do this? You can just do an npm install again after.
Mick

Resources