Skip to content

Error thrown on single-line mixin include without semicolon #110

Closed
@jwilsson

Description

@jwilsson

Originally reported at lesshint/lesshint#490

  • Node Version: 10.9.0
  • NPM Version: 6.2.0
  • postcss-less Version: 2.0.0

If you have a large amount of code to share which demonstrates the problem you're experiencing, please provide a link to your
repository rather than pasting code. Otherwise, please paste relevant short snippets below.

LESS

.foo{.bar("baz")}

JavaScript

const postcss = require('postcss');
const syntax = require('postcss-less');

const lessText = `.foo{.bar("baz")}`;

postcss([])
  .process(lessText, { syntax: syntax })
  .then(function (result) {
    console.log(result.root.first)
  })
  .catch((e) => {
      console.error(e);
  });

Errors

CssSyntaxError {
  name: 'CssSyntaxError',
  reason: 'Unknown word',
  source: '\n.foo{.bar("baz")}\n',
  line: 2,
  column: 16,
  message: '<css input>:2:16: Unknown word',
  input: { line: 2, column: 16, source: '\n.foo{.bar("baz")}\n' }
}

Expected Behavior

Return an AST without any errors.

Actual Behavior

The above error is thrown. Adding a semicolon before } fixes it though.

How can we reproduce the behavior?

Run the JS code above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions