alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
305 stars 236 forks source link

Enable JavaScript code autocomplete using `jsconfig.json` #2354

Open colinrotherham opened 1 year ago

colinrotherham commented 1 year ago

For recent contributions I've been running with a jsconfig.json file

It's helped me find and fix a few things but there's no necessity to merge

Code autocomplete

This PR will automatically pick up JSDoc annotations in IntelliJ, WebStorm, Visual Studio, Visual Studio Code and Sublime Text (via the TypeScript plugin) so you can see tooltips like:

JSDoc types in autocomplete

Code checking

Optionally you can enable "checkJs": true when needed as a good way to spot bugs

  {
    "compilerOptions": {
+    "checkJs": true,
      "module": "NodeNext",
      "resolveJsonModule": true
    }
  }