microsoft / vscode-typescript-tslint-plugin

VS Code extension that provides TSLint support using the typescript-tslint-plugin
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin
MIT License
188 stars 34 forks source link

Whitespace error in JSDoc #24

Closed eppsilon closed 5 years ago

eppsilon commented 5 years ago

Hi,

I'm seeing a "missing whitespace" error with code that looks like this:

const SOME_CONSTANT = 10;

/**
 * Maps an array of items to an array of their names.
 * @param arr A list of items.
 */
function func(arr: { name: string }[]) {
  return arr.map(item => item.name);
}

The error is on the first letter of arr in the JSDoc comment. Strangely it goes away if I remove the constant.

mjbvz commented 5 years ago

I believe this is a tslint bug. Do you get same error running tslint from the command line?

What versions of tslint and typescript are you using?

mjbvz commented 5 years ago

Actually I can hit something like this if I have TS 3.1.4 installed in a workspace but an using VS Code TS version 3.2.0-rc. Potentially caused by Tslint using the wrong TS version

eamodio commented 5 years ago

@mjbvz Yeah, I am seeing the same thing with almost the same setup -- TS 3.1.6 but vscode using TS 3.2.0-rc

mjbvz commented 5 years ago

One case seems caused by:

        "whitespace": [
            true,
            "check-type"
        ]

for code like:

interface I {
    x?: number;
}

TSLint wants it formatted as:

interface I {
    x? : number;
}

Can't repo this using the command line version of TSLint yet, even installing 3.2.0-rc in workspace

eamodio commented 5 years ago

Yeah, also:

        "whitespace": [
            true,
            "check-rest-spread",
        ]

wants code like:

...args

to be:

... args

And it doesn't matter if check-rest-spread is specified or not

mjbvz commented 5 years ago

Upstream issue. This was supposed to be closed by https://github.com/Microsoft/typescript-tslint-plugin/commit/ee48c7f9e334440fb4a4ea9f3bbce423db360a15