stib
stib

Reputation: 3512

How to get eslint to validate Adobe Extendscript (.jsx) files in VSCode

I'm trying to write extendscript scripts for Adobe After Effects, using VSCode. I'd like to get some linting happening (not too fussed if it's ESLint or any other linter), but I can't convince ESLint to lint my files.

Extendscript is a dialect of the ECMAScript standard and therefore similar to JavaScript and ActionScript. The files have the extension .jsx. There are some extendscript plugins for VSCode, this one provides language support, so that VSCode sees my .jsx files as extendscript files. So I was hoping that this would work in my settings.json:

{
  "eslint.options": {
    "extensions":  [".jsx", ".js"]
  },
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "extendscript"
  ]
}

If I try the command ESLint.ShowOutputChannel I get the error:

ESLint is not running. By default only JavaScript files are validated. If you want to validate other file types please specify them in the 'eslint.validate' setting.

edit I also tried replacing "extendscript" in line 10 with

{ "language": "extendscript", "autofix": false }

But no luck.

Upvotes: 3

Views: 1110

Answers (2)

Lourenzo Ferreira
Lourenzo Ferreira

Reputation: 180

This worked for me:

{
  "eslint.options": {
    "extensions":  [".jsx", ".js"]
  },
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "jsx"
  ]
}

Looking on the github repo for the Extendscript Language, I've found out that the language id is registered as jsx, instead of extendscript.

Upvotes: 3

jherax
jherax

Reputation: 5267

I think your user/workspace settings are OK. Maybe you are missing having installed ESLint?

If you are working on a workspace, you should have installed eslint in your package.json

npm i -D eslint babel-eslint

If you just want VS Code lint always your files, you can install eslint as global package:

npm i -g eslint babel-eslint

After that, you should initialize eslint

eslint --init

See more examples and documentation for eslint cli

Upvotes: 1

Related Questions