Skip to content

Commit

Permalink
Merge pull request #628 from sasstools/release/1.6.0
Browse files Browse the repository at this point in the history
Release/1.6.0
  • Loading branch information
DanPurdy committed Apr 21, 2016
2 parents cb13134 + fa54dae commit 30f2a72
Show file tree
Hide file tree
Showing 89 changed files with 2,568 additions and 1,529 deletions.
14 changes: 6 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ rules:
no-caller: 2
no-console: 0
no-delete-var: 2
no-empty-label: 2
no-labels: 2
no-eval: 2
no-extend-native: 2
no-extra-bind: 2
Expand All @@ -64,7 +64,6 @@ rules:
no-invalid-this: 2
no-iterator: 2
no-label-var: 2
no-labels: 2
no-lone-blocks: 2
no-loop-func: 2
no-mixed-spaces-and-tabs:
Expand Down Expand Up @@ -110,15 +109,16 @@ rules:
- 2
- before: false
after: true
space-after-keywords:
- 2
- always
keyword-spacing:
- 2
-
before: true
after: true
space-before-blocks: 2
space-before-function-paren:
- 2
- always
space-infix-ops: 2
space-return-throw-case: 2
space-unary-ops:
- 2
- words: true
Expand All @@ -144,11 +144,9 @@ rules:

# Previously on by default in node environment
no-catch-shadow: 0
no-console: 0
no-mixed-requires: 2
no-new-require: 2
no-path-concat: 2
no-process-exit: 2
handle-callback-err:
- 2
- err
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: node_js
node_js:
- '0.10'
- '0.12'
- '4'
- '5'
- node
- iojs
before_script: npm link
Expand Down
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# Sass Lint Changelog

## v1.6.0

**April 21, 2016**

The long lost 1.6 update

**WARNING**
* We've moved to the latest version of gonzales-pe and then onto our own fork in which we've fixed our issues with CRLF etc. All of our tests are passing but there may be unforeseen regressions in gonzales that we will aim to fix. If you find a problem like this please report it to us and we'll investigate further. You can then decide to keep your sass-lint dependency to 1.5.1 if you so choose.

