Skip to content

Commit 9793871

Browse files
committed
chore: putout: actions: lint ☘️
1 parent 6235140 commit 9793871

File tree

11 files changed

+42
-94
lines changed

11 files changed

+42
-94
lines changed

packages/cli-ruler/lib/index.spec.js

+21-33
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@ test('putout: cli: ruler-processor: read: error', async (t) => {
4141

4242
const name = `${process.cwd()}/.putout.json`;
4343

44-
const expected = stringify({
45-
rules: {
46-
'remove-unused-variables': 'on',
47-
},
48-
}, null, 4);
44+
const expected = stringify({rules: {
45+
'remove-unused-variables': 'on',
46+
}}, null, 4);
4947

5048
t.calledWith(writeFile, [name, expected], 'should write config');
5149
t.end();
@@ -66,11 +64,9 @@ test('putout: cli: ruler-processor: write', async (t) => {
6664

6765
const name = `${process.cwd()}/.putout.json`;
6866

69-
const expected = stringify({
70-
rules: {
71-
'remove-unused-variables': 'on',
72-
},
73-
}, null, 4);
67+
const expected = stringify({rules: {
68+
'remove-unused-variables': 'on',
69+
}}, null, 4);
7470

7571
t.calledWith(writeFile, [name, expected], 'should write config');
7672
t.end();
@@ -91,11 +87,9 @@ test('putout: cli: ruler-processor: disable', async (t) => {
9187

9288
const name = `${process.cwd()}/.putout.json`;
9389

94-
const expected = stringify({
95-
rules: {
96-
'remove-unused-variables': 'off',
97-
},
98-
}, null, 4);
90+
const expected = stringify({rules: {
91+
'remove-unused-variables': 'off',
92+
}}, null, 4);
9993

10094
t.calledWith(writeFile, [name, expected], 'should write config');
10195
t.end();
@@ -127,12 +121,10 @@ test('putout: cli: ruler-processor: enable all', async (t) => {
127121

128122
const name = `${process.cwd()}/.putout.json`;
129123

130-
const expected = stringify({
131-
rules: {
132-
'remove-debugger': 'on',
133-
'remove-unused-variables': 'on',
134-
},
135-
}, null, 4);
124+
const expected = stringify({rules: {
125+
'remove-debugger': 'on',
126+
'remove-unused-variables': 'on',
127+
}}, null, 4);
136128

137129
t.calledWith(writeFile, [name, expected], 'should enable all');
138130
t.end();
@@ -163,12 +155,10 @@ test('putout: cli: ruler-processor: disable all', async (t) => {
163155

164156
const name = `${process.cwd()}/.putout.json`;
165157

166-
const expected = stringify({
167-
rules: {
168-
'remove-debugger': 'off',
169-
'remove-unused-variables': 'off',
170-
},
171-
}, null, 4);
158+
const expected = stringify({rules: {
159+
'remove-debugger': 'off',
160+
'remove-unused-variables': 'off',
161+
}}, null, 4);
172162

173163
t.calledWith(writeFile, [name, expected], 'should enable all');
174164
t.end();
@@ -192,12 +182,10 @@ test('putout: cli: ruler-processor: no option', async (t) => {
192182

193183
const name = `${process.cwd()}/.putout.json`;
194184

195-
const expected = stringify({
196-
rules: {
197-
'remove-debugger': 'on',
198-
'remove-unused-variables': 'off',
199-
},
200-
}, null, 4);
185+
const expected = stringify({rules: {
186+
'remove-debugger': 'on',
187+
'remove-unused-variables': 'off',
188+
}}, null, 4);
201189

202190
t.calledWith(writeFile, [name, expected], 'should enable all');
203191
t.end();

packages/compare/test/compare.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ test('compare: base is string: path', (t) => {
6767
const node = template.ast('const a = "hello"');
6868
const b = template.ast('const a = "__"');
6969

70-
const result = compare({
71-
node,
72-
}, b);
70+
const result = compare({node}, b);
7371

7472
t.ok(result);
7573
t.end();

packages/engine-loader/README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,10 @@ const plugins = loadPlugins({
101101
const {loadProcessors} = require('@putout/engine-loader');
102102
const optionalLoad = async (a) => await import(a);
103103

104-
const plugins = await loadProcessorsAsync({
105-
processors: [
106-
['javascript', 'on'],
107-
['markdown', 'off'],
108-
],
109-
}, optionalLoad);
104+
const plugins = await loadProcessorsAsync({processors: [
105+
['javascript', 'on'],
106+
['markdown', 'off'],
107+
]}, optionalLoad);
110108
```
111109

112110
### createAsyncLoader

packages/engine-loader/test/load-processors-async.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,9 @@ test('putout: engine-loader: load processors: on', async (t) => {
8383
test('putout: engine-loader: load processors: load', async (t) => {
8484
const load = stub().rejects(Error('LOAD USED'));
8585

86-
const [error] = await tryToCatch(loadProcessorsAsync, {
87-
processors: [
88-
'markdown',
89-
],
90-
}, load);
86+
const [error] = await tryToCatch(loadProcessorsAsync, {processors: [
87+
'markdown',
88+
]}, load);
9189

9290
t.deepEqual(error, Error('@putout/processor-markdown: LOAD USED'));
9391
t.end();

packages/engine-parser/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ const ast = babel.parse(source, {
117117
sourceFilename: 'hello.js',
118118
});
119119

120-
generate(ast, {
121-
sourceMaps: true,
122-
}, {
120+
generate(ast, {sourceMaps: true}, {
123121
'hello.js': source,
124122
});
125123

packages/engine-parser/lib/generate.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
const generate = require('@babel/generator').default;
44

55
module.exports = (node, options, sourceMaps) => {
6-
return generate(node, {
7-
comments: false,
8-
recordAndTupleSyntaxType: 'hash',
9-
...options,
6+
return generate(node, {comments: false, recordAndTupleSyntaxType: 'hash', ...options,
107
}, sourceMaps);
118
};

packages/engine-parser/lib/parse.spec.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ test('putout: engina-parser: parse + generate = sourcemap', (t) => {
1313
sourceFilename: 'hello.js',
1414
});
1515

16-
const {map} = generate(ast, {
17-
sourceMaps: true,
18-
}, {
16+
const {map} = generate(ast, {sourceMaps: true}, {
1917
'hello.js': source,
2018
});
2119

packages/engine-processor/lib/processor.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ async function getFiles({name, fix, rawSource, processorRunners}) {
168168

169169
module.exports.getProcessorRunners = getProcessorRunners;
170170
async function getProcessorRunners(processors, load) {
171-
const readyProcessors = await loadProcessorsAsync({
172-
processors,
173-
}, load);
171+
const readyProcessors = await loadProcessorsAsync({processors}, load);
174172

175173
return readyProcessors;
176174
}

packages/eslint/lib/create-plugin/index.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,7 @@ const prepare = (plugin, context, options) => (node) => {
2323

2424
const text = getText(node);
2525

26-
const result = filter({
27-
text,
28-
node,
29-
options,
30-
getText,
31-
getCommentsBefore,
32-
getCommentsAfter,
33-
getCommentsInside,
34-
getSpacesBeforeNode,
35-
getSpacesAfterNode,
36-
filename,
37-
}, options);
26+
const result = filter({text, node, options, getText, getCommentsBefore, getCommentsAfter, getCommentsInside, getSpacesBeforeNode, getSpacesAfterNode, filename}, options);
3827

3928
if (!result)
4029
return;

packages/plugin-tape/lib/apply-with-name/index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ function checkStubs({__a, __b}, path) {
2828
elements,
2929
};
3030

31-
return checkStubsArray({
32-
__array,
33-
}, path);
31+
return checkStubsArray({__array}, path);
3432
}
3533

3634
function applyWithName({__a, __b}, path) {

packages/test/lib/test.js

+7-19
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,7 @@ const report = currify((dir, options, t, name, message) => {
434434
const full = join(dir, name);
435435
const [source, isTS] = readFixture(full);
436436

437-
return reportCode({
438-
isTS,
439-
...options,
437+
return reportCode({isTS, ...options,
440438
}, t, source, message);
441439
});
442440

@@ -446,9 +444,7 @@ const noReport = currify((dir, options, t, name) => {
446444

447445
rmFixture(`${full}-fix`);
448446

449-
return noReportCode({
450-
isTS,
451-
...options,
447+
return noReportCode({isTS, ...options,
452448
}, t, source);
453449
});
454450

@@ -458,9 +454,7 @@ const noReportAfterTransform = currify((dir, options, t, name) => {
458454
const full = join(dir, name);
459455
const [source, isTS] = readFixture(full);
460456

461-
return noReportCodeAfterTransform({
462-
isTS,
463-
...options,
457+
return noReportCodeAfterTransform({isTS, ...options,
464458
}, t, source);
465459
});
466460

@@ -476,11 +470,8 @@ const reportWithOptions = currify((dir, options, t, name, message, ruleOptions)
476470
[rule]: ['on', ruleOptions],
477471
};
478472

479-
return reportCode({
480-
...options,
481-
rules,
482-
isTS,
483-
}, t, source, message);
473+
return reportCode({...options,
474+
rules, isTS}, t, source, message);
484475
});
485476

486477
const noReportWithOptions = currify((dir, options, t, name, ruleOptions) => {
@@ -495,11 +486,8 @@ const noReportWithOptions = currify((dir, options, t, name, ruleOptions) => {
495486
[rule]: ['on', ruleOptions],
496487
};
497488

498-
return noReportCode({
499-
isTS,
500-
...options,
501-
rules,
502-
}, t, source);
489+
return noReportCode({isTS, ...options,
490+
rules}, t, source);
503491
});
504492

505493
const reportCode = currify((options, t, source, message) => {

0 commit comments

Comments
 (0)