Skip to content

[Discussion] Enable stricter TypeScript checks #1208

@nx10

Description

@nx10

Is your feature request related to a problem? Please describe.

There are currently no additional TypeScript checks enabled in .tsconfig (https://github.com/REditorSupport/vscode-R/blob/master/tsconfig.json).

Using strict-mode in TypeScript is recommended: https://www.typescriptlang.org/tsconfig#strict

Opting out on a per-case basis via // @ts-ignore or foo as FooType should be preferred to indicate to other developers that a statement is not an error but a conscious decision.

Describe the solution you'd like

The VSCode Python extension (see) uses the following settings:

    "compilerOptions": {
        "strict": true,
        "noImplicitAny": true,
        "noImplicitThis": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "noFallthroughCasesInSwitch": true,
    },

Enabling the options below shows quite a number of errors:

> yarn run compile
Found 302 errors in 32 files.

Errors  Files
    16  src/completions.ts:35
    16  src/extension.ts:35
     2  src/helpViewer/cran.ts:83
     2  src/helpViewer/helpProvider.ts:301
     6  src/helpViewer/index.ts:175
     3  src/helpViewer/packages.ts:85
    11  src/helpViewer/panel.ts:72
    15  src/helpViewer/treeView.ts:68
     6  src/languageService.ts:42
     2  src/lineCache.ts:30
     3  src/lintrConfig.ts:12
     5  src/liveShare/index.ts:21
     2  src/liveShare/shareCommands.ts:80
    11  src/liveShare/shareSession.ts:68
    17  src/liveShare/shareTree.ts:14
     5  src/plotViewer/index.ts:289
     3  src/preview.ts:32
     1  src/rGitignore.ts:37
     7  src/rmarkdown/draft.ts:49
    32  src/rmarkdown/index.ts:63
    13  src/rmarkdown/knit.ts:12
    11  src/rmarkdown/manager.ts:32
    23  src/rmarkdown/preview.ts:20
     5  src/rstudioapi.ts:119
    26  src/rTerminal.ts:20
    12  src/selection.ts:8
    14  src/session.ts:185
     1  src/tasks.ts:104
     3  src/test/suite/index.ts:5
     2  src/test/suite/syntax.test.ts:56
    20  src/util.ts:25
     7  src/workspaceViewer.ts:39

(For reference, if only "strict" is enabled it shows Found 295 errors in 31 files.)

PR

If there is agreement on enabling strict mode I volunteer to work on a PR that fixes the existing errors. (I don't want to start working on it if its not desired)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions