sasstools / sass-lint

Pure Node.js Sass linting
MIT License
1.77k stars 532 forks source link

indentation validation does not work for comments that are above a definition #1072

Open akrillo89 opened 7 years ago

akrillo89 commented 7 years ago

Hey,

right now the comments have issues with line indentation validation. For example when I use the linter for the following definition:

image

I get an issue in line 14. It's best practice to put a comment above a definition to avoid long lines.

I am using sass lint via command line and in visual code. Both have the same error.

sass-lint version: 1.10.2

.sass-lint.yml

#########################
## Sample Sass Lint File
#########################
# File Options
files:
  include: 'sass/**/*.s+(a|c)ss'
# Rule Configuration
rules:
  class-name-format:
    - 1
    -
      convention: '^([\.\%]?[a-zA-Z]*[-]?[a-zA-Z0-9\-]*)(\.[a-zA-Z0-9\-]*)?(__[a-zA-Z0-9]*[-]?[a-zA-Z0-9\-]*)?(--[a-zA-Z0-9]*[-]?[a-zA-Z0-9\-]*)?(\:[a-z]*)*$'
      convention-explanation: 'Class should be written in BEM (Block Element Modifier) syntax.'
  no-duplicate-properties: 2
  extends-before-mixins: 2
  extends-before-declarations: 2
  placeholder-in-extend: 2
  mixins-before-declarations:
    - 2
    -
      exclude:
        - respond-to

  no-warn: 1
  no-debug: 1
  no-ids: 1
  no-important: 2
  hex-notation:
    - 2
    -
      style: uppercase
  indentation:
    - 2
    -
      size: 2
  property-sort-order:
    order: 'alphabetical'
    ignore-custom-properties: true
  variable-for-property:
    - 2
    -
      properties:
        - color
        - background-color
        - box-shadow
Dorza commented 7 years ago

Indentation in general is flaky I find, If i want to do this:

//Comment title ----//Comment sub title ----//Comment content

OR //reds $red: #ff0000; ----$cotton-candy: #ffc0ff; ----$dark-tan: #5F0808; ----$guardsman-red: #bf0b0b; ----$your-pink: #f7bbbb;

//blues $blue: #0000ff; ----$cerulean-blue: #0b50bf; ---- $light-cyan: #c0ffff; ----$pattens-blue: #d1ebf7; ----$torea-bay: #022896;

It totally freaks out saying it found 8 spaces when 0 were expected or the like. We need to do this so things are organised to the eye, it only expects tabbing inside a function, mixin, declaration block in other words.

Sorry, don't mean to hijack your post, was just backing you up on stating indenting is a bit off.

akrillo89 commented 7 years ago

what is the current state of this project? Are there still active maintainer?

DanPurdy commented 7 years ago

We've been quiet for a while, everyone involved recently changed jobs or moved house etc so it's been a busy time. Will look into getting more activity in the coming weeks. This issue has already been discussed elsewhere and is just a missing case in the indentation rule which for a long time has needed a bit of an overhaul but due to the state of the AST we were using that task wasn't going to be worth much as the format has changed slightly in their V4.

Will look to revive this once the V4 update of our AST is released.