Skip to content

Commit

Permalink
chore: update stylelint docs, use js file for configuration (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
staylor authored Jun 19, 2020
1 parent 12aa306 commit 1201505
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 70 deletions.
30 changes: 30 additions & 0 deletions packages/stylelint-config-kyt/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
modules.exports = {
extends: 'stylelint-config-standard',

rules: {
'string-quotes': 'single',
'selector-max-id': 0,
'property-no-unknown': [true, { ignoreProperties: ['composes'] }],
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['export', 'import', 'global', 'local'],
},
],
'function-url-scheme-blacklist': 'never',
'property-no-vendor-prefix': true,
'selector-no-vendor-prefix': true,
'selector-class-pattern': [
'^[a-zA-Z0-9_]+$',
{
message: 'Selector should be alhpanumeric, without hyphens [stylelint-config-kyt]',
},
],
'at-rule-no-unknown': [
true,
{
ignoreAtRules: ['extend', 'include', 'mixin', 'if', 'else', 'for'],
},
],
},
};
62 changes: 28 additions & 34 deletions packages/stylelint-config-kyt/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
# kyt Stylelint Linter and CSS/Sass Style Guide
# NYT Stylelint and SCSS Style Guide

This is an extension of [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) with some overrides for CSS/Sass Modules.

## Table of Contents

1. [Install](#install)
1. [CSS + Sass Guide](#css--sass-guide)
- [Formatting](#formatting)
- [Comments](#comments)
- [ID Selectors](#id-selectors)
- [Syntax](#syntax)
- [Ordering](#ordering-of-property-declarations)
- [Variables](#variables)
- [Mixins](#mixins)
1. [Changelog](#changelog)

## Install

If you want to install this linter extension, follow these install instructions.

1. Install the `stylelint-config-kyt` npm package:
```
npm i --save-dev stylelint stylelint-config-kyt stylelint-config-standard
```
1. Add a `.stylelintrc` file to your project's root
1. Add configuration:
```
yarn add --dev [email protected] \
[email protected] \
stylelint-config-kyt
// or
npm i --save-dev --save-exact [email protected] \
[email protected] \
stylelint-config-kyt
```

## Configuration

Add a `.stylelintrc` file to your project's root with these contents:

```json
{
Expand All @@ -35,8 +31,6 @@ If you want to install this linter extension, follow these install instructions.

## CSS + Sass Guide

The following guide is best used with the `kyt` linter against CSS/Sass Modules.

### Formatting

- Use soft tabs (2 spaces) for indentation.
Expand Down Expand Up @@ -102,8 +96,8 @@ You should never define an ID selector in a CSS Module.

### Ordering of property declarations

1. `@include` or `composes` declarations
2. Property declarations in alphabetical order
* `@include` or `composes` declarations
* Property declarations in alphabetical order

```scss
.btnGreen {
Expand All @@ -115,20 +109,20 @@ You should never define an ID selector in a CSS Module.
}
```

3. Nested pseudo-selectors
* Nested pseudo-selectors

Nested pseudo-selectors go last, and nothing goes after them.
Nested pseudo-selectors go last, and nothing goes after them.

```scss
.btn {
@include color(red);
font-weight: bold;
```scss
.btn {
@include color(red);
font-weight: bold;

&:hover {
cursor: pointer;
}
&:hover {
cursor: pointer;
}
```
}
```

### Variables

Expand Down
8 changes: 6 additions & 2 deletions packages/stylelint-config-kyt/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"name": "stylelint-config-kyt",
"version": "1.0.0-beta.40.2",
"main": "stylelintrc.json",
"main": ".stylelintrc.js",
"description": "StyleLint configuration for kyt projects.",
"author": "NYTimes",
"license": "Apache-2.0",
"repository": "git+https://github.com/nytimes/kyt/packages/stylelint-config-kyt",
"repository": {
"type" : "git",
"url" : "https://github.com/nytimes/kyt.git",
"directory": "packages/stylelint-config-kyt"
},
"bugs": "https://github.com/nytimes/kyt/issues",
"homepage": "https://github.com/nytimes/kyt#readme",
"peerDependencies": {
Expand Down
34 changes: 0 additions & 34 deletions packages/stylelint-config-kyt/stylelintrc.json

This file was deleted.

0 comments on commit 1201505

Please sign in to comment.