Skip to content

Commit

Permalink
Fix #28 Add stylelint-prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgenyOrekhov committed Jun 4, 2020
1 parent dcdf27b commit 3dc01ee
Show file tree
Hide file tree
Showing 9 changed files with 2,649 additions and 2,659 deletions.
21 changes: 21 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": ["./base.json", "stylelint-prettier/recommended"],

"rules": {
"at-rule-empty-line-before": [
"always",
{
"except": ["blockless-after-same-name-blockless", "first-nested"],
"ignore": ["after-comment"]
}
],

"rule-empty-line-before": [
"always-multi-line",
{
"except": ["first-nested"],
"ignore": ["after-comment"]
}
]
}
}
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
{
"language": "node_js",
"node_js": [
"stable"
]
}
{ "language": "node_js", "node_js": ["stable"] }
54 changes: 7 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,23 @@
# stylelint-config
# @twinscom/stylelint-config

[![npm (scoped)](https://img.shields.io/npm/v/@twinscom/stylelint-config.svg?style=flat-square)](https://www.npmjs.com/package/@twinscom/stylelint-config)

> A shareable config for stylelint.
Extends [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard).

Turns on additional rules and overrides the `indentation` rule to use 4 spaces.

It favours strictness over flexibility for things like multi-line lists and single-line rulesets, and doesn't try to avoid potentially divisive rules.

Use it as is or as a foundation for your own config.

To see the rules that this config uses, please read the [config itself](./index.json).
Based on
[`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard)
and
[`stylelint-prettier`](https://github.com/prettier/stylelint-prettier).

## Installation

```sh
npm install --save-dev @twinscom/stylelint-config
```

## Usage

If you've installed `@twinscom/stylelint-config` locally within your project, just set your `stylelint` config to:

```json
{
"extends": "@twinscom/stylelint-config"
}
```

If you've globally installed `@twinscom/stylelint-config` using the `-g` flag, then you'll need to use the absolute path to `@twinscom/stylelint-config` in your config e.g.

```json
{
"extends": "/absolute/path/to/@twinscom/stylelint-config"
}
```

### Extending the config

Simply add a `"rules"` key to your config, then add your overrides and additions there.

For example, to change the `at-rule-no-unknown` rule to use its `ignoreAtRules` option, change the `indentation` to tabs, turn off the `number-leading-zero` rule, and add the `unit-whitelist` rule:
Then set your `.stylelintrc.json` config to:

```json
{
"extends": "@twinscom/stylelint-config",
"rules": {
"at-rule-no-unknown": [ true, {
"ignoreAtRules": [
"extends",
"ignores"
]
}],
"indentation": "tab",
"number-leading-zero": null,
"unit-whitelist": ["em", "rem", "s"]
}
"extends": ["@twinscom/stylelint-config"]
}
```

Expand Down
56 changes: 56 additions & 0 deletions base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"extends": ["stylelint-config-standard"],

"plugins": [
"stylelint-declaration-strict-value",
"stylelint-declaration-block-no-ignored-properties"
],

"rules": {
"at-rule-no-vendor-prefix": true,
"color-named": "never",
"declaration-block-no-redundant-longhand-properties": true,
"declaration-no-important": true,
"font-family-name-quotes": "always-unless-keyword",
"font-weight-notation": "named-where-possible",
"function-url-no-scheme-relative": true,
"function-url-quotes": "always",
"max-nesting-depth": 5,
"media-feature-name-no-vendor-prefix": true,
"no-unknown-animations": true,
"number-max-precision": 2,
"property-no-vendor-prefix": true,
"selector-max-attribute": 5,
"selector-max-class": 5,
"selector-max-combinators": 5,
"selector-max-compound-selectors": 5,
"selector-max-id": 0,
"selector-max-pseudo-class": 5,
"selector-max-specificity": "0,5,5",
"selector-max-type": 5,
"selector-max-universal": 0,
"selector-no-vendor-prefix": true,
"selector-pseudo-element-colon-notation": "double",
"selector-pseudo-element-no-unknown": true,
"shorthand-property-no-redundant-values": true,
"time-min-milliseconds": [100, { "ignore": ["delay"] }],
"value-no-vendor-prefix": true,
"selector-no-qualifying-type": true,
"block-no-empty": [true, { "ignore": ["comments"] }],
"alpha-value-notation": "number",
"color-function-notation": "modern",
"hue-degree-notation": "angle",

"scale-unlimited/declaration-strict-value": [
"/color$/",
{
"ignoreVariables": true,
"ignoreFunctions": false,
"ignoreKeywords": ["currentColor", "transparent", "inherit"],
"disableFix": true
}
],

"plugin/declaration-block-no-ignored-properties": true
}
}
69 changes: 34 additions & 35 deletions disabled-rules.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
{
"block-opening-brace-newline-before": null,
"color-no-hex": null,
"color-no-hex": null,

"at-rule-blacklist": null,
"at-rule-property-requirelist": null,
"at-rule-whitelist": null,
"comment-word-blacklist": null,
"custom-media-pattern": null,
"custom-property-pattern": null,
"declaration-property-unit-blacklist": null,
"declaration-property-unit-whitelist": null,
"declaration-property-value-blacklist": null,
"declaration-property-value-whitelist": null,
"function-blacklist": null,
"function-url-scheme-blacklist": null,
"function-url-scheme-whitelist": null,
"function-whitelist": null,
"keyframes-name-pattern": null,
"media-feature-name-blacklist": null,
"media-feature-name-value-whitelist": null,
"media-feature-name-whitelist": null,
"property-blacklist": null,
"property-whitelist": null,
"selector-attribute-operator-blacklist": null,
"selector-attribute-operator-whitelist": null,
"selector-class-pattern": null,
"selector-combinator-blacklist": null,
"selector-combinator-whitelist": null,
"selector-id-pattern": null,
"selector-nested-pattern": null,
"selector-pseudo-class-blacklist": null,
"selector-pseudo-class-whitelist": null,
"selector-pseudo-element-blacklist": null,
"selector-pseudo-element-whitelist": null,
"unit-blacklist": null,
"unit-whitelist": null
"at-rule-blacklist": null,
"at-rule-property-requirelist": null,
"at-rule-whitelist": null,
"comment-word-blacklist": null,
"custom-media-pattern": null,
"custom-property-pattern": null,
"declaration-property-unit-blacklist": null,
"declaration-property-unit-whitelist": null,
"declaration-property-value-blacklist": null,
"declaration-property-value-whitelist": null,
"function-blacklist": null,
"function-url-scheme-blacklist": null,
"function-url-scheme-whitelist": null,
"function-whitelist": null,
"keyframes-name-pattern": null,
"media-feature-name-blacklist": null,
"media-feature-name-value-whitelist": null,
"media-feature-name-whitelist": null,
"property-blacklist": null,
"property-whitelist": null,
"selector-attribute-operator-blacklist": null,
"selector-attribute-operator-whitelist": null,
"selector-class-pattern": null,
"selector-combinator-blacklist": null,
"selector-combinator-whitelist": null,
"selector-id-pattern": null,
"selector-nested-pattern": null,
"selector-pseudo-class-blacklist": null,
"selector-pseudo-class-whitelist": null,
"selector-pseudo-element-blacklist": null,
"selector-pseudo-element-whitelist": null,
"unit-blacklist": null,
"unit-whitelist": null
}
76 changes: 0 additions & 76 deletions index.json

This file was deleted.

0 comments on commit 3dc01ee

Please sign in to comment.