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

Fix case where property might be null #1310

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

Conversation

Tofandel
Copy link

New Pull Request Information

When declaring a css variable an error is thrown while linting with sort properties because the declaration doesn't contain a property node but instead a customProperty node

Reproduction

.columns.is-variable
  --columnGap: 0.75rem

Log

Node {
  type: 'declaration',
  content: [
    Node {
      type: 'customProperty',
      content: [Array],
      syntax: 'sass',
      start: [Object],
      end: [Object]
    },
    Node {
      type: 'propertyDelimiter',
      content: ':',
      syntax: 'sass',
      start: [Object],
      end: [Object]
    },
    Node {
      type: 'space',
      content: ' ',
      syntax: 'sass',
      start: [Object],
      end: [Object]
    },
    Node {
      type: 'value',
      content: [Array],
      syntax: 'sass',
      start: [Object],
      end: [Object]
    }
  ],
  syntax: 'sass',
  start: { line: 467, column: 5 },
  end: { line: 467, column: 24 }
}
@error     TypeError: Cannot read property 'first' of null
    at /home/tofandel/Desktop/bulma/node_modules/sass-lint/lib/rules/property-sort-order.js:110:27
    at Node.forEach (/home/tofandel/Desktop/bulma/node_modules/gonzales-pe-sl/lib/gonzales.js:183:83)
    at Node.<anonymous> (/home/tofandel/Desktop/bulma/node_modules/sass-lint/lib/rules/property-sort-order.js:106:15)
    at /home/tofandel/Desktop/bulma/node_modules/gonzales-pe-sl/lib/gonzales.js:312:41
    at Node.traverse (/home/tofandel/Desktop/bulma/node_modules/gonzales-pe-sl/lib/gonzales.js:292:6)
    at Node.traverse (/home/tofandel/Desktop/bulma/node_modules/gonzales-pe-sl/lib/gonzales.js:297:36)
    at Node.traverse (/home/tofandel/Desktop/bulma/node_modules/gonzales-pe-sl/lib/gonzales.js:297:36)
    at Node.traverse (/home/tofandel/Desktop/bulma/node_modules/gonzales-pe-sl/lib/gonzales.js:297:36)
    at Node.traverse (/home/tofandel/Desktop/bulma/node_modules/gonzales-pe-sl/lib/gonzales.js:297:36)
    at Node.traverseByType (/home/tofandel/Desktop/bulma/node_modules/gonzales-pe-sl/lib/gonzales.js:311:11)

This fixes that error

<DCO 1.1 Signed-off-by: Adrien Foulon>

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.

1 participant