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

Sort fileFailures by line and character? #3335

Closed
eggggger opened this issue Oct 17, 2017 · 5 comments
Closed

Sort fileFailures by line and character? #3335

eggggger opened this issue Oct 17, 2017 · 5 comments

Comments

@eggggger
Copy link
Contributor

馃槼

@ajafff
Copy link
Contributor

ajafff commented Oct 17, 2017

Is this a feature request for the API or the CLI?
Can you please be elaborate a bit more about your use case?

@eggggger
Copy link
Contributor Author

If i delete a line for fix some errors like no-unused-variable, the next line number in error messages will go wrong, so I always fix errors by bottom-up. But now the line number is unordered.

@eggggger
Copy link
Contributor Author

eggggger commented Oct 18, 2017

@ajafff For example

image

and

fileFailures = fileFailures.sort((failureA, failureB): number => {
    const failureALineAndCharacter = failureA.getStartPosition().getLineAndCharacter()
    const failureBLineAndCharacter = failureB.getStartPosition().getLineAndCharacter()
    if (failureALineAndCharacter.line === failureBLineAndCharacter.line) {
        return failureALineAndCharacter.character - failureBLineAndCharacter.character
    }
    return failureALineAndCharacter.line - failureBLineAndCharacter.line
})

@ajafff
Copy link
Contributor

ajafff commented Oct 18, 2017

@eggggger I see, so we are only talking about the formatted output when running TSLint CLI.

That means we don't need to sort the failures unconditionally. It's only required for formatters intended for human consumers.

@ajafff
Copy link
Contributor

ajafff commented Oct 20, 2017

Fixed by #3345

@ajafff ajafff closed this as completed Oct 20, 2017
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