npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-cli-scss-lint

v2.4.1

Published

An ember-cli addon to integrate sass-lint for standards adherence and improved style consistency

Downloads

1,067

Readme

ember-cli-scss-lint Build Status Maintainability

An Ember CLI addon to integrate sass-lint for standards adherence and improved style consistency.

One of the many great features of Ember CLI is its rich toolset surrounding the framework such as eslint. This provides you with the ability to more easily write consistent and self documenting code that any developer could understand. However there is currently no similar feature to lint your stylesheets.

If you choose to compose your stylesheets using a preprocessor language such as SCSS you will equally find no support to ensure your code follows best practice. This addon solves this by integrating the sass-lint nodejs package into the Ember CLI build process.

Previous versions of this addon made use of the Ruby implementation of scss-lint. However the Sass core team is now building Sass in Dart instead of Ruby, and will no longer be maintaining the Ruby implementation. Since scss-lint relies on the Ruby Sass implementation, this means it will eventually not support the latest Sass features and bug fixes. As such sass-lint has taken over in it's place which offers better integration into an already JavaScript pipeline.

Compatibility

  • Ember.js v2.18 or above
  • Ember CLI v2.13 or above

Installation

From within your Ember CLI project directory run:

ember install ember-cli-scss-lint

Usage

Every time you run an Ember CLI process that requires building the application (ember server, ember test, ember build) your stylesheets will be linted and any errors output to the command line.

$ ember s
version: 1.13.13
Livereload server on http://localhost:49154
Serving on http://localhost:4200/

partials/_pagination.scss
  1:1   warning  Type-selector should be nested within its parent Class   force-element-nesting
  1:1   warning  Class should be nested within its parent Type-selector   force-element-nesting
  1:24  warning  Qualifying elements are not allowed for class selectors  no-qualifying-elements

✖ 3 problems (0 errors, 3 warnings)

Build successful - 24281ms.

Configuration

sass-lint.yml

Linting can be configured by creating a .sass-lint.yml file in the root directory of your Ember CLI project alongside your .eslintrc file. If you already have a config for scss-lint, you can instantly convert it to the equivalent sass-lint config here.

Configuration Example
files:
  include: '**/*.scss'

options:
  formatter: stylish
  merge-default-rules: false

rules:
  border-zero:
    - 1
    - convention: zero

  brace-style:
    - 1
    - allow-single-line: true

  ...

ember-cli-build.js

Any configuration option you can set within the .sass-lint.yml file can also be set within the ember-cli-build.js file of the consuming application. Any option here will take precedence over those in the .sass-lint.yml file. This is useful when needing to programmatically define rule sets depending upon some condition.

JavaScript Configuration Example
// ember-cli-build.js
const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    scssLintOptions: {
      rules: [
        'border-zero': 2,
        'brace-style': 0
      ]
    }
  });

  return app.toTree();
};

For more information on the available rules see the sass-lint linters documentation.

Adding trees

By default this addon forwards the entire app tree to be linted, but will not lint any files outside of the app folder. For most use cases this will be sufficient, but for others this is limiting. If for example you wish to lint files contained within the vendor tree you must tell the addon to do so. This can be done within the ember-cli-build.js file.

Trees Example
// ember-cli-build.js
const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    scssLintOptions: {
      includePaths: [
        'vendor'
      ]
    }
  });

  return app.toTree();
};

License

This project is licensed under the MIT License.