SassDoc / sassdoc

Release the docs!
http://sassdoc.com
MIT License
1.41k stars 56 forks source link

Variable names used in comments comes under require section #511

Open lokeshdaiya opened 7 years ago

lokeshdaiya commented 7 years ago

Version

2.3.0

Problem

I have below code in my scss file


/// This function takes a pixel size and transforms it into a rem value
@function test-func($size){
 // using base of 16px since we don't want to adjust if the $base-font-size is changed
  $rem-size: $size / 16px;
  @return #{$rem-size}rem;

}
/// font size
$base-font-size: 16px;

I am generating JSON data using sass.parse method mentioned here http://sassdoc.com/node. I have used $base-font-size in comment of test-func and its appearing in require section.

Below is the JSON response:

[
  {
    "description": "This function takes a pixel size and transforms it into a rem value\n",
    "commentRange": {
      "start": 3,
      "end": 3
    },
    "context": {
      "type": "function",
      "name": "test-func",
      "code": "\n // using base of 16px since we don't want to adjust if the $base-font-size is changed\n  $rem-size: $size / 16px;\n  @return #{$rem-size}rem;\n\n",
      "line": {
        "start": 4,
        "end": 9
      }
    },
    "access": "public",
    "group": [
      "undefined"
    ],
    "require": [
      {
        "type": "variable",
        "name": "base-font-size"
      }
    ],
    "file": {
      "path": "test.scss",
      "name": "test.scss"
    }
  },
  {
    "description": "font size\n",
    "commentRange": {
      "start": 10,
      "end": 10
    },
    "context": {
      "type": "variable",
      "name": "base-font-size",
      "value": "16px",
      "scope": "private",
      "line": {
        "start": 11,
        "end": 11
      }
    },
    "access": "public",
    "group": [
      "undefined"
    ],
    "file": {
      "path": "test.scss",
      "name": "test.scss"
    },
    "usedBy": [
      {
        "description": "This function takes a pixel size and transforms it into a rem value\n",
        "context": {
          "type": "function",
          "name": "test-func",
          "code": "\n // using base of 16px since we don't want to adjust if the $base-font-size is changed\n  $rem-size: $size / 16px;\n  @return #{$rem-size}rem;\n\n",
          "line": {
            "start": 4,
            "end": 9
          }
        }
      }
    ]
  }
]
steffenpedersen commented 5 years ago

Hi @lokeshdaiya, is this still an issue in the current version 2.5.1?