Skip to content

Commit 3dbdca2

Browse files
committed
feature(@putout/processor-css) add
1 parent b05d419 commit 3dbdca2

File tree

16 files changed

+297
-1
lines changed

16 files changed

+297
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Here is a list of built-int processors:
102102
| [`@putout/processor-markdown`](/packages/processor-markdown) | [![npm](https://img.shields.io/npm/v/@putout/processor-markdown.svg?maxAge=86400)](https://www.npmjs.com/package/@putout/processor-markdown) | [![Dependency Status](https://david-dm.org/coderaiser/putout.svg?path=packages/processor-markdown)](https://david-dm.org/coderaiser/putout?path=packages/processor-markdown) |
103103
| [`@putout/processor-ignore`](/packages/processor-ignore) | [![npm](https://img.shields.io/npm/v/@putout/processor-ignore.svg?maxAge=86400)](https://www.npmjs.com/package/@putout/processor-ignore) | [![Dependency Status](https://david-dm.org/coderaiser/putout.svg?path=packages/processor-ignore)](https://david-dm.org/coderaiser/putout?path=packages/processor-ignore) |
104104
| [`@putout/processor-yaml`](/packages/processor-yaml) | [![npm](https://img.shields.io/npm/v/@putout/processor-yaml.svg?maxAge=86400)](https://www.npmjs.com/package/@putout/processor-yaml) | [![Dependency Status](https://david-dm.org/coderaiser/putout.svg?path=packages/processor-yaml)](https://david-dm.org/coderaiser/putout?path=packages/processor-yaml) |
105+
| [`@putout/processor-css`](/packages/processor-css) | [![npm](https://img.shields.io/npm/v/@putout/processor-css.svg?maxAge=86400)](https://www.npmjs.com/package/@putout/processor-css) | [![Dependency Status](https://david-dm.org/coderaiser/putout.svg?path=packages/processor-css)](https://david-dm.org/coderaiser/putout?path=packages/processor-css) |
105106

106107
## API
107108

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": [
3+
"plugin:node/recommended",
4+
"plugin:putout/recommended"
5+
],
6+
"plugins": [
7+
"putout",
8+
"node"
9+
]
10+
}

packages/processor-css/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.nyc_output
3+
*.swp
4+
yarn-error.log
5+
6+
.putoutcache

packages/processor-css/.madrun.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
const {run} = require('madrun');
4+
5+
module.exports = {
6+
'test': () => `tape 'lib/**/*.spec.js' 'test/*.js'`,
7+
'watch:test': async () => `nodemon -w lib -w test -x ${await run('test')}`,
8+
'lint': () => `putout .`,
9+
'fix:lint': () => run('lint', '--fix'),
10+
'coverage': async () => `nyc ${await run('test')}`,
11+
'report': () => `nyc report --reporter=text-lcov | coveralls || true`,
12+
};
13+

packages/processor-css/.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.*
2+
*.spec.js
3+
test
4+
yarn-error.log
5+
fixture
6+
7+
madrun.js
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
extends: stylelint-config-standard
2+
rules:
3+
indentation: 4
4+
declaration-block-trailing-semicolon: always
5+
declaration-colon-space-before: null
6+
selector-list-comma-newline-after: null
7+
comment-empty-line-before: null
8+
number-leading-zero: null
9+
number-no-trailing-zeros: null
10+
string-quotes: single
11+
function-url-quotes: never
12+
no-eol-whitespace: null
13+
font-family-name-quotes: always-unless-keyword
14+
font-family-no-missing-generic-family-keyword: null
15+
rule-empty-line-before: null
16+
max-empty-lines: 2
17+

packages/processor-css/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) coderaiser
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/processor-css/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# @putout/processor-markdown [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
2+
3+
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/processor-markdown.svg?style=flat&longCache=true
4+
[NPMURL]: https://npmjs.org/package/@putout/processor-markdown "npm"
5+
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/processor-markdown
6+
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/processor-markdown
7+
8+
`putout` processor adds ability to get `js`, `json` and `ts` code from markdown files.
9+
10+
## Install
11+
12+
```
13+
npm i @putout/processor-markdown -D
14+
```
15+
16+
## Usage
17+
18+
```json
19+
{
20+
"processors": [
21+
"markdown"
22+
]
23+
}
24+
```
25+
26+
## License
27+
28+
MIT

packages/processor-css/lib/css.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
'use strict';
2+
3+
const stylelint = require('stylelint');
4+
const config = require('../stylelintrc');
5+
6+
const configBasedir = process.cwd();
7+
8+
module.exports.files = [
9+
'*.css',
10+
];
11+
12+
module.exports.process = async (code, {fix}) => {
13+
const {output, results} = await stylelint.lint({
14+
fix,
15+
code,
16+
config,
17+
configBasedir,
18+
});
19+
20+
const {warnings} = results[0];
21+
22+
return [
23+
output,
24+
warnings.map(toPlace),
25+
];
26+
};
27+
28+
function toPlace({line, column, rule, text}) {
29+
return {
30+
message: text,
31+
rule: `${rule} (stylelint)`,
32+
position: {
33+
line,
34+
column,
35+
},
36+
};
37+
}
38+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@putout/processor-css",
3+
"version": "1.0.0",
4+
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5+
"description": "putout processor adds ability to parse css files",
6+
"homepage": "http://github.com/coderaiser/putout",
7+
"main": "lib/css.js",
8+
"release": false,
9+
"tag": false,
10+
"changelog": false,
11+
"repository": {
12+
"type": "git",
13+
"url": "git://github.com/coderaiser/putout.git"
14+
},
15+
"scripts": {
16+
"test": "madrun test",
17+
"watch:test": "madrun watch:test",
18+
"lint": "madrun lint",
19+
"fix:lint": "madrun fix:lint",
20+
"coverage": "madrun coverage"
21+
},
22+
"dependencies": {
23+
"stylelint": "^13.8.0",
24+
"stylelint-config-standard": "^20.0.0"
25+
},
26+
"keywords": [
27+
"putout",
28+
"putout-processor",
29+
"css"
30+
],
31+
"devDependencies": {
32+
"@putout/engine-processor": "^2.5.0",
33+
"coveralls": "^3.0.0",
34+
"eslint": "^7.0.0",
35+
"eslint-plugin-node": "^11.0.0",
36+
"eslint-plugin-putout": "^6.0.0",
37+
"lerna": "^3.8.5",
38+
"madrun": "^8.0.1",
39+
"nodemon": "^2.0.1",
40+
"nyc": "^15.0.1",
41+
"putout": "*",
42+
"supertape": "^3.4.2"
43+
},
44+
"peerDependencies": {
45+
"putout": ">=12"
46+
},
47+
"license": "MIT",
48+
"engines": {
49+
"node": ">=12"
50+
},
51+
"publishConfig": {
52+
"access": "public"
53+
}
54+
}

0 commit comments

Comments
 (0)