How can I solve the prettier/prettier problem - eslint

I'm using nuxtjs, and I installed eslint on my project, and upon using npm run dev, I get a bombardment of errors. How can I fix this:

This error is related to Windows Line endings being different from Unix ones. Try running npx prettier --write . on your project's directory. This command will tell prettier to fix simple errors (such as this one) when found.
To prevent this error from happening again you can either set "end-of-line" to auto on your .prettierrc file or try setting line endings to "Unix"/LF on your editor: instructions for VSCode and for IntelliJ-based editors

Related

eslint Expected linebreaks to be 'LF' but found 'CRLF'. in a huge file

I have started working in a team. They have a huge file, I cloned the project and I am getting "Expected linebreaks to be 'LF' but found 'CRLF'." error after running "npm run build". (I am on windows)
There are around 50 .eslintrc files. How can I fix this error without changing any files?

ESLint print all fixes to terminal

When I run ESLint with the --fix flag, I'd like for the changes made to be output to the terminal. By default it displays no output except for errors or warnings that cannot be fixed, as the ESLint docs say:
The fixes are made to the actual files themselves and only the remaining unfixed issues are output.
Is there any way to force ESLint to print all the issues that were fixed to the terminal?
For the sake of clarity, here's the command I'm currently running: eslint src --fix --ext js,ts,tsx.

svgr Unknown command line option: '--ext' in azure devops pipeline

Developing locally on a Mac, I have this as an npm script in package json:
npx #svgr/cli --template path/to/template.js --ext .tsx my-icon.svg
This works as expected.
However, the Azure DevOps pipeline build fails when this script is run with the message Unknown command line option: '--ext'
It's not running in a container, so I assume it's running in a windows environment and that has something to do with this error.
--ext tsx is a valid command line argument; like i said it works in a unix environment (*macbook pro)
Any idea how to get around it?
So far I've tried the extension to the config file, but that particular option is only available through the cli.
I had a similar problem, but with GitHub actions, and my solution was to use
./node_modules/.bin/svgr --template path/to/template.js --ext .tsx my-icon.svg
Not sure if it will work in your case, though.

ESLint does not work in VSCode

I have a global install of ESLint via npm. I can successfully lint a file from the command line, but not from within VS Code. I have followed the instructions to use ESLint within Visual Studio Code, but it fails to work. I do have an eslintrc file. I have also uninstalled and reinstalled eslint a number of times.
VS Code does not produce any error message, it just does not lint the file. I was able to use JSHint very easily, but even though the ESLint installation seems similar, it just does not work. I am just a student, and don't know what other details may be helpful. I'm happy to provide any additional information needed.

Error code: 800A1391 Source: Microsoft JScript runtime error Running Grunt - Module is undefined

New Grunt user here who is using a lot of new tools (npm nodejs) today.
I've got Grunt "installed" and have been able to create a grunt.js file using the init task as described here: http://net.tutsplus.com/tutorials/javascript-ajax/meeting-grunt-the-build-tool-for-javascript/ and here: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md. But whenever I run the "grunt" command I get an error:
Windows Script Host
Script: c:\users\[]\Documents\code\grunt\grunt.js
Line: 2
Char: 1
Error: 'module' is undefined
Code: 800A1391
Source: Microsoft JScript runtime error
As explained in the FAQ, you need to type grunt.cmd instead on Windows because the OS tries to launch grunt.js
Or you can install grunt-cli globally instead. This package will run any version of Grunt if it's been installed locally to your project.
SOLVED !!
So, this problem occur because windows by default associative < *.js > files
with >>
"Microsoft Windows Based Script Host".
grunt need to open by default with (grunt.cmd).
it easy to slove, by change default app (open with..)
Guide :
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any javascript IDE ).
PROBLEM SOLVED ! :)
good luck
If you're getting a "Microsoft JScript runtime error" that means that node.js isn't even getting invoked; instead Windows Script Host is trying to run your code. That's probably a problem with filetype associations; IIRC Windows defaults to trying to execute a ".js" file with WSH. You may wind up having to create a shortcut to your script, specifying a command line (probably something like "node %1") and a starting directory in order to make sure that it's executed properly.
It would help if you could tell us exactly how you're trying to invoke your code.
it seems that in the latest versions of the grunt modules, you would have to do the following to have it work under windows:
remove any globally installed grunt
npm uninstall -g grunt
install grunt-cli globally
npm install -g grunt-cli
install grunt locally into your project
npm install grunt
installing grunt (v0.4.x) globally does not seem to create the necessary grunt.cmd anymore. it seems that the recommendation is now to have grunt installed locally to be able to use version-specific Gruntfiles
As Florian F suggested, running grunt.cmd works. This is because of the process Windows is looking for your grunt command.
When typing grunt -h Windows will proceed to look for the following files:
./grunt.cmd
./grunt.* (grunt.js is found in this case which is why you see "module is undefined")
%APPDATA%/npm/grunt.cmd
An alternative to using "grunt.cmd" is to use grunter which simply renames the command to grunter... then you no longer have this problem.
To answer this, first we need to understand that the error is caused because it is being executed by Windows Script Host.
Now, run the code from your cmd promt with the following syntax:
>node <application_name>.js
this will allow the Node.js application to open through V8 JavaScript engine(Google's).
P.S: Please reply back if this has helped in resolving your issue else post the problem you are facing after trying this.
I had a similar issue, the problem is file association, I would recommend:
right click on a .js file and choose open with.
then you choose nodejs/node.exe (somewhere in "program files" folder
then make tick box where it says "always open .js files " (paraphrasing)
That should do the trick.
I went through the same issue when running an old Node project.
The issue was with the name of the js file, it was node.js. So the while running the command node node.js, it was opening up a windows dialogue box.
I just changed the name of the file to app.js and the error flew away.
So, in my case i had tryed all the mentioned above with no result.
But i have fund that im dont type: node in the full sentence as the following snipet
node script.js.And remember never understimate your own miscoding.
Solution:
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any Javascript IDE like VS Code ).

Resources