Initial commit

This commit is contained in:
Patrick Marsceill
2017-03-09 13:16:08 -05:00
commit b7b0d0d7bf
4147 changed files with 401224 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
{
"plugins": [
"eslint-plugin-github"
],
"env": {
"node": true
},
"extends": [
"plugin:github/recommended"
]
}

View File

@@ -0,0 +1,2 @@
node_modules
npm-debug.log

View File

@@ -0,0 +1,3 @@
language: node_js
node_js:
- '5'

View File

@@ -0,0 +1,20 @@
# HEAD
# 1.3.0
- Updating to latest Utilities
# 1.2.0
- Updating dependency for stylelint@7.0.0
- Updating to latest Utilities
# 1.1.0
* Updated: Using updated primer-utilities module to pull classes in through exports
* Added: Class name to error message
# 1.0.0
* Added: New rule `selector-no-utility`

21
node_modules/stylelint-selector-no-utility/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 GitHub Inc.
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.

70
node_modules/stylelint-selector-no-utility/README.md generated vendored Normal file
View File

@@ -0,0 +1,70 @@
# selector-no-utility
[![NPM version](http://img.shields.io/npm/v/stylelint-selector-no-utility.svg)](https://www.npmjs.org/package/stylelint-selector-no-utility)
[![Build Status](https://travis-ci.org/primer/stylelint-selector-no-utility.svg?branch=master)](https://travis-ci.org/primer/stylelint-selector-no-utility)
**This plugin is extra specific to [primer-utilities](https://github.com/primer/utilities)** I will accept PRs to make it more generic, or feel free to fork and use it for your own classes.
You should not be able to style a utility classes. Utility classes are single purpose, reusing them to add extra style violates their single purpose.
```css
.m-0, #bar .float-left, #hoo { border: 1px solid pink; }
/** ↑ ↑
* Each of these selectors */
```
The following patterns are considered warnings:
```css
#bar .float-left { border: 1px solid pink; }
```
```scss
#bar {
.float-left { border: 1px solid pink; }
}
```
The following patterns are *not* considered warnings:
```css
#bar { color: pink; }
```
## Install
This repository is distributed with [npm][npm]. After [installing npm][install-npm], you can install `stylelint-function-url-no-domain` with this command.
```
$ npm install --save-dev stylelint-function-url-no-domain
```
## Usage
In your [stylelint config](http://stylelint.io/user-guide/configuration/) add this.
```json
{
"plugins": [
"stylelint-selector-no-utility"
],
"rules": {
"primer/selector-no-utility": true
}
}
```
## Related
* [Stylelint](http://stylelint.io/)
* [primer-css][primer]
## License
MIT © [GitHub](https://github.com/)
[primer]: https://github.com/primer/primer
[docs]: http://primercss.io/
[npm]: https://www.npmjs.com/
[install-npm]: https://docs.npmjs.com/getting-started/installing-node
[sass]: http://sass-lang.com/

47
node_modules/stylelint-selector-no-utility/index.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
var stylelint = require("stylelint")
var primerUtilities = require("primer-utilities")
var ruleName = "primer/selector-no-utility"
var messages = stylelint.utils.ruleMessages(ruleName, {
rejected: function(classname) { return "Avoid styling the utilty class `" + classname + "`" }
})
module.exports = stylelint.createPlugin(ruleName, function(enabled) {
return function(root, result) {
var validOptions = stylelint.utils.validateOptions(result, ruleName, {
actual: enabled,
possible: [true, false]
})
if (!validOptions) { return }
var utilityClasses = primerUtilities.cssstats.selectors.values
if (utilityClasses.length === 0) {
return
}
root.walkRules(function(rule) {
var ruleClasses = rule.selector.match(/\.[a-z\-_0-9]+/ig)
if (ruleClasses != null) {
for (var i = 0; i < ruleClasses.length; i++) {
var ruleClass = ruleClasses[i]
if (utilityClasses.indexOf(ruleClass) >= 0) {
stylelint.utils.report({
message: messages.rejected(ruleClass),
node: rule,
result: result,
ruleName: ruleName
})
}
}
}
})
}
})
module.exports.ruleName = ruleName
module.exports.messages = messages

View File

@@ -0,0 +1,92 @@
{
"_args": [
[
"stylelint-selector-no-utility@^1.5.0",
"/Users/pmarsceill/_projects/just-the-docs/node_modules/stylelint-config-primer"
]
],
"_from": "stylelint-selector-no-utility@>=1.5.0 <2.0.0",
"_id": "stylelint-selector-no-utility@1.5.0",
"_inCache": true,
"_installable": true,
"_location": "/stylelint-selector-no-utility",
"_nodeVersion": "7.2.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/stylelint-selector-no-utility-1.5.0.tgz_1480430260074_0.470655329991132"
},
"_npmUser": {
"email": "yes@jonrohan.codes",
"name": "jonrohan"
},
"_npmVersion": "3.10.9",
"_phantomChildren": {},
"_requested": {
"name": "stylelint-selector-no-utility",
"raw": "stylelint-selector-no-utility@^1.5.0",
"rawSpec": "^1.5.0",
"scope": null,
"spec": ">=1.5.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/stylelint-config-primer"
],
"_resolved": "https://registry.npmjs.org/stylelint-selector-no-utility/-/stylelint-selector-no-utility-1.5.0.tgz",
"_shasum": "c11099efffb3b49c58ce1af58f2d48fb4e13c2cc",
"_shrinkwrap": null,
"_spec": "stylelint-selector-no-utility@^1.5.0",
"_where": "/Users/pmarsceill/_projects/just-the-docs/node_modules/stylelint-config-primer",
"author": {
"name": "GitHub, Inc."
},
"bugs": {
"url": "https://github.com/primer/stylelint-selector-no-utility/issues"
},
"dependencies": {
"primer-utilities": "^3.0.0",
"stylelint": "^7.0.0"
},
"description": "Stylelint rule that doesn't allow the styling of utility classes in CSS",
"devDependencies": {
"eslint": "^3.3.1",
"eslint-plugin-github": "^0.6.1",
"stylelint-test-rule-tape": "^0.2.0"
},
"directories": {},
"dist": {
"shasum": "c11099efffb3b49c58ce1af58f2d48fb4e13c2cc",
"tarball": "https://registry.npmjs.org/stylelint-selector-no-utility/-/stylelint-selector-no-utility-1.5.0.tgz"
},
"gitHead": "aa5a278c1e646e0e011f79bbbcfbd182304678e7",
"homepage": "https://github.com/primer/stylelint-selector-no-utility#readme",
"keywords": [
"css",
"domain",
"github",
"primer",
"stylelint",
"stylelint-rule",
"url"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "jonrohan",
"email": "yes@jonrohan.codes"
}
],
"name": "stylelint-selector-no-utility",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/primer/stylelint-selector-no-utility.git"
},
"scripts": {
"lint": "eslint .",
"test": "npm run lint && node test"
},
"version": "1.5.0"
}

View File

@@ -0,0 +1,18 @@
var testRule = require("stylelint-test-rule-tape")
var rule = require("..")
testRule(rule.rule, {
ruleName: rule.ruleName,
config: true,
skipBasicChecks: true,
accept: [
{ code: "a { }" }
],
reject: [
{ code: ".m-0 { color: #fff; }" },
{ code: ".m-0:hover { color: #fff; }" },
{ code: ".m-2, .foo { color: #fff; }" },
{ code: ".m-2[type=button] { color: #fff; }" },
{ code: ".foo.m-0 { color: #fff; }" }
]
})