vscode-standard icon indicating copy to clipboard operation
vscode-standard copied to clipboard

vscode-standard can't find ts-standard module in monorepo

Open eettaa opened this issue 3 years ago • 2 comments

What version of this package are you using? vscode-standard 2.0.1

What operating system, Node.js, and npm version? ubuntu 18.04 LTS node: v14.18.1 npm: 6.14.15

What happened? vscode-standard can't find ts-standard module in monorepo child directory

I have a monorepo project structure and would like to open the TLD in vscode but still have vscode-standard find an appropriate standard engine and tsconfig.json. The structure is:

/personal-path-to-monorepo-mount/monorepo-name
    .git
    /project1
      a.ts
      tsconfig.json
      node_modules/
        ts-standard/
      sub-projectA/
          subA.ts
          tsconfig.json
          node_modules/
              ts-standard/ (?)
    /project2
        b.ts
        tsconfig.json
        node_modules/
            ts-standard/    # I don't have ts-standard installed here but would happily consider doing it if that is part of the solution

I have tried using a multi-root workspace to solve this problem i.e. a monorepo-name/workspace.code-workspace file like:

    "folders": [
        {
            "path": "./"
        },
        {
            "path": "./project1",
            "name": "open nested dir to help vscode-standard find a standard engine (can ignore)"
        }
    ],

Bizarrely, this approach worked great in Aug and early September 2021 but then broke. I can verify that no code/config changed on my side by checking out that version of code. I assume it was related to a vscode-standard of a VS Code version update that changed behavior.

I have also tried a single-rooted workspace with standard.nodePath set to "./project1/node_modules". This does not work at all.

What did you expect to happen?

  • Some config or intelligent searching locates the desired module.
  • Every typescript file opened in VS Code is actively linted with the (a?) ts-standard engine.
  • Unknown: which tsconfig.json file should be used in which case. I could see an argument for a) a specified tsconfig.json or b) the tsconfig.json in the directory of the open file (fallback to parent directory/tsconfig.jsn, then grandparent directory, etc.)

Are you willing to submit a pull request to fix this bug? If I understand what the specific problem is, I will consider it.

eettaa avatar Nov 20 '21 21:11 eettaa

Any update on this issue? I have a similar issue where most of my workspace/repo is rust, but we have one directory with typescript that I would like to enable this extension for. The only way I have figured out how to do that is to open the TS folder as a project root in a new window. Would love to not have to do that. Thanks!

jakepearson avatar Jul 01 '22 16:07 jakepearson

You could set standard.enableGlobally but that means running standard/semistandard from npm -g installation of the packages. Indeed a shortcoming of the extension not being able to use multi-root Workspaces.

mcdado avatar Jul 22 '22 11:07 mcdado