skip to Main Content

I’m writing typescript with not much experience and when I deploy my functions to the server, I get a ton of errors like "character limit for each line must be 80 characters", "blocks cannot be padded", "unexpected var, use let or const instead", indentation errors, etc. But there are so many that I feel like maybe I missed a step in configuring Visual Studio Code specifically for Typescript. For example, is there a way I can draw a vertical line in the editor to serve as a visual aid for the 80 character limit?

Edit: added some error examples

26:32   warning  'context' is defined but never used                                           @typescript-eslint/no-unused-vars
   45:1    error    Missing JSDoc comment                                                         require-jsdoc
   46:1    error    Expected indentation of 4 spaces but found 2                                  indent
   47:1    error    Expected indentation of 4 spaces but found 2                                  indent
   48:1    error    Expected indentation of 4 spaces but found 2                                  indent
   49:1    error    Expected indentation of 0 spaces but found 2                                  indent
   55:3    error    Unexpected var, use let or const instead                                      no-var
   55:7    error    Type number trivially inferred from a number literal, remove type annotation  @typescript-eslint/no-inferrable-types
   55:28   error    Missing semicolon                                                             semi
   56:3    error    Unexpected var, use let or const instead                                      no-var
   56:7    error    Type string trivially inferred from a string literal, remove type annotation  @typescript-eslint/no-inferrable-types
   56:34   error    Missing semicolon                                                             semi
   57:3    error    Unexpected var, use let or const instead                                      no-var
   57:7    error    Type string trivially inferred from a string literal, remove type annotation  @typescript-eslint/no-inferrable-types
   57:29   error    Missing semicolon                                                             semi
   64:1    error    This line has a length of 83. Maximum allowed is 80                           max-len
   64:84   error    Missing semicolon                                                             semi
   66:20   error    Missing semicolon                                                             semi
   67:50   error    Missing semicolon                                                             semi
   68:21   error    Missing semicolon                                                             semi
   70:20   error    Missing semicolon                                                             semi
   71:26   error    Missing semicolon                                                             semi
   72:47   error    Missing semicolon                                                             semi
   73:6    error    Trailing spaces not allowed                                                   no-trailing-spaces
   78:1    error    This line has a length of 112. Maximum allowed is 80                          max-len
   78:113  error    Missing semicolon                                                             semi
   81:24   error    Expected parentheses around arrow function argument                           arrow-parens
   82:47   error    Missing semicolon                                                             semi
   85:20   error    Missing semicolon                                                             semi
   86:21   error    Missing semicolon                                                             semi
   88:20   error    Missing semicolon                                                             semi
   89:26   error    Missing semicolon                                                             semi
   90:47   error    Missing semicolon                                                             semi
   91:6    error    Trailing spaces not allowed                                                   no-trailing-spaces
   93:1    error    Trailing spaces not allowed                                                   no-trailing-spaces
   94:48   error    Missing semicolon                                                             semi
   99:32   warning  'context' is defined but never used                                           @typescript-eslint/no-unused-vars
  130:18   warning  'response' is defined but never used                                          @typescript-eslint/no-unused-vars

2

Answers


  1. Install the typescript compiler using the command npm install -g typescript.

    For more information you can read on their official documentation https://code.visualstudio.com/docs/languages/typescript

    Login or Signup to reply.
  2. Try using prettier and configure vscode to format on save. This will take care of line length and indentation errors at least.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search