stylelint
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -0,1 +1,8 @@ | ||
# 0.8.0 | ||
* Added: `after-comment` `ignore` option to the `at-rule-empty-line-before` rule. | ||
* Fixed: the `indentation` rule now correctly handles `*` hacks on property names. | ||
* Fixed: the `media-feature-colon-space-after` and `media-feature-colon-space-before` rules now only apply to `@media` statements. | ||
* Fixed: the `rule-no-shorthand-property-overrides` rule message is now consistent with the other messages. | ||
# 0.7.0 | ||
@@ -2,0 +9,0 @@ |
@@ -28,3 +28,3 @@ "use strict"; | ||
except: ["blockless-group", "first-nested", "all-nested"], | ||
ignore: ["all-nested"] | ||
ignore: ["after-comment", "all-nested"] | ||
}, | ||
@@ -49,2 +49,7 @@ optional: true | ||
// Optionally ignore the expectation if a comment precedes this node | ||
if ((0, _utils.optionsHaveIgnored)(options, "after-comment") && atRule.prev() && atRule.prev().type === "comment") { | ||
return; | ||
} | ||
var emptyLineBefore = atRule.before.indexOf("\n\n") !== -1 || atRule.before.indexOf("\r\n\r\n") !== -1; | ||
@@ -51,0 +56,0 @@ |
@@ -97,2 +97,5 @@ "use strict"; | ||
// Cut out any * hacks from `before` | ||
before = before[before.length - 1] === "*" ? before.slice(0, before.length - 1) : before; | ||
// Inspect whitespace in the `before` string that is | ||
@@ -99,0 +102,0 @@ // *after* the *last* newline character, |
@@ -41,3 +41,10 @@ "use strict"; | ||
root.eachAtRule(function (atRule) { | ||
var name = atRule.name; | ||
var params = atRule.params; | ||
// Only deal with @media at-rules | ||
if (name !== "media") { | ||
return; | ||
} | ||
(0, _utils.styleSearch)({ source: params, target: ":" }, function (match) { | ||
@@ -44,0 +51,0 @@ checkColon(params, match.startIndex, atRule); |
@@ -20,3 +20,3 @@ "use strict"; | ||
rejected: function rejected(shorthand, original) { | ||
return "Unexpected shorthand property override: " + ("\"" + shorthand + "\" will override \"" + original + "\""); | ||
return "Unexpected shorthand \"" + shorthand + "\" after \"" + original + "\""; | ||
} | ||
@@ -23,0 +23,0 @@ }); |
{ | ||
"name": "stylelint", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Modern CSS linter", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -14,2 +14,6 @@ # stylelint [![NPM version](http://img.shields.io/npm/v/stylelint.svg)](https://www.npmjs.org/package/stylelint) [![Travis Build Status](https://img.shields.io/travis/stylelint/stylelint/master.svg?label=unix%20build)](https://travis-ci.org/stylelint/stylelint) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/MoOx/stylelint/master.svg?label=windows%20build)](https://ci.appveyor.com/project/MoOx/stylelint) [![Join the chat at https://gitter.im/stylelint/stylelint](https://img.shields.io/badge/gitter%20-join%20chat%20%E2%9E%9E-1dce73.svg)](https://gitter.im/stylelint/stylelint) | ||
## Example output | ||
![Example](example.png?raw=true) | ||
## Installation | ||
@@ -21,3 +25,3 @@ | ||
Currently, reported line numbers are only _approximate_, marking the beginning of the CSS node to which the warning relates. _See issue [#133](https://github.com/stylelint/stylelint/issues/133) for more details._ | ||
This plugin registers warnings via PostCSS. Therefore, you'll want to use it with a PostCSS runner that prints warnings (e.g. [`gulp-postcss`](https://github.com/postcss/gulp-postcss)) or another PostCSS plugin that prints warnings (e.g. [`postcss-reporter`](https://github.com/postcss/postcss-reporter)). | ||
@@ -77,2 +81,4 @@ ## Usage | ||
Currently, reported line numbers are only _approximate_, marking the beginning of the CSS node to which the warning relates. _See issue [#133](https://github.com/stylelint/stylelint/issues/133) for more details._ | ||
### With CSS processors | ||
@@ -198,11 +204,13 @@ | ||
### Other linters | ||
### Editor plugins | ||
* [linter-stylelint](https://github.com/1000ch/linter-stylelint) - An Atom Linter plugin for stylelint. | ||
* [SublimeLinter-contrib-stylelint](https://github.com/kungfusheep/SublimeLinter-contrib-stylelint) - A Sublime Text plugin for stylelint. | ||
### Other linters & formatters | ||
* [cssfmt](https://github.com/morishitter/cssfmt) - A tool that automatically formats CSS and SCSS source code. | ||
* [postcss-bem-linter](https://github.com/postcss/postcss-bem-linter) - A BEM linter for CSS. | ||
* [stylehacks](https://github.com/ben-eb/stylehacks) - Detect/remove browser hacks from CSS files. | ||
### Editor plugins | ||
* [linter-stylelint](https://github.com/1000ch/linter-stylelint) - An Atom Linter plugin for stylelint. | ||
## Requirements | ||
@@ -209,0 +217,0 @@ |
@@ -26,3 +26,3 @@ import { | ||
except: [ "blockless-group", "first-nested", "all-nested" ], | ||
ignore: ["all-nested"], | ||
ignore: [ "after-comment", "all-nested" ], | ||
}, | ||
@@ -41,2 +41,6 @@ optional: true, | ||
// Optionally ignore the expectation if a comment precedes this node | ||
if (optionsHaveIgnored(options, "after-comment") | ||
&& atRule.prev() && atRule.prev().type === "comment") { return } | ||
const emptyLineBefore = atRule.before.indexOf("\n\n") !== -1 | ||
@@ -43,0 +47,0 @@ || atRule.before.indexOf("\r\n\r\n") !== -1 |
@@ -164,2 +164,19 @@ # at-rule-empty-line-before | ||
### `ignore: ["after-comment"]` | ||
Ignore rules that come after a comment. | ||
The following patterns are *not* considered warnings: | ||
```css | ||
/* comment */ | ||
@media {} | ||
``` | ||
```css | ||
/* comment */ | ||
@media {} | ||
``` | ||
### `ignore: ["all-nested"]` | ||
@@ -166,0 +183,0 @@ |
@@ -80,3 +80,3 @@ import { repeat, isNumber, isBoolean } from "lodash" | ||
const { before, after } = node | ||
let { before, after } = node | ||
@@ -90,2 +90,7 @@ // Only inspect the spaces before the node | ||
// Cut out any * hacks from `before` | ||
before = (before[before.length - 1] === "*") | ||
? before.slice(0, before.length - 1) | ||
: before | ||
// Inspect whitespace in the `before` string that is | ||
@@ -92,0 +97,0 @@ // *after* the *last* newline character, |
@@ -34,3 +34,7 @@ import { | ||
root.eachAtRule(atRule => { | ||
const params = atRule.params | ||
const { name, params } = atRule | ||
// Only deal with @media at-rules | ||
if (name !== "media") { return } | ||
styleSearch({ source: params, target: ":" }, match => { | ||
@@ -37,0 +41,0 @@ checkColon(params, match.startIndex, atRule) |
@@ -11,2 +11,13 @@ # property-no-vendor-prefix | ||
This rule does not blanketly condemn vendor prefixes. | ||
Instead, it uses [Autoprefixer's](https://github.com/postcss/autoprefixer) up-to-date | ||
data (from [caniuse.com](http://caniuse.com/)) to know whether a vendor prefix should | ||
cause a warning or not. | ||
*If you've included a vendor prefixed property that has a standard alternative, | ||
one that Autoprefixer could take care of for you, | ||
this rule will warn about it*. | ||
If, however, you use a non-standard vendor-prefixed property, | ||
one that Autoprefixer would ignore and could not provide (such as `-webkit-touch-callout`), | ||
this rule will ignore it. | ||
The following patterns are considered warnings: | ||
@@ -32,1 +43,5 @@ | ||
``` | ||
```css | ||
a { -webkit-touch-callout: none; } | ||
``` |
@@ -12,4 +12,3 @@ import { | ||
rejected: (shorthand, original) => ( | ||
`Unexpected shorthand property override: ` + | ||
`"${shorthand}" will override "${original}"` | ||
`Unexpected shorthand "${shorthand}" after "${original}"` | ||
), | ||
@@ -16,0 +15,0 @@ }) |
@@ -11,2 +11,13 @@ # selector-no-vendor-prefix | ||
This rule does not blanketly condemn vendor prefixes. | ||
Instead, it uses [Autoprefixer's](https://github.com/postcss/autoprefixer) up-to-date | ||
data (from [caniuse.com](http://caniuse.com/)) to know whether a vendor prefix should | ||
cause a warning or not. | ||
*If you've included a vendor prefixed selector that has a standard alternative, | ||
one that Autoprefixer could take care of for you, | ||
this rule will warn about it*. | ||
If, however, you use a non-standard vendor-prefixed selector, | ||
one that Autoprefixer would ignore and could not provide, | ||
this rule will ignore it. | ||
The following patterns are considered warnings: | ||
@@ -13,0 +24,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
222
483128
307
10479