Skip to content

Commit

Permalink
feat(stylelint): create initial config
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewLeedham committed Dec 30, 2019
1 parent 06a4b67 commit 72f571b
Show file tree
Hide file tree
Showing 6 changed files with 907 additions and 43 deletions.
51 changes: 51 additions & 0 deletions packages/xerox-stylelint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# @xerox/stylelint-config

> Stylelint shareable configuration for Xerox projects.
[![circleci status][circleci-badge]][circleci-link]
[![npm package][npm-badge]][npm-link]
[![license MIT][license-badge]][license-link]
[![commit style angular][commit-style-badge]][commit-style-link]
[![semantic-release][semantic-release-badge]][semantic-release-link]
[![Dependabot Status][dependabot-badge]][dependabot-link]

## Usage
1. Install this config and stylelint as a `devDependency`:
```bash
yarn add stylelint @xerox/stylelint-config --dev
# or
npm install stylelint @xerox/stylelint-config --save-dev
```
2. Add the following to your `package.json`:
```jsonc
{
// ...
"stylelint": {
"extends": "@xerox/stylelint-config"
}
// ...
}
```

---
[LICENSE][license-link] | [CHANGELOG][changelog-link]

[license-link]: ../../LICENSE
[changelog-link]: ./CHANGELOG.md

[circleci-badge]: https://flat.badgen.net/circleci/github/xeroxinteractive/config/master
[circleci-link]: https://circleci.com/gh/xeroxinteractive/config/tree/master

[npm-badge]: https://flat.badgen.net/npm/v/@xerox/stylelint-config?color=cyan
[npm-link]: https://www.npmjs.com/package/@xerox/stylelint-config

[license-badge]: https://flat.badgen.net/badge/license/MIT

[commit-style-badge]: https://flat.badgen.net/badge/commit%20style/angular/purple
[commit-style-link]: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines

[semantic-release-badge]: https://flat.badgen.net/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80/semantic%20release/e10079
[semantic-release-link]: https://github.com/semantic-release/semantic-release

[dependabot-badge]: https://flat.badgen.net/dependabot/xeroxinteractive/config?icon=dependabot
[dependabot-link]: https://dependabot.com
14 changes: 14 additions & 0 deletions packages/xerox-stylelint-config/__tests__/configs.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const standalone = require('stylelint/lib/standalone');
const { join } = require('path');

test.each(['index.js', 'sass.js'])('%s config valid', (filename) => {
return expect(
standalone({
code: 'a {}',
config: {
extends: `./${filename}`,
},
configBasedir: join(__dirname, '../'),
})
).resolves.toBeTruthy();
});
8 changes: 8 additions & 0 deletions packages/xerox-stylelint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ['stylelint-config-recommended', 'stylelint-prettier/recommended'],
rules: {
'color-hex-length': 'long',
'max-empty-lines': 3,
'no-descending-specificity': null,
},
};
29 changes: 29 additions & 0 deletions packages/xerox-stylelint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@xerox/stylelint-config",
"version": "0.0.0",
"description": "Stylelint shareable configuration for Xerox projects.",
"keywords": [
"xerox",
"stylelint",
"stylelint-config"
],
"main": "index.json",
"repository": "git@github.com:xeroxinteractive/config.git",
"homepage": "https://github.com/xeroxinteractive/config/blob/master/packages/xerox-stylelint-config",
"author": "Andrew Leedham <andrew.leedham@xerox.com>",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"stylelint": "*"
},
"devDependencies": {
"@xerox/prettier-config": "*",
"stylelint": "^12.0.1",
"stylelint-config-prettier": "^8.0.0",
"stylelint-config-recommended": "^3.0.0",
"stylelint-prettier": "^1.1.2",
"stylelint-scss": "^3.13.0"
}
}
8 changes: 8 additions & 0 deletions packages/xerox-stylelint-config/sass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: './index.js',
plugins: ['stylelint-scss'],
rules: {
'at-rule-no-unknown': null,
'scss/at-rule-no-unknown': true,
},
};
Loading

0 comments on commit 72f571b

Please sign in to comment.