Skip to content

Commit 9cbc939

Browse files
committed
feature(putout) process-file: add ability to set match on inner formats
1 parent 4f941cc commit 9cbc939

55 files changed

Lines changed: 297 additions & 214 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.putout.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"match": {
33
"**/packages/plugin-*": {
44
"putout": "on"
5+
},
6+
"**/packages/plugin-*/*.md{json}": {
7+
"putout-config": "on"
58
}
69
},
710
"rules": {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```json
2+
{
3+
"rules": {
4+
"putout": true
5+
}
6+
}
7+
```

packages/engine-processor/test/processor.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,3 +458,47 @@ test('putout: engine-processor: css', async (t) => {
458458
t.equal(processedSource, output);
459459
t.end();
460460
});
461+
462+
test('putout: engine-processor: md: json: options', async (t) => {
463+
const name = join(__dirname, 'fixture', 'readme.md');
464+
const options = {
465+
match: {
466+
'*.md{json}': {
467+
'putout-config': 'on',
468+
},
469+
},
470+
rules: {
471+
'putout-config': 'off',
472+
},
473+
plugins: [
474+
'putout-config',
475+
],
476+
processors: [
477+
'markdown',
478+
],
479+
};
480+
481+
const rawSource = await readFile(name, 'utf8');
482+
const {places} = await runProcessors({
483+
name,
484+
processFile: processFile({
485+
name: `${name}{json}`,
486+
fix: false,
487+
}),
488+
options,
489+
rawSource,
490+
});
491+
492+
const expected = [{
493+
message: 'String should be used instead of Boolean',
494+
position: {
495+
column: 18,
496+
line: 4,
497+
},
498+
rule: 'putout-config/convert-boolean-to-string',
499+
}];
500+
501+
t.deepEqual(places, expected, 'should equal');
502+
t.end();
503+
});
504+

packages/plugin-apply-nullish-coalescing/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ npm i @putout/plugin-apply-nullish-coalescing
1818
```json
1919
{
2020
"rules": {
21-
"apply-nullish-coalescing": true
21+
"apply-nullish-coalescing": "on"
2222
}
2323
}
2424
```

packages/plugin-apply-optional-chaining/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# @putout/plugin-apply-optional-chaining [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
22

3-
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-optional-chaining.svg?style=flat&longCache=true
4-
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-optional-chaining"npm"
5-
6-
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-apply-optional-chaining
7-
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-apply-optional-chaining
3+
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-apply-optional-chaining.svg?style=flat&longCache=true
4+
[NPMURL]: https://npmjs.org/package/@putout/plugin-apply-optional-chaining"npm"
5+
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-apply-optional-chaining
6+
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-apply-optional-chaining
87

98
`putout` plugin apply `optional chaining`.
109

@@ -19,7 +18,7 @@ npm i @putout/plugin-apply-optional-chaining
1918
```json
2019
{
2120
"rules": {
22-
"apply-optional-chaining": true
21+
"apply-optional-chaining": "on"
2322
}
2423
}
2524
```
@@ -39,4 +38,3 @@ const result = hello?.world;
3938
## License
4039
4140
MIT
42-

packages/plugin-convert-apply-to-spread/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Rule `convert-apply-to-spread` is enabled by default, to disable add to `.putout
2020
```json
2121
{
2222
"rules": {
23-
"convert-apply-to-spread": false
23+
"convert-apply-to-spread": "off"
2424
}
2525
}
2626
```

packages/plugin-convert-arguments-to-rest/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# @putout/plugin-convert-arguments-to-rest [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
22

3-
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-convert-arguments-to-rest.svg?style=flat&longCache=true
4-
[NPMURL]: https://npmjs.org/package/@putout/plugin-convert-arguments-to-rest "npm"
5-
6-
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-convert-arguments-to-rest
7-
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-convert-arguments-to-rest
3+
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-convert-arguments-to-rest.svg?style=flat&longCache=true
4+
[NPMURL]: https://npmjs.org/package/@putout/plugin-convert-arguments-to-rest "npm"
5+
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-convert-arguments-to-rest
6+
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-convert-arguments-to-rest
87

98
`putout` plugin adds ability to convert `arguments` to `rest`.
9+
1010
## Install
1111

1212
```
@@ -18,7 +18,7 @@ npm i @putout/plugin-convert-arguments-to-rest -D
1818
```json
1919
{
2020
"rules": {
21-
"convert-arguments-to-rest": true
21+
"convert-arguments-to-rest": "on"
2222
}
2323
}
2424
```
@@ -42,4 +42,3 @@ function hello(...args) {
4242
## License
4343

4444
MIT
45-

packages/plugin-convert-binary-expression-to-boolean/README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# @putout/plugin-convert-binary-expression-to-boolean [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
22

3-
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-convert-binary-expression-to-boolean.svg?style=flat&longCache=true
4-
[NPMURL]: https://npmjs.org/package/@putout/plugin-convert-binary-expression-to-boolean"npm"
5-
6-
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-convert-binary-expression-to-boolean
7-
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-convert-binary-expression-to-boolean
3+
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-convert-binary-expression-to-boolean.svg?style=flat&longCache=true
4+
[NPMURL]: https://npmjs.org/package/@putout/plugin-convert-binary-expression-to-boolean"npm"
5+
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-convert-binary-expression-to-boolean
6+
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-convert-binary-expression-to-boolean
87

98
`putout` plugin adds ability to find and convert `binary expression` to `boolean`.
109

@@ -19,7 +18,7 @@ npm i @putout/plugin-convert-binary-expression-to-boolean -D
1918
```json
2019
{
2120
"rules": {
22-
"convert-binary-expression-to-boolean": true
21+
"convert-binary-expression-to-boolean": "on"
2322
}
2423
}
2524
```
@@ -39,4 +38,3 @@ const t = false;
3938
## License
4039

4140
MIT
42-

packages/plugin-convert-commonjs-to-esm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ npm i @putout/plugin-convert-commonjs-to-esm -D
1818
```json
1919
{
2020
"rules": {
21-
"convert-commonjs-to-esm": true
21+
"convert-commonjs-to-esm": "on"
2222
}
2323
}
2424
```

packages/plugin-convert-equal-to-strict-equal/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# @putout/plugin-convert-equal-to-strict-equal [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL]
22

3-
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-convert-equal-to-strict-equal.svg?style=flat&longCache=true
4-
[NPMURL]: https://npmjs.org/package/@putout/plugin-convert-equal-to-strict-equal "npm"
5-
6-
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-convert-equal-to-strict-equal
7-
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-convert-equal-to-strict-equal
3+
[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-convert-equal-to-strict-equal.svg?style=flat&longCache=true
4+
[NPMURL]: https://npmjs.org/package/@putout/plugin-convert-equal-to-strict-equal "npm"
5+
[DependencyStatusURL]: https://david-dm.org/coderaiser/putout?path=packages/plugin-convert-equal-to-strict-equal
6+
[DependencyStatusIMGURL]: https://david-dm.org/coderaiser/putout.svg?path=packages/plugin-convert-equal-to-strict-equal
87

98
`putout` plugin adds ability to convert `equal` to `strict equal` loop.
9+
1010
## Install
1111

1212
```
@@ -20,7 +20,7 @@ Rule `convert-equal-to-strict-equal` is enabled by default, to disable add to `.
2020
```json
2121
{
2222
"rules": {
23-
"convert-equal-to-strict-equal": false
23+
"convert-equal-to-strict-equal": "off"
2424
}
2525
}
2626
```
@@ -42,4 +42,3 @@ if (a === b) {
4242
## License
4343

4444
MIT
45-

0 commit comments

Comments
 (0)