ananthakumaran/tide

jsconfig fallback

LionyxML opened this issue · 2 comments

Currently, VSCode provides typescript mode behind the scenes even for pure JS projects, this allows some level of warnings, auto-complete and linting people are getting used to.

While I agree jsconfig.json in root folder is a really neat addition, I happen to get myself doing it repo by repo and in a lot of cases gitignoring this file since (not so nice) maintainers do not accept it :/

So, is it possible to have a fallback jsconfig file for when tide-mode is issued in a project without one? Like a config variable with this inside:

{
  "compilerOptions": {
    "target": "es2017",
    "allowSyntheticDefaultImports": true,
    "noEmit": true,
    "checkJs": true,
    "jsx": "react",
    "lib": [ "dom", "es2017" ]
  }
}

If it is already possible, ok :) if not, this might be a cool feature.

Thanks!

When submitting issues to this project, please include the following information.

Checklist

  • I have searched both open and closed issues and cannot find a duplicate.
  • I can reproduce the problem with the latest version of the relevant packages.
  • The problem still occurs after I issued M-x tide-restart-server in the buffer where I had the problem.
  • I verified that the version and the configuration file path reported by M-x tide-verify-setup are correct.
  • If tide is reporting an error or warning I think should not be reported, I can run tsc (and tslint, if applicable) without the error or warning I'm seeing in tide.
  • If tide is not reporting an error or warning I think should be reported, tsc (or tslint, if applicable) reports the error or warning I was expecting to see.
  • I am positive the problem does not belong to typescript-mode or tsserver.

Relevant Version Numbers

  • Tide: 20220314.930
  • TypeScript: any
  • Emacs: 29

(The list above is minimal. Make sure to include any other version numbers relevant to your report.)

Steps to Reproduce the Bug

Not a bug.

Expected Behavior

A fallback when JS projects do not have jsconfig.json file.

Actual Behavior

It is mandatory have a jsconfig.json file.

jsconfig.js requirement comes from tsserver, not from tide. Similar requests have been raised multiple times and discussed in detail.

You're totally right, sorry for hassle. Thanks!

I think my searching skills had failed me again :)

I'll have to re ready everything again to understand why I cannot do something like:

(defun setup-tide-mode ()
  (interactive)
  (when (or (locate-dominating-file default-directory "tsconfig.json")
            (locate-dominating-file default-directory "jsconfig.json")
            **(something something pointing to ~/.emacs.d/tide/defaults/tsconfig.json))** 
    (tide-setup)
    (flycheck-mode +1)
    (setq flycheck-check-syntax-automatically '(save mode-enabled))
    (eldoc-mode +1)
    (tide-hl-identifier-mode +1)
    (company-mode +1)))

Closing it.