Skip to content
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

Change lines to 1based. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Yeti-or
Copy link

@Yeti-or Yeti-or commented Nov 4, 2016

fix #1

* @param {number} [line=0] - errored line
* @param {number} [column=0] - errored column
* @param {number} [line=1] - errored line
* @param {number} [column=1] - errored column
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? It can be 0:0 by default (as undefined)

@@ -7,16 +7,16 @@ module.exports = Warnie;
* @name Warnie
* @param {string} message - text message of error
* @param {string} filename - name of file the error belongs
* @param {number} [line=0] - errored line
* @param {number} [column=0] - errored column
* @param {number} [severity=0] - severity of the error, one of [-1, 0, 1, 2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let it be another issue, please?

this.line = line|0;
this.column = column|0;
this.line = line||1;
this.column = column||1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|0 here used to convert to number, not for default value.

var pointer = Warnie.renderPointer(Warnie.renderLineNumber(0).length + this.column);
var result = [
renderLine(this.line, lines[this.line]),
renderLine(humanLine, lines[humanLine]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

humanLine is one-based now. Here you need zero-based-line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Both line and column values should be one-based numerics
2 participants