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

Using an ID in a selector should report first ID column #459

Closed
wants to merge 1 commit into from

Conversation

jgable
Copy link

@jgable jgable commented Mar 1, 2014

  • Grab the col the first id was found at in a selector from the part
  • Report it later instead of selector.col
  • Add unit tests for single and multiple ids

The use case for this is that in the grunt-lesslint task we are using source maps to show the original less line that causes the error and since it's reporting column 0 the relevent LESS line is not as accurate as it could be.

For reference: jgable/grunt-lesslint#6

@joshuaspence
Copy link

+1

@nschonni nschonni added the Triage label Apr 2, 2014
@@ -31,6 +32,9 @@ CSSLint.addRule({
for (k=0; k < part.modifiers.length; k++){
modifier = part.modifiers[k];
if (modifier.type == "id"){
if (!firstIdCol) {
Copy link
Member

Choose a reason for hiding this comment

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

When part.col is zero (ID is in the first selector column), then this will coerce to true on the second iteration

firstIdCol = typeof firstIdCol === "undefined" ? part.col : firstIdCol;

Copy link
Author

Choose a reason for hiding this comment

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

Good catch, will update shortly.

- Grab the col the first id was found at in a selector
- Report it later instead of selector.col
- Add unit tests for single and multiple ids
@jgable
Copy link
Author

jgable commented Apr 7, 2014

Updated

  • Switch to explicit false check to prevent possible truthy coercion on second iteration when id is in 0th column.
  • Rebased on master.

@XhmikosR
Copy link
Member

XhmikosR commented Jan 9, 2016

@jgable: can you fetch and rebase?

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

Successfully merging this pull request may close these issues.

None yet

5 participants