kolint/kolint

String content range is not same as location

tscpp opened this issue · 1 comments

tscpp commented

This applies to all types of strings quoted and double-quoted. I have only found strings in import modules and attributes so far.

The mocha tests are invalid and should be updated too.

<img data-bind="key: value">
[
  {
    loc: {
      first_line: 1,
      last_line: 1,
      first_column: 0,
      last_column: 28,
      range: [0, 28]
    },
    key: 'img',
    nodeType: 2,
    bindings: [
      {
        location: {
          first_line: 1,
          last_line: 1,
          first_column: 15,  // <---
          last_column: 27,   // <---
          range: [16, 26]    // <---
        },
        bindingText: 'key: value'
      }
    ]
  }
]
tscpp commented

It is actually the other way in import modules. The range is bigger than the location 😂