-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1ceab20
Showing
15 changed files
with
1,232 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*.css.map | ||
.bundle | ||
.sass-cache | ||
node_modules | ||
npm-debug.log | ||
vendor | ||
notes.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
sudo: false | ||
|
||
git: | ||
depth: 1 | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
language: node_js | ||
|
||
# cache node modules | ||
cache: | ||
directories: | ||
- node_modules | ||
|
||
node_js: | ||
- '6' | ||
|
||
before_install: | ||
# remove outdated deps, assists with cache maintenance | ||
- npm prune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 0.1.0 | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source "https://rubygems.org" | ||
|
||
gem 'scss_lint', require: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
rake (11.2.2) | ||
sass (3.4.22) | ||
scss_lint (0.48.0) | ||
rake (>= 0.9, < 12) | ||
sass (~> 3.4.15) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
scss_lint | ||
|
||
BUNDLED WITH | ||
1.12.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Brett Jankord | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# stylelint-config-sass-guidelines | ||
|
||
> Sass Guidelines shareable config for stylelint. | ||
Configuration rules to ensure your CSS code is compliant with [Sass Guidelines's code style](https://sass-guidelin.es/). | ||
|
||
## Installation | ||
|
||
```console | ||
$ npm install --save stylelint-config-sass-guidelines | ||
``` | ||
|
||
## Usage | ||
|
||
Set your stylelint config to: | ||
|
||
```json | ||
{ | ||
"extends": "stylelint-config-sass-guidelines" | ||
} | ||
``` | ||
|
||
### Extending the config | ||
|
||
Simply add a `"rules"` key to your config and add your overrides there. | ||
|
||
For example, to change the `indentation` to tabs and turn off the `number-leading-zero` rule: | ||
|
||
|
||
```json | ||
{ | ||
"extends": "stylelint-config-sass-guidelines", | ||
"rules": { | ||
"indentation": "tab", | ||
"number-leading-zero": null | ||
} | ||
} | ||
``` | ||
|
||
## [Changelog](CHANGELOG.md) | ||
|
||
## [License](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import config from "../" | ||
import stylelint from "stylelint" | ||
import test from "ava" | ||
|
||
const validCss = ( | ||
`@import url('x.css'); | ||
@import url('y.css'); | ||
/** | ||
* Multi-line comment | ||
*/ | ||
.selector-foo, | ||
.selector-bar, | ||
.selector-baz[type='text'] { | ||
background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); | ||
box-sizing: border-box; | ||
display: block; | ||
color: #333; | ||
} | ||
.selector-a, | ||
.selector-b:not(:first-child) { | ||
padding: 10px !important; | ||
top: calc(calc(1em * 2) / 3); | ||
} | ||
.selector-x { width: 10%; } | ||
.selector-y { width: 20%; } | ||
.selector-z { width: 30%; } | ||
/* Single-line comment */ | ||
@media (min-width >= 60em) { | ||
.selector { | ||
/* Flush to parent comment */ | ||
transform: translate(1, 1) scale(3); | ||
} | ||
} | ||
@media (min-orientation: portrait), projection and (color) { | ||
.selector-i + .selector-ii { | ||
background: color(rgb(0, 0, 0) lightness(50%)); | ||
font-family: helvetica, 'arial black', sans-serif; | ||
} | ||
} | ||
/* Flush single line comment */ | ||
@media screen and (min-resolution: 192dpi), screen and (min-resolution: 2dppx) { | ||
.selector { | ||
background-image: | ||
repeating-linear-gradient( | ||
-45deg, | ||
transparent, | ||
#fff 25px, | ||
rgba(255, 255, 255, 1) 50px | ||
); | ||
margin: 10px; | ||
margin-bottom: 5px; | ||
box-shadow: | ||
0 1px 1px #000, | ||
0 1px 0 #fff, | ||
2px 2px 1px 1px #ccc inset; | ||
height: 10rem; | ||
} | ||
/* Flush nested single line comment */ | ||
.selector::after { | ||
content: '→'; | ||
background-image: url('x.svg'); | ||
} | ||
} | ||
`) | ||
|
||
const invalidCss = ( | ||
`a { | ||
top: .2em; | ||
} | ||
`) | ||
|
||
test("no warnings with valid css", t => { | ||
return stylelint.lint({ | ||
code: validCss, | ||
config: config, | ||
}) | ||
.then(data => { | ||
const { errored, results } = data | ||
const { warnings } = results[0] | ||
t.falsy(errored, "no errored") | ||
t.is(warnings.length, 0, "flags no warnings") | ||
}) | ||
}) | ||
|
||
test("a warning with invalid css", t => { | ||
return stylelint.lint({ | ||
code: invalidCss, | ||
config: config, | ||
}) | ||
.then(data => { | ||
const { errored, results } = data | ||
const { warnings } = results[0] | ||
t.truthy(errored, "errored") | ||
t.is(warnings.length, 1, "flags one warning") | ||
t.is(warnings[0].text, "Expected a leading zero (number-leading-zero)", "correct warning text") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
module.exports = { | ||
"plugins": [ | ||
"stylelint-scss" | ||
], | ||
"rules": { | ||
"declaration-bang-space-after": "never", | ||
"declaration-bang-space-before": "always", | ||
"declaration-property-value-blacklist": { | ||
"/^border/": [ | ||
"none" | ||
] | ||
}, | ||
"color-named": "never", | ||
"block-closing-brace-newline-after": [ | ||
"always", | ||
{ | ||
"ignoreAtRules": ["if", "else"] | ||
} | ||
], | ||
"at-rule-blacklist": ["debug"], | ||
"rule-nested-empty-line-before": [ | ||
"always-multi-line", | ||
{ | ||
"except": [ | ||
"first-nested" | ||
], | ||
"ignore": [ | ||
"after-comment" | ||
] | ||
} | ||
], | ||
"rule-non-nested-empty-line-before": [ | ||
"always-multi-line", | ||
{ | ||
"ignore": [ | ||
"after-comment" | ||
] | ||
} | ||
], | ||
"block-no-empty": true, | ||
"color-hex-length": "short", | ||
"color-hex-case": "lower", | ||
"color-no-invalid-hex": true, | ||
"selector-no-id": true, | ||
"scss/at-import-no-partial-leading-underscore": true, | ||
"indentation": 2, | ||
"number-leading-zero": "always", | ||
"scss/at-function-pattern": "^[a-z]+([a-z0-9-]+[a-z0-9]+)?$", | ||
"scss/dollar-variable-pattern": "^[_]?[a-z]+([a-z0-9-]+[a-z0-9]+)?$", | ||
"scss/at-mixin-pattern": "^[a-z]+([a-z0-9-]+[a-z0-9]+)?$", | ||
"scss/percent-placeholder-pattern": "^[a-z]+([a-z0-9-]+[a-z0-9]+)?$", | ||
"selector-max-compound-selectors": 3, | ||
"scss/at-extend-no-missing-placeholder": true, | ||
"selector-pseudo-element-colon-notation": "double", | ||
"selector-pseudo-element-no-unknown": true, | ||
"selector-no-qualifying-type": true, | ||
"selector-class-pattern": [ | ||
"^(?:u|is|has)-[a-z][a-zA-Z0-9]*$|^(?!u|is|has)[a-zA-Z][a-zA-Z0-9]*(?:-[a-z][a-zA-Z0-9]*)?(?:--[a-z][a-zA-Z0-9]*)?$", | ||
{ | ||
"message": "Selector should be written in lowercase with hyphens (selector-class-pattern)" | ||
} | ||
], | ||
"shorthand-property-no-redundant-values": true, | ||
"declaration-block-semicolon-newline-after": "always", | ||
"declaration-block-single-line-max-declarations": 1, | ||
"selector-list-comma-newline-after": "always", | ||
"function-comma-space-after": "always-single-line", | ||
"declaration-colon-space-after": "always-single-line", | ||
"declaration-colon-space-before": "never", | ||
"function-calc-no-unspaced-operator": true, | ||
"block-opening-brace-space-before": "always", | ||
"string-quotes": "single", | ||
"declaration-block-semicolon-space-before": "never", | ||
"number-no-trailing-zeros": true, | ||
"scss/selector-no-redundant-nesting-selector": true, | ||
"function-url-quotes": "always", | ||
"value-no-vendor-prefix": true, | ||
"property-no-vendor-prefix": true, | ||
"length-zero-no-unit": true, | ||
"no-missing-eof-newline": true, | ||
"max-nesting-depth": 3, | ||
|
||
|
||
|
||
"declaration-block-trailing-semicolon": "always", | ||
"no-extra-semicolons": true, | ||
"string-no-newline": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "stylelint-config-sass-guidelines", | ||
"version": "0.1.0", | ||
"description": "Sharable stylelint config based on https://sass-guidelin.es/", | ||
"keywords": [ | ||
"stylelint", | ||
"stylelint-config", | ||
"stylelint-scss", | ||
"scss", | ||
"sass", | ||
"guidelines" | ||
], | ||
"author": "Brett Jankord", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/bjankord/stylelint-config-sass-guidelines.git" | ||
}, | ||
"homepage": "https://github.com/bjankord/stylelint-config-sass-guidelines#readme", | ||
"bugs": { | ||
"url": "https://github.com/bjankord/stylelint-config-sass-guidelines/issues" | ||
}, | ||
"main": "index.js", | ||
"files": [ | ||
"index.js" | ||
], | ||
"dependencies": { | ||
"stylelint-scss": "^1.1.1", | ||
"stylelint-selector-no-utility": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.15.2", | ||
"copyfiles": "^1.0.0", | ||
"rename-files": "0.0.2", | ||
"replace": "^0.3.0", | ||
"stylelint": "^6.7.0" | ||
}, | ||
"scripts": { | ||
"ava": "ava --verbose \"__tests__/**/*.js\"", | ||
"build": "npm run copy; npm run replace; npm run rename", | ||
"copy": "copyfiles -u 1 src/.stylelintrc.json .", | ||
"rename": "rename-files ./ '.stylelintrc.json' 'index.js'", | ||
"replace": "replace '^{+\n..\"plugins\":' 'module.exports = {\n \"plugins\":' .stylelintrc.json", | ||
"scss-lint-failing-case": "cd src; bundle exec scss-lint failing-test-cases.scss -c .scss-lint.yml; exit 0", | ||
"scss-lint-passing-case": "cd src; bundle exec scss-lint passing-test-cases.scss -c .scss-lint.yml; exit 0", | ||
"stylelint-failing-case": "cd src; stylelint failing-test-cases.scss -s scss; exit 0", | ||
"stylelint-passing-case": "cd src; stylelint passing-test-cases.scss -c .stylelintrc.json -s scss; exit 0", | ||
"test": "npm run ava" | ||
} | ||
} |
Oops, something went wrong.