Skip to content

Commit

Permalink
feat(stylelint-config): add @modular-css/stylelint-config package (#637)
Browse files Browse the repository at this point in the history
* feat(stylelint-config): add @modular-css/stylelint-config package

Provides a basic stylelint config that can be used with the `extends` feature in stylelint to easily prevent it from barfing on modular-css features.
  • Loading branch information
tivac authored Aug 12, 2019
1 parent 21ca528 commit bc3b711
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/stylelint-config/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage/
profiling/
test/
.*
CHANGELOG.md
21 changes: 21 additions & 0 deletions packages/stylelint-config/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Pat Cavit

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.
32 changes: 32 additions & 0 deletions packages/stylelint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@modular-css/stylelint-config [![NPM Version](https://img.shields.io/npm/v/@modular-css/stylelint-config.svg)](https://www.npmjs.com/package/@modular-css/stylelint-config) [![NPM License](https://img.shields.io/npm/l/@modular-css/stylelint-config.svg)](https://www.npmjs.com/package/@modular-css/stylelint-config) [![NPM Downloads](https://img.shields.io/npm/dm/@modular-css/stylelint-config.svg)](https://www.npmjs.com/package/@modular-css/stylelint-config)
===========

<p align="center">
<a href="https://gitter.im/modular-css/modular-css"><img src="https://img.shields.io/gitter/room/modular-css/modular-css.svg" alt="Gitter" /></a>
</p>

Sharable stylelint config for [`modular-css`](https://m-css). By default stylelint will complain about things like `@value`, `@composes`, `composes: fooga;`, and other bits of custom modular-css syntax. This configures the relevant stylelint rules so that those bits of functionality are ignored so that you don't get a bunch of bogus warnings or errors for using modular-css.

Someday it might even validate things for you, but that's a trickier proposition. For now not barfing errors/warnings everywhere is a good start.

- [Install](#install)
- [Usage](#usage)

## Install

```bash
> npm i @modular-css/stylelint -D
```

## Usage

Inside your [stylelint config](https://stylelint.io/user-guide/configuration/) you'll specify an [`extends`](https://stylelint.io/user-guide/configuration/#extends) property pointing to this package.

```js
{
"extends" : "@modular-css/stylelint-config",
"rules" : {
// ...
}
}
```
28 changes: 28 additions & 0 deletions packages/stylelint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@modular-css/stylelint-config",
"version": "24.2.2",
"description": "Stylelint config to suport modular-css syntax",
"main": "./stylelint.js",
"repository": {
"type": "git",
"url": "https://github.com/tivac/modular-css.git",
"directory": "packages/stylelint"
},
"bugs": {
"url": "https://github.com/tivac/modular-css/issues"
},
"author": "Pat Cavit <npm@patcavit.com>",
"homepage": "https://m-css.com",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"keywords": [
"stylelint",
"stylelint-config",
"css",
"css-modules",
"modular-css",
"postcss"
]
}
31 changes: 31 additions & 0 deletions packages/stylelint-config/stylelint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use strict";

module.exports = {
rules : {
"at-rule-no-unknown" : [ true, {
ignoreAtRules : [
"value",
"composes"
]
}],

"declaration-block-no-duplicate-properties" : [ true, {
ignoreProperties : [
"composes"
]
}],

"property-no-unknown" : [ true, {
ignoreProperties : [
"composes"
]
}],

"selector-pseudo-class-no-unknown" : [ true, {
ignorePseudoClasses : [
"global",
"external",
]
}],
}
};

0 comments on commit bc3b711

Please sign in to comment.