Monday, March 13, 2023

Debugging JavaScript, Part 2

JavaScript Lint Alternatives

JSLint is a very difficult tool to use. It is very picky. The author is very picky and opinionated about what he considers good JavaScript vs. bad JavaScript. He even wrote a book called JavaScript: The Good Parts. Anyway, his tool is not very configurable for beginner use even though it has a lot of options. I have found some lint alternatives that you may like to try.

1. ES Lint Online

ESLint is primarily a tool that you use as an application you install on your computer. However, there is a "playground" version where you can paste your code into an online form.

2. Validate JavaScript

ValidateJavaScript is an online validating (or linting) tool that will automatically find basic errors and help prevent potentially destructive bugs in JavaScript and JSX (React.js) code. Copy and paste or directly input your code into the editor, click the 'Find & Fix Errors' button, and the tool will parse your code and list all errors allowing you to fix them systematically.

 

3. JS Hint

Simply enter some JavaScript anywhere on the page. Your report will appear on the right side.

 
4. Prettier

This is just a code formatter, but it can do wonders for indenting your JavaScript properly, which makes it easier to find many different kinds of bugs.

 

5. ES Lint VSC Extension

You can get ESLint in the form of an extension you can add to Visual Studio Code. Unfortunately, this requires that you have installed ESLint as an application on your computer. This, in turn, requires npm (Node Package Manager) to do the install. So if you don't have npm, you'd have to install that first. This sounds like a good option, but I haven't had time to install everything myself.

https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint 

 

No comments:

Post a Comment