Search code examples
ember.jsember-clibroccolijs

ember-cli scss lint addon not performing task


I am trying to make a SCSS lint addon for ember-cli (I know one exists already ember-cli-scsslint but I want one more customisable). I was wondering whether anyone has had experience using broccoli-scss-lint because I am having trouble feeding in my styling tree and having scss-lint actually lint my files.

The code I have written so far is:

module.exports = {
  name: 'ember-cli-scss-lint',

  included: function(app) {
    this._super.included.apply(this, arguments);
    this.app = app;
    var _this = this;

    app.registry.add('css', {
      name: this.name,
      ext: 'scss',
      toTree: function(tree) {
        var options, defaultOptions, scsslintConfig;

        options = app.options.scsslintOptions || {};
        defaultOptions = {
          config: path.join(_this.project.root, '/.scss-lint.yml');,
          bundleExec: false
        };

        scsslintConfig = merge(defaultOptions, options);
        return scssLint(tree, scsslintConfig);
      }
    });
  }
};

where config is a YAML file containing the scss-lint configuration. With this setup no files get linted through the call to scssLint. Is there something incredibly blatant that I have done wrong?


Solution

  • I was unable to use the tree passed in from toTree so I instead settled for grabbing the styles tree from the application app.trees.style and that seems to have done the trick.

    I feel this is more a limitation of broccoli-scsslint than ember-cli.

    If anybody can suggest an improvement, you can checkout my code here: ember-cli-scsslint