Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sir-dunxalot/ember-cli-sass-lint
Pure Node.js sass/scss linting for Ember CLI projects
https://github.com/sir-dunxalot/ember-cli-sass-lint
ember ember-addon ember-cli linting sass sass-lint
Last synced: 3 months ago
JSON representation
Pure Node.js sass/scss linting for Ember CLI projects
- Host: GitHub
- URL: https://github.com/sir-dunxalot/ember-cli-sass-lint
- Owner: sir-dunxalot
- License: mit
- Created: 2015-10-29T01:05:55.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-02T16:19:23.000Z (almost 7 years ago)
- Last Synced: 2024-09-29T12:07:07.235Z (4 months ago)
- Topics: ember, ember-addon, ember-cli, linting, sass, sass-lint
- Language: JavaScript
- Size: 122 KB
- Stars: 7
- Watchers: 4
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Ember CLI Sass Lint [![Build Status](https://travis-ci.org/sir-dunxalot/ember-cli-sass-lint.svg?branch=master)](https://travis-ci.org/sir-dunxalot/ember-cli-sass-lint) [![npm](https://img.shields.io/npm/v/ember-cli-sass-lint.svg)](https://www.npmjs.com/package/ember-cli-sass-lint)
======This is a pure Node.js scss/scss linter for Ember CLI apps and addons.
## Installation
```sh
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](https://github.com/sasstools/sass-lint). For example:
```yml
# my-project/.sass-lint.ymlrules:
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](https://github.com/sasstools/sass-lint/blob/develop/docs/sass-lint.yml).
## Options
Options can be passed in your `ember-cli-build.js` in the `sassLint` object. The defaults are shown below:
```js
// my-project/ember-cli-build.jsvar 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 preferred 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).
```js
// 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.