New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript-tslint fails on deprecation warning from tslint #1174

Closed
asmundg opened this Issue Dec 5, 2016 · 13 comments

Comments

Projects
None yet
5 participants
@asmundg

asmundg commented Dec 5, 2016

Given the following tslint.json

{
    "rules": {
        "no-unused-variable": true
    }
}

tslint produces the following output:

$ tsc --version
Version 2.1.1
$ tslint --version
4.0.1
$ tslint --project .
no-unused-variable is deprecated. Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.

This causes typescript-tslint to fail:

Error from syntax checker typescript-tslint: Unrecognized keyword: "no"
Syntax checkers for buffer SignalRExecutor.ts in typescript-mode:

  typescript-tide
    - may enable:        yes
    - predicate:         t
    - Typescript server: running
    - Tide mode:         enabled

  typescript-tslint
    - may enable:         yes
    - executable:         Found at c:/Users/asgramme/AppData/Roaming/npm/tslint.cmd
    - configuration file: Found at "c:/Users/asgramme/src/LivePersonaCard/tslint.json"

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.

--------------------

Flycheck version: 31snapshot (package: 20161025.551)
Emacs version:    25.1.1
System:           x86_64-w64-mingw32
Window system:    w32
@Simplify

This comment has been minimized.

Member

Simplify commented Dec 5, 2016

$ tslint src/<filename>.ts --format=json
no-unused-variable is deprecated. Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.

Could not find implementations for the following rules specified in the configuration:
    label-undefined
    no-constructor-vars
    no-duplicate-key
    no-unreachable
    use-strict
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned up.
        
[]
@Simplify

This comment has been minimized.

Member

Simplify commented Dec 5, 2016

ESLint all over again... We have following options:

  • Ask TSLint developers not to print this warning when using --format option or to add warnings to JSON output (or any other non-cli format) for line 1, column 1. This is something that IMO should be done in first place. When somebody requests JSON output, JSON output should be returned.
  • Ignore all output text until we get line output that starts with [. That is real JSON output. Basically, last line in output.
  • Do nothing, developers can remove those unused settings from their tslint.json configuration file. Upgrading to mayor version of any tool should be manual task. However, it's not nice user experience for Flycheck users.
@asmundg

This comment has been minimized.

asmundg commented Dec 5, 2016

The warning is on stderr, while the json is on stdout. Doesn't flycheck distinguish between these?

@cpitclaudel

This comment has been minimized.

Member

cpitclaudel commented Dec 5, 2016

@asmundg Not that I know of; for the longest time, Emacs didn't have a clean way to distinguish between them.

@cpitclaudel

This comment has been minimized.

Member

cpitclaudel commented Dec 5, 2016

@Simplify I like options 1 and 2 (with a slight preference for 1)

@turboMaCk

This comment has been minimized.

turboMaCk commented Dec 10, 2016

Hi everyone!

Is it possible that this cause an error with tide package I've experienced today? ananthakumaran/tide#89

@cpitclaudel

This comment has been minimized.

Member

cpitclaudel commented Dec 10, 2016

@turboMaCk Hard to say: your bug report doesn't mention what the error is.

@turboMaCk

This comment has been minimized.

turboMaCk commented Dec 10, 2016

@cpitclaudel Thanks for blazingly fast response and sorry for confusion. Actual error is in title of issue + now I've also put it in desc. it's this one.

typescript-tslint is not a valid Flycheck checker 
@cpitclaudel

This comment has been minimized.

Member

cpitclaudel commented Dec 10, 2016

I don't think your issue is related. I posted on your original bug report.

@Simplify

This comment has been minimized.

Member

Simplify commented Dec 10, 2016

@turboMaCk Looks that you have installed older version of Flycheck without typescript-tslint provided.

@turboMaCk

This comment has been minimized.

turboMaCk commented Dec 10, 2016

@Simplify Yeah I think so. Upgrading packages with package.el is still too much tricky for me... I'm thinking about using cask as dependency management tool since it looks like the most robust solution I came across. Thank to you both! Have a nice weekend 🚀 .

@anrepppp

This comment has been minimized.

anrepppp commented Feb 3, 2017

@asmundg
Did you find a way to hide this error message.
no-unused-variable is deprecated. Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.

@asmundg

This comment has been minimized.

asmundg commented Feb 5, 2017

@anvesh48 it depends on the context, but if the problem is multiple projects depending on different tslint versions, this can be fixed fixed by using the local tslint version instead of the global one (adapted from http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable):

(defun use-tslint-from-node-modules ()
  (let* ((root (locate-dominating-file
                (or (buffer-file-name) default-directory)
                "node_modules"))
         (tslint (and root
                      (expand-file-name (if (eq system-type 'windows-nt)
                                            "node_modules/.bin/tslint.cmd"
                                          "node_modules/.bin/tslint")
                                        root))))
    (when (and tslint (file-executable-p tslint))
      (setq-local flycheck-typescript-tslint-executable tslint))))

(add-hook 'flycheck-mode-hook #'use-tslint-from-node-modules)

Simplify added a commit that referenced this issue Feb 12, 2017

Simplify added a commit that referenced this issue Feb 12, 2017

Simplify added a commit that referenced this issue Feb 12, 2017

Simplify added a commit that referenced this issue Feb 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment