Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Van Camp committed Oct 25, 2019
0 parents commit e389d66
Show file tree
Hide file tree
Showing 12 changed files with 7,568 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
package-lock.json
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Games Done Quick, LLC

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.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# GDQ's stylelint-config [![npm](https://img.shields.io/npm/v/@gamesdonequick/stylelint-config.svg)](https://www.npmjs.com/package/@gamesdonequick/stylelint-config) [![Build Status](https://dev.azure.com/gamesdonequick/stylelint-config/_apis/build/status/GamesDoneQuick.stylelint-config?branchName=master)](https://dev.azure.com/gamesdonequick/stylelint-config/_build/latest?definitionId=6&branchName=master)

> Our re-usable config for the Stylelint CSS linter.
## Usage

1. Install this config as a devDependency:

```bash
npm i -D @gamesdonequick/stylelint-config
```

2. Follow the instructions here to use or extend our config: https://stylelint.io/user-guide/configuration#extends

3. This package actually includes multiple configs. One base config, and one that has some rules specific to PostCSS. You can pick and choose what parts you wish to use. To use both, your config might look like this:

```js
module.exports = {
extends: ['@gamesdonequick/stylelint-config', './node_modules/@gamesdonequick/stylelint-config/postcss'],
};
```
18 changes: 18 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variables:
- group: Publishing Secrets

trigger:
- master

pool:
vmImage: "Ubuntu-16.04"

steps:
- script: npm i
displayName: "Install npm dependencies"

- script: npx semantic-release
displayName: "Release"
env:
GH_TOKEN: $(GH_TOKEN)
NPM_TOKEN: $(NPM_TOKEN)
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
};
111 changes: 111 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* Rules
* https://stylelint.io/user-guide/rules/
* https://github.com/stylelint/stylelint/blob/master/docs/user-guide/rules.md
*/
const POSSIBLE_ERRORS = {
'color-no-invalid-hex': true,
'function-calc-no-unspaced-operator': true,
'function-linear-gradient-no-nonstandard-direction': true,
'string-no-newline': true,
'unit-no-unknown': true,
'keyframe-declaration-no-important': true,
'property-no-unknown': true,
'declaration-block-no-duplicate-properties': true,
'declaration-block-no-shorthand-property-overrides': true,
'block-no-empty': true,
'selector-pseudo-class-no-unknown': true,
'selector-pseudo-element-no-unknown': true,
'selector-type-no-unknown': true,
'media-feature-name-no-unknown': true,
'at-rule-no-unknown': true,
'comment-no-empty': true,
'no-empty-source': true,
'no-extra-semicolons': true,
'no-invalid-double-slash-comments': true,
};

const LIMIT_LANGUAGE_FEATURES = {
'color-no-hex': true,
'function-url-no-scheme-relative': true,
'shorthand-property-no-redundant-values': true,
'value-no-vendor-prefix': true,
// NOTE: might not want this? This just disables the shorthand, which is normally
// nice. Individual properties like `font-family`, `font-size` still work.
'property-blacklist': ['font'],
'property-no-vendor-prefix': true,
'declaration-no-important': true,
'declaration-block-single-line-max-declarations': 0,
// NOTE: This is really effective with CSS modules. Without, it probably
// gets cumbersome. I'd probably limit this to 4 with modules.
'selector-max-compound-selectors': 5,
'selector-max-empty-lines': 0,
'media-feature-name-no-vendor-prefix': true,
'at-rule-no-vendor-prefix': true,
};

const STYLISTIC_ISSUES = {
// Function
'function-comma-newline-after': 'always-multi-line',
'function-comma-newline-before': 'never-multi-line',
'function-max-empty-lines': 0,
'function-name-case': 'lower',
'function-parentheses-newline-inside': 'always-multi-line',
'function-url-quotes': 'always',
// Number
'number-leading-zero': 'always',
'number-no-trailing-zeros': true,
// String
'string-quotes': 'single',
// Length
'length-zero-no-unit': true,
// Unit
'unit-case': 'lower',
// Value List
'value-list-comma-space-after': 'always-single-line',
'value-list-comma-space-before': 'never',
// Property
'property-case': 'lower',
// Declaration
'declaration-bang-space-after': 'never',
'declaration-bang-space-before': 'always',
'declaration-colon-space-after': 'always-single-line',
'declaration-colon-space-before': 'never',
// Declaration block
'declaration-block-semicolon-newline-after': 'always',
'declaration-block-semicolon-newline-before': 'never-multi-line',
// Block
'block-opening-brace-newline-after': 'always',
'block-opening-brace-space-before': 'always',
'block-closing-brace-empty-line-before': 'never',
// Selector
'selector-attribute-brackets-space-inside': 'never',
'selector-combinator-space-after': 'always',
'selector-combinator-space-before': 'always',
'selector-pseudo-class-case': 'lower',
'selector-pseudo-class-parentheses-space-inside': 'never',
'selector-pseudo-element-colon-notation': 'single',
'selector-type-case': 'lower',
// Selector list
'selector-list-comma-newline-after': 'always',
'selector-list-comma-space-before': 'never',
// Media feature
'media-feature-colon-space-after': 'always',
'media-feature-colon-space-before': 'never',
'media-feature-range-operator-space-after': 'always',
'media-feature-range-operator-space-before': 'always',
// Media query list
'media-query-list-comma-newline-after': 'never-multi-line',
'media-query-list-comma-newline-before': 'never-multi-line',
'media-query-list-comma-space-after': 'always-single-line',
'media-query-list-comma-space-before': 'never',
// General / Sheet
indentation: 2,
'max-empty-lines': 1,
'no-eol-whitespace': true,
'rule-empty-line-before': ['always', { ignore: ['after-comment', 'first-nested'] }],
};

module.exports = {
rules: { ...POSSIBLE_ERRORS, ...LIMIT_LANGUAGE_FEATURES, ...STYLISTIC_ISSUES },
};
Loading

0 comments on commit e389d66

Please sign in to comment.