**Changes**
* Updated all rules to work with the new Gonzales-pe 3.2.x release [#495](https://github.com/sasstools/sass-lint/issues/495)
> No breaking changes in the sense that all the rules are the same and pass the same tests or more BUT many did involve a complete re write.
* Now using gonzales-pe-sl 3.2.7 fork
* Update the no-mergeable-selectors rule to ignore certain situations and work a little more reliably across codebases
* Added BEM conventions to all naming rules [#614](https://github.com/sasstools/sass-lint/pull/614)
* Added Appveyor CI for testing against CRLF line endings on Windows


**CLI**
* Add max warnings option to the CLI --max-warnings [#568](https://github.com/sasstools/sass-lint/pull/568)

**New Rules**
* `no-trailing-whitespace` rule added [#605](https://github.com/sasstools/sass-lint/pull/605)

**Fixes**
* Fixed parsing error when using interpolated values [#44](https://github.com/sasstools/sass-lint/issues/44), [#184](https://github.com/sasstools/sass-lint/issues/184), [#210](https://github.com/sasstools/sass-lint/issues/210), [#222](https://github.com/sasstools/sass-lint/issues/222),
[#321](https://github.com/sasstools/sass-lint/issues/321),
[#486](https://github.com/sasstools/sass-lint/issues/486),
* Fixed parsing error when using the `!global` flag [#56](https://github.com/sasstools/sass-lint/issues/56)
* Having `-` within a class name will no longer return a parse error [#229](https://github.com/sasstools/sass-lint/issues/229)
* Fixed parsing error when using extrapolated variable as extend name [#313](https://github.com/sasstools/sass-lint/issues/313)
* Fixed an un-handled error thrown from the indentation rule [#389](https://github.com/sasstools/sass-lint/issues/389)
* Fixed an issue with final newline rule for sass [#445](https://github.com/sasstools/sass-lint/issues/445)
* Updated indentation rule to work with CRLF (indentation is mainly scss for the moment) [#524](https://github.com/sasstools/sass-lint/pull/524)
* Fixed parsing error when using nested maps [#531](https://github.com/sasstools/sass-lint/issues/531)
* Fixed parsing error when using variables for placeholder name [#532](https://github.com/sasstools/sass-lint/issues/532)
* Fixed issue with dots in filenames [#541](https://github.com/sasstools/sass-lint/pull/541)
* Fixed use of modulo operator in SCSS syntax [#565](https://github.com/sasstools/sass-lint/issues/565)
* Fixed an issue with space-around-operator and unicode [#620](https://github.com/sasstools/sass-lint/pull/620)
* Fixed an issue with CRLF line endings in the no-trailing-whitespace rule [#623](https://github.com/sasstools/sass-lint/pull/623)

**A big thank you to everyone who reported issues or contributed to the discussion around issues and also for everyone bearing with us while we go this monster update ready for you.**

## v1.5.1
**February 26, 2016**

Expand Down
102 changes: 97 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,62 @@
# Sass Lint [![npm version](https://badge.fury.io/js/sass-lint.svg)](http://badge.fury.io/js/sass-lint) [![Build Status](https://travis-ci.org/sasstools/sass-lint.svg)](https://travis-ci.org/sasstools/sass-lint) [![Coverage Status](https://coveralls.io/repos/sasstools/sass-lint/badge.svg?branch=develop&service=github)](https://coveralls.io/github/sasstools/sass-lint?branch=develop) [![Dependency Status](https://david-dm.org/sasstools/sass-lint.svg)](https://david-dm.org/sasstools/sass-lint#info=dependencies&view=list) [![Dev Dependency Status](https://david-dm.org/sasstools/sass-lint/dev-status.svg)](https://david-dm.org/sasstools/sass-lint#info=devDependencies&view=list)
# Sass Lint [![npm version](https://badge.fury.io/js/sass-lint.svg)](http://badge.fury.io/js/sass-lint) [![Build Status](https://travis-ci.org/sasstools/sass-lint.svg?branch=develop)](https://travis-ci.org/sasstools/sass-lint) [![Coverage Status](https://coveralls.io/repos/sasstools/sass-lint/badge.svg?branch=develop&service=github)](https://coveralls.io/github/sasstools/sass-lint?branch=develop) [![Dependency Status](https://david-dm.org/sasstools/sass-lint.svg)](https://david-dm.org/sasstools/sass-lint#info=dependencies&view=list) [![Dev Dependency Status](https://david-dm.org/sasstools/sass-lint/dev-status.svg)](https://david-dm.org/sasstools/sass-lint#info=devDependencies&view=list)

A Node-only Sass linter for both `sass` and `scss` syntax!

---

## Install
You can get `sass-lint` from [NPM](https://www.npmjs.com/package/sass-lint)

```
npm install sass-lint --save-dev
```

---

## Configuring

Use the [Sample Config](docs/sass-lint.yml) as a guide to create your `.sass-lint.yml` in the root of where you are running Sass Lint from. The default configuration can be found [here](https://github.com/sasstools/sass-lint/blob/master/lib/config/sass-lint.yml).
Sass-lint can be configured from a `.sass-lint.yml` file in your project. If you don't have one in the root of your project or you would like all your projects to follow a standard config file then you can specify the path to one in your projects `package.json` file.

For example:
```javascript
{
"name": "my-project",
"version": "1.0.0",
"sasslintConfig": "PATH/TO/YOUR/CONFIG/FILE"
}
```

Use the [Sample Config](https://github.com/sasstools/sass-lint/tree/master/docs/sass-lint.yml) as a guide to create your own `.sass-lint.yml` config file. The default configuration can be found [here](https://github.com/sasstools/sass-lint/blob/master/lib/config/sass-lint.yml).

### [Configuration Documentation](https://github.com/sasstools/sass-lint/tree/master/docs/options)

*Migrating from SCSS-Lint*: If you already have a config for SCSS-Lint, you can instantly convert it to the equivalent Sass Lint config at [sasstools.github.io/make-sass-lint-config](http://sasstools.github.io/make-sass-lint-config/).

### Options

The following are options that you can use to config the Sass Linter.

* [cache-config](https://github.com/sasstools/sass-lint/tree/master/docs/options/cache-config.md) - Allows you to cache your config for a small speed boost when not changing the contents of your config file
* [config-file](https://github.com/sasstools/sass-lint/tree/master/docs/options/config-file.md) - Specify another config file to load
* [formatter](https://github.com/sasstools/sass-lint/tree/master/docs/options/formatter.md) - Choose the format for any warnings/errors to be displayed
* [merge-default-rules](https://github.com/sasstools/sass-lint/tree/master/docs/options/merge-default-rules.md) - Allows you to merge your rules with the default config file included with sass-lint
* [output-file](https://github.com/sasstools/sass-lint/tree/master/docs/options/output-file.md) - Choose to write the linters output to a file


#### Files

The `files` option can either be set to a [glob](https://github.com/isaacs/node-glob) or it can be set to an object, where the key `include` is set to the glob you want to include, and `ignore` set to either a glob string or an array of glob strings that you would like to ignore.

```yml
files:
include: 'sass/**/*.s+(a|c)ss'
ignore:
- 'sass/vendor/**/*.*'
```
#### Rules
For all [rules](docs/rules), setting their severity to `0` turns it off, setting to `1` sets it as a warning (something that should not be committed in), and setting to `2` set it to an error (something that should not be written). If a rule is set to just a severity, it will use the default configuration (where available).
For all [rules](https://github.com/sasstools/sass-lint/tree/master/docs/rules), setting their severity to `0` turns it off, setting to `1` sets it as a warning (something that should not be committed in), and setting to `2` sets it to an error (something that should not be written). If a rule is set to just a severity, it will use the default configuration (where available).

If you want to configure options, set the rule to an array, where the first item in the array is the severity, and the second item in the array is an object including the options you would like to set.

Expand All @@ -37,13 +69,73 @@ indentation:
size: 2
```

### [Rules Documentation](https://github.com/sasstools/sass-lint/tree/master/docs/rules)

---

## CLI

Sass Lint [`v1.1.0`](https://github.com/sasstools/sass-lint/releases/tag/v1.1.0) introduced the ability to run Sass Lint through a command line interface. See the [CLI Docs](docs/cli) for full documentation on how to use the CLI.
Sass Lint [`v1.1.0`](https://github.com/sasstools/sass-lint/releases/tag/v1.1.0) introduced the ability to run Sass Lint through a command line interface. See the [CLI Docs](https://github.com/sasstools/sass-lint/tree/master/docs/cli) for full documentation on how to use the CLI.

There are small differences which are useful to understand over other CLI tools you may have encountered with other linters.

By default any rule set to severity: `2` in your config will throw an error which will stop the CLI on the first error it encounters. If you wish to see a list of errors and not have the CLI exit then you'll need to use the `-q` or `--no-exit` flag.

Warnings or any rule set to severity: `1` in your config by default will not be reported by the CLI tool unless you use verbose flag `-v` or `--verbose`.

With this in mind if you would like to have the CLI show both warnings and errors then at the very least your starting point to use the cli should be the following command.
`sass-lint -v -q`

### CLI Examples

#### Specify a config

Below is an example of the command being used to load a config `-c app/config/.sass-lint.yml` file show errors and warnings on the command line and target a glob pattern `**/*.scss` being used.

```
sass-lint -c app/config/.sass-lint.yml '**/*.scss' -v -q
```
or with long form flags
```
sass-lint --config app/config/.sass-lint.yml '**/*.scss' --verbose --no-exit
```
#### Ignore files/patterns
To add a list of files to ignore `tests/**/*.scss, dist/other.scss` into the mix you could do the following:
```
sass-lint -c app/config/.sass-lint.yml '**/*.scss' -v -q -i 'tests/**/*.scss'
```
or with long form flags
```
sass-lint --config app/config/.sass-lint.yml '**/*.scss' --verbose --no-exit --ignore 'tests/**/*.scss, dist/other.scss'
```
> Notice that glob patterns need to be wrapped in quotation or single quote marks in order to be passed to sass-lint correctly and if you want to ignore multiple paths you also need to wrap it in quotation marks and seperate each pattern/fil with a comma and a space `, `.
This will be revisited and updated in `sass-lint` v2.0.0
For further information you can visit our CLI documentation linked below.
### [CLI Documentation](https://github.com/sasstools/sass-lint/tree/master/docs/cli)
---
## Contributions
We welcome all contributions to this project but please do read our [contribution guidelines](https://github.com/sasstools/sass-lint/blob/master/CONTRIBUTING.md) first, especially before opening a pull request. It would also be good to read our [code of conduct](https://github.com/sasstools/sass-lint/blob/master/CODE_OF_CONDUCT.md).
Please don't feel hurt or embarrassed if you find your issues/PR's that don't follow these guidelines closed as it can be a very time consuming process managing the quantity of issues and PR's we receive. If you have any questions just ask!
---
## Creating Rules
Our AST is [Gonzales-PE](https://github.com/tonyganch/gonzales-pe/tree/dev). Each rule will be passed the full AST which they can traverse as they please. There are many different [node types](https://github.com/tonyganch/gonzales-pe/blob/dev/doc/node-types.md) that may be traversed, and an extensive [API for working with nodes](https://github.com/tonyganch/gonzales-pe/tree/dev#api). The file of the rule must have the same name as the name of the rule. All of the available rules are in our [rules directory](https://github.com/sasstools/sass-lint/tree/develop/lib/rules). Default options will be merged in with user config.
Our AST is [Gonzales-PE](https://github.com/tonyganch/gonzales-pe/tree/dev). Each rule will be passed the full AST which they can traverse as they please. There are many different [node types](https://github.com/tonyganch/gonzales-pe/blob/dev/docs/node-types.md) that may be traversed, and an extensive [API for working with nodes](https://github.com/tonyganch/gonzales-pe/tree/dev#api). The file of the rule must have the same name as the name of the rule. All of the available rules are in our [rules directory](https://github.com/sasstools/sass-lint/tree/develop/lib/rules). Default options will be merged in with user config.
---
## Task Runner Integration
Expand Down
32 changes: 32 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CRLF Line Endings
init:
- git config --global core.autocrlf true

# Test against this version of Node.js
environment:
matrix:
- nodejs_version: '0.12'
- nodejs_version: '4'
# Latest version of Node
- nodejs_version: '5'
- nodejs_version: '1'

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install
# link
- npm link

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm test

# Don't actually build.
build: off
9 changes: 8 additions & 1 deletion bin/sass-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ var configPath,
configOptions = {},
exitCode = 0;

var tooManyWarnings = function (detects) {
var warningCount = lint.warningCount(detects).count;

return warningCount > 0 && warningCount > program.maxWarnings;
};

var detectPattern = function (pattern) {
var detects;

Expand All @@ -19,7 +25,7 @@ var detectPattern = function (pattern) {
lint.outputResults(detects, configOptions, configPath);
}

if (lint.errorCount(detects).count) {
if (lint.errorCount(detects).count || tooManyWarnings(detects)) {
exitCode = 1;
}

Expand All @@ -38,6 +44,7 @@ program
.option('-f, --format [format]', 'pass one of the available eslint formats')
.option('-o, --output [output]', 'the path and filename where you would like output to be written')
.option('-s, --syntax [syntax]', 'syntax to evaluate the file(s) with (either sass or scss)')
.option('--max-warnings [integer]', 'Number of warnings to trigger nonzero exit code')
.parse(process.argv);


Expand Down
1 change: 1 addition & 0 deletions docs/cli/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Command Line Flag | Description
`-f`,`--format [format]` | Pass one of the available [Eslint formats](https://github.com/eslint/eslint/tree/master/lib/formatters) to format the output of sass-lint results.
`-h`,`--help` | Outputs usage information for the CLI
`-i`,`--ignore [pattern]` | A pattern that should be ignored from linting. Multiple patterns can be used by separating each pattern by `, `. Patterns should be wrapped in quotes (will be merged with other ignore options)
`--max-warnings [integer]`| Normally, if SassLint runs and finds no errors (only warnings), it will exit with a success exit status. However, if this option is specified and the total warning count is greater than the specified threshold, SassLint will exit with an error status.
`-o`,`--output [output]` | The path plus file name relative to where Sass Lint is being run from where the output should be written to.
`-q`,`--no-exit` | Prevents the CLI from throwing an error if there is one (useful for development work)
`-s`,`--syntax` | Syntax to evaluate the given file(s) with, either sass or scss. Use with care: overrides filename extension-based syntax detection.
Expand Down
Loading

0 comments on commit 30f2a72

Please sign in to comment.