GithubHelp home page GithubHelp logo

isabella232 / ember-cli-sass-lint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yapplabs/ember-cli-sass-lint

0.0 0.0 0.0 17 KB

Pure Node.js sass/scss linting for Ember CLI projects

License: MIT License

JavaScript 77.39% CSS 2.31% HTML 20.30%

ember-cli-sass-lint's Introduction

Ember CLI Sass Lint Build Status npm

This is a pure Node.js scss/scss linter for Ember CLI apps and addons.

Installation

ember install ember-cli-sass-lint

And that's it! This addon will automatically parse your sass/scss files.

Configuration

Linting configuration can be added in a .sass-lint.yml file as required by Sass Lint. For example:

# my-project/.sass-lint.yml

rules:
  extends-before-mixins: 2 # 2 throws error
  placeholders-in-extend: 1 # 1 logs warning
  extends-before-declarations: 0 # 0 means no errors or warnings

Here is a sample config file.

Options

Options can be passed in your ember-cli-build.js in the sassLint object. The defaults are shown below:

// my-project/ember-cli-build.js

var app = new EmberApp(defaults, {
  sassLint: {
    configPath: '.sass-lint.yml',
    shouldThrowExceptions: true,
    shouldLog: true,
  }
});

configPath

Type String
Default '.sass-lint.yml'

A name of the file your config is contained in. This should be a .yml file, preferrably in the root of the Broccoli project.

shouldThrowExceptions

Type Boolean
Default true

By default, sass-lint throws exceptions when an error is encountered (note, warnings do not throw errors). Usually this is the preffered functionality.

However, you can stop errors being thrown and, therefore, errors stopping the build process by setting shouldThrowExceptions: false. Use with caution!

shouldLog

Type Boolean
Default true

Whether to log warnings and errors to the console. When this is set to false you will not be notified or linting errors!

logError()

Type Function
Param fileLint (Object)

You may override this plugin's default logError() function should you need to intercept file lint objects (e.g. when testing this plugin).

// my-project/ember-cli-build.js
var errors = [];

var app = new EmberApp(defaults, {
  sassLint: {
    logError: function(fileLint) {
      errors.push(fileLint);
    }
  }
});

fileLint is passed in the format returned by sass-lint's lintText() method. you can format it using the format() function in the sass-lint package (npm install --save-dev sass-lint).

Note, when you override logError() this plugin won't log any warnings or errors.

Development

All tests are currently contained in tests/runner.js. This uses Mocha/Chai, not Ember Testing. Tests can be ran with:

npm test

You should also check that the dummy app's styles are still correctly compiled by running the ember app using ember s.

PRs are welcomed and should be issued to the master branch.

ember-cli-sass-lint's People

Contributors

ember-tomster avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.