-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Showing
13 changed files
with
324 additions
and
1 deletion.
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,10 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = 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 @@ | ||
* 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,2 @@ | ||
node_modules | ||
package-lock.json |
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,23 @@ | ||
sudo: false | ||
|
||
git: | ||
depth: 1 | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
language: node_js | ||
|
||
# cache node modules | ||
cache: | ||
directories: | ||
- node_modules | ||
|
||
node_js: | ||
- '8' | ||
- '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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2017 stylelint | ||
|
||
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 |
---|---|---|
@@ -1,2 +1,58 @@ | ||
# stylelint-config-recommended | ||
The recommended shareable config for stylelint | ||
|
||
[](https://www.npmjs.org/package/stylelint-config-recommended) [](https://travis-ci.org/stylelint/stylelint-config-recommended) [](https://ci.appveyor.com/project/stylelint/stylelint-config-recommended/branch/master) | ||
|
||
> The recommended shareable config for stylelint. | ||
It turns on all the _possible errors_ rules within stylelint. | ||
|
||
Use it as is or as a foundation for your own config. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install stylelint-config-recommended --save-dev | ||
``` | ||
|
||
## Usage | ||
|
||
If you've installed `stylelint-config-recommended` locally within your project, just set your `stylelint` config to: | ||
|
||
```json | ||
{ | ||
"extends": "stylelint-config-recommended" | ||
} | ||
``` | ||
|
||
If you've globally installed `stylelint-config-recommended` using the `-g` flag, then you'll need to use the absolute path to `stylelint-config-recommended` in your config e.g. | ||
|
||
```json | ||
{ | ||
"extends": "/absolute/path/to/stylelint-config-recommended" | ||
} | ||
``` | ||
|
||
### Extending the config | ||
|
||
Simply add a `"rules"` key to your config, then add your overrides and additions there. | ||
|
||
For example, to turn off the `block-no-empty` rule, change the `property-no-unknown` rule to use its `ignoreAtRules` option and add the `unit-whitelist` rule: | ||
|
||
```json | ||
{ | ||
"extends": "stylelint-config-recommended", | ||
"rules": { | ||
"block-no-empty": "tab", | ||
"property-no-unknown": [ true, { | ||
"ignoreProperties": [ | ||
"composes" | ||
] | ||
}], | ||
"unit-whitelist": ["em", "rem", "s"] | ||
} | ||
} | ||
``` | ||
|
||
## [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,3 @@ | ||
madeup { | ||
top: 0; | ||
} |
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,10 @@ | ||
@import url(x.css); | ||
|
||
.selector-1, | ||
.selector-2, | ||
.selector-3[type="text"] { | ||
background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); | ||
box-sizing: border-box; | ||
display: block; | ||
color: #333; | ||
} |
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,84 @@ | ||
"use strict" | ||
|
||
const fs = require("fs") | ||
const config = require("../") | ||
const stylelint = require("stylelint") | ||
|
||
const validCss = fs.readFileSync("./__tests__/css-valid.css", "utf-8") | ||
const invalidCss = fs.readFileSync("./__tests__/css-invalid.css", "utf-8") | ||
|
||
describe("flags no warnings with valid css", () => { | ||
let result | ||
|
||
beforeEach(() => { | ||
result = stylelint.lint({ | ||
code: validCss, | ||
config, | ||
}) | ||
}) | ||
|
||
it("did not error", () => { | ||
return result.then(data => ( | ||
expect(data.errored).toBeFalsy() | ||
)) | ||
}) | ||
|
||
it("flags no warnings", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings.length).toBe(0) | ||
)) | ||
}) | ||
}) | ||
|
||
describe("flags warnings with invalid css", () => { | ||
let result | ||
|
||
beforeEach(() => { | ||
result = stylelint.lint({ | ||
code: invalidCss, | ||
config, | ||
}) | ||
}) | ||
|
||
it("did error", () => { | ||
return result.then(data => ( | ||
expect(data.errored).toBeTruthy() | ||
)) | ||
}) | ||
|
||
it("flags one warning", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings.length).toBe(1) | ||
)) | ||
}) | ||
|
||
it("correct warning text", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].text).toBe("Unexpected unknown type selector \"madeup\" (selector-type-no-unknown)") | ||
)) | ||
}) | ||
|
||
it("correct rule flagged", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].rule).toBe("selector-type-no-unknown") | ||
)) | ||
}) | ||
|
||
it("correct severity flagged", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].severity).toBe("error") | ||
)) | ||
}) | ||
|
||
it("correct line number", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].line).toBe(1) | ||
)) | ||
}) | ||
|
||
it("correct column number", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].column).toBe(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,22 @@ | ||
# http://www.appveyor.com/docs/appveyor-yml | ||
|
||
environment: | ||
matrix: | ||
- nodejs_version: 6 | ||
|
||
version: "{build}" | ||
build: off | ||
deploy: off | ||
branches: | ||
only: | ||
- master | ||
clone_depth: 1 | ||
skip_tags: true | ||
install: | ||
- ps: Install-Product node $env:nodejs_version | ||
- npm install | ||
|
||
test_script: | ||
- node --version | ||
- npm --version | ||
- cmd: "npm test" |
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,30 @@ | ||
"use strict" | ||
|
||
module.exports = { | ||
"rules": { | ||
"at-rule-no-unknown": true, | ||
"block-no-empty": true, | ||
"color-no-invalid-hex": true, | ||
"comment-no-empty": true, | ||
"declaration-block-no-duplicate-properties": [ true, { | ||
ignore: ["consecutive-duplicates-with-different-values"], | ||
} ], | ||
"declaration-block-no-redundant-longhand-properties": true, | ||
"declaration-block-no-shorthand-property-overrides": true, | ||
"font-family-no-duplicate-names": true, | ||
"function-calc-no-unspaced-operator": true, | ||
"function-linear-gradient-no-nonstandard-direction": true, | ||
"keyframe-declaration-no-important": true, | ||
"media-feature-name-no-unknown": true, | ||
"no-empty-source": true, | ||
"no-extra-semicolons": true, | ||
"no-invalid-double-slash-comments": true, | ||
"property-no-unknown": true, | ||
"selector-pseudo-class-no-unknown": true, | ||
"selector-pseudo-element-no-unknown": true, | ||
"selector-type-no-unknown": true, | ||
"shorthand-property-no-redundant-values": true, | ||
"string-no-newline": true, | ||
"unit-no-unknown": 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,58 @@ | ||
{ | ||
"name": "stylelint-config-recommended", | ||
"version": "0.1.0", | ||
"description": "Recommended shareable config for stylelint", | ||
"keywords": [ | ||
"stylelint", | ||
"stylelint-config", | ||
"recommended" | ||
], | ||
"author": "stylelint", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/stylelint/stylelint-config-recommended.git" | ||
}, | ||
"main": "index.js", | ||
"files": [ | ||
"index.js" | ||
], | ||
"devDependencies": { | ||
"eslint": "^4.1.0", | ||
"eslint-config-stylelint": "^6.0.0", | ||
"jest": "^20.0.0", | ||
"npm-run-all": "^4.0.0", | ||
"npmpub": "^3.0.1", | ||
"remark-cli": "^3.0.0", | ||
"remark-preset-lint-consistent": "^2.0.0", | ||
"remark-preset-lint-recommended": "^2.0.0", | ||
"stylelint": "^7.12.0" | ||
}, | ||
"peerDependencies": { | ||
"stylelint": "^7.8.0" | ||
}, | ||
"scripts": { | ||
"lint:js": "eslint . --ignore-path .gitignore", | ||
"lint:md": "remark . --quiet --frail", | ||
"lint": "npm-run-all --parallel lint:*", | ||
"pretest": "npm run lint", | ||
"release": "npmpub", | ||
"test": "jest", | ||
"watch": "jest --watch" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"stylelint" | ||
] | ||
}, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"verbose": true | ||
}, | ||
"remarkConfig": { | ||
"plugins": [ | ||
"preset-lint-recommended", | ||
"preset-lint-consistent" | ||
] | ||
} | ||
} |