Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Different errors are reported for a file outside of the project directory #4897

Closed
dylan-chong opened this issue Dec 1, 2019 · 3 comments
Closed

Comments

@dylan-chong
Copy link

dylan-chong commented Dec 1, 2019

Bug Report

  • TSLint version: 5.20.0
  • TypeScript version: 3.5.3
  • Running TSLint via: (pick one) CLI

Different errors are reported for files that are outside of the project directory. This is a problem for https://github.com/dense-analysis/ale because it copies the contents of the current (unsaved) file to a temp file, and runs tslint on it. This results in different errors being reported in my editor that what is expected

Reproduction using TSLint Playground

Can't do it using the playground as it uses a file but

myProject/tslint.json:

// You can modify the configuration here with your own.
// Make sure that your json is valid, and if you run into
// other issues, try checking the console for errors.

{
    "extends": [
    "tslint:recommended",
    "tslint-config-standard",
    "tslint-react",
    "tslint-config-prettier"
     ],
    "rules": {
        "quotemark": [
            true,
            "single",
            "jsx-single"
        ]
    } // add additional rules and their configuration
}

myProject/example.ts

console.log('hello'); // no errors here

./node_modules/.bin/tslint --format json -c tslint.json example.ts
[]

~/Desktop/example.ts

console.log('hello'); // Incorrect error here saying should be double quotes

./node_modules/.bin/tslint --format json -c tslint.json example.ts
[{"endPosition":{"character":16,"line":0,"position":16},"failure":"Replace `'hi'` with `\"hi\"`","fix":{"innerStart":12,"innerLength":4,"innerText":"\"hi\""},"name":"../../../../../../Desktop/f.ts","ruleName":"prettier","ruleSeverity":"ERROR","startPosition":{"character":12,"line":0,"position":12}}]
@JoshuaKGoldberg
Copy link
Contributor

Hi @dylan-chong! It's a little unusual that you'd be investigating a Vim plugin for TSLint at this stage of its deprecation: #4534. It's also interesting that the only failing rule is prettier. Maybe this is a case of the Prettier rule not reading your Prettier config file?

Marking as needing investigation, though my suspicion is that the actual issue is with https://github.com/prettier/tslint-config-prettier or another Prettier integration.

@dylan-chong
Copy link
Author

Hi, thanks for pointing out the deprecation. We have recently moved to eslint and the problem seems to have gone away.

@JoshuaKGoldberg
Copy link
Contributor

🤖 Beep boop! 👉 TSLint is deprecated 👈 and you should switch to typescript-eslint! 🤖

🔒 This issue is being locked to prevent further unnecessary discussions. Thank you! 👋

@palantir palantir locked and limited conversation to collaborators Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants