Atom TypeScript linting in .js files

We have two options to fix this problem in Atom.

First and most important you need to tell the TypeScript service to consume JavaScript files like so:

jsconfig.json

{ "compilerOptions": { "allowJs": true, "checkJs": true } }
Code language: JSON / JSON with Comments (json)

Solution 1

Create a symbolic link like so:

ln -s tsconfig.json jsconfig.json
Code language: CSS (css)

Atom will read the jsconfig.json file and everybody will be happy.

Solution 2

A preferable solution, so you don't have to remember to create a symbolic link every time you checkout this project and want to use Atom, is to simply rename the tsconfig.json file to jsconfig.json file.

It works on Atom, Visual Studio Code but not WebStorm. At least at the time of this post.

jsconfig.json

{ "compilerOptions": { "allowJs": true, "checkJs": true } }
Code language: JSON / JSON with Comments (json)

Example

Use the following code to test your changes.

/** * myFunction * * @param {string} param1 * @returns {boolean} */ function myFunction(param1) { return param1.name; // Error here }
Code language: PHP (php)

Resources

Leave a Reply

Add <code> Some Code </code> if you need to.

*
*