Skip to content

Commit aed6646

Browse files
committed
chore: putout: actions: lint ☘️
1 parent fbfdc63 commit aed6646

File tree

197 files changed

+285
-1134
lines changed

Some content is hidden

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

197 files changed

+285
-1134
lines changed

codemods/apply-replace-all/lib/apply-replace-all.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
'use strict';
22

3-
const {
4-
types,
5-
operator,
6-
} = require('putout');
3+
const {types, operator} = require('putout');
74

85
const {replaceWith} = operator;
96
const {RegExpLiteral} = types;

codemods/convert-any-to-primitive/lib/convert-any-to-primitive.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
'use strict';
22

3-
const {
4-
types,
5-
operator,
6-
} = require('putout');
3+
const {types, operator} = require('putout');
74

85
const {compare} = operator;
96

codemods/madrun/lib/add-fresh-lint/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ const getProperty = require('../get-property');
1010

1111
const {replaceWithMultiple} = operator;
1212

13-
const {
14-
ObjectProperty,
15-
StringLiteral,
16-
} = types;
13+
const {ObjectProperty, StringLiteral} = types;
1714

1815
const freshLintScript = template.ast(`
1916
() => run('lint', '--fresh')

codemods/madrun/lib/rename-predefined-eslint-to-putout/index.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
'use strict';
22

3-
const {
4-
operator,
5-
types: t,
6-
} = require('putout');
3+
const {operator, types: t} = require('putout');
74

85
const {rename} = operator;
96

@@ -17,10 +14,7 @@ module.exports.traverse = ({push}) => ({
1714
'const __object = predefined'(path) {
1815
const properties = path.get('declarations.0.id.properties');
1916

20-
const {
21-
eslint,
22-
putout,
23-
} = getPredefined(properties);
17+
const {eslint, putout} = getPredefined(properties);
2418

2519
if (!eslint || putout)
2620
return;

codemods/set-commit-type/lib/set-commit-type.js

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
'use strict';
22

3-
const {
4-
types,
5-
operator,
6-
} = require('putout');
3+
const {types, operator} = require('putout');
74

8-
const {
9-
StringLiteral,
10-
ObjectProperty,
11-
} = types;
5+
const {StringLiteral, ObjectProperty} = types;
126

137
const {getProperties} = operator;
148

@@ -18,10 +12,7 @@ module.exports.traverse = ({push}) => ({
1812
'__putout_processor_json(__a)': (path) => {
1913
const __aPath = path.get('arguments.0');
2014

21-
const {
22-
commitTypePath,
23-
mainPath,
24-
} = getProperties(__aPath, ['commitType', 'main']);
15+
const {commitTypePath, mainPath} = getProperties(__aPath, ['commitType', 'main']);
2516

2617
if (commitTypePath)
2718
return;

packages/cli-cache/lib/cache.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,12 @@ const canUseCache = ({fileCache, getOptionsHash}) => (name, options) => {
9393
if (!descriptor)
9494
return false;
9595

96-
const {
97-
changed,
98-
meta,
99-
} = descriptor;
96+
const {changed, meta} = descriptor;
10097

10198
if (!meta)
10299
return false;
103100

104-
const {
105-
places,
106-
optionsHash,
107-
} = meta;
101+
const {places, optionsHash} = meta;
108102

109103
if (changed)
110104
return false;

packages/cli-cache/lib/cache.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ const {
1111
_defaultCache,
1212
} = require('./cache');
1313

14-
const {
15-
reRequire,
16-
stopAll,
17-
} = mockRequire;
14+
const {reRequire, stopAll} = mockRequire;
1815

1916
test('putout: cli: cache: disabled: fileCache', async (t) => {
2017
const fileCache = await createCache({

packages/cli-cache/lib/is-changed.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
'use strict';
22

3-
const {
4-
dirname,
5-
join,
6-
} = require('path');
3+
const {dirname, join} = require('path');
74

85
module.exports = async (fileCache, {findUp}) => {
96
const result = await Promise.all([

packages/cli-cache/lib/is-changed.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
const {test, stub} = require('supertape');
44

5-
const {
6-
stopAll,
7-
reRequire,
8-
} = require('mock-require');
5+
const {stopAll, reRequire} = require('mock-require');
96

107
test('putout: cli: cache files: is changed: isNodeModulesChanged: cannot find', async (t) => {
118
const fileCache = {

packages/cli-keypress/lib/keypress.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ const {Readable} = require('stream');
44
const {test, stub} = require('supertape');
55
const mockRequire = require('mock-require');
66

7-
const {
8-
reRequire,
9-
stopAll,
10-
} = mockRequire;
7+
const {reRequire, stopAll} = mockRequire;
118

129
const {assign} = Object;
1310

packages/cli-match/README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ import {
3333
} from 'fs/promises';
3434
import match from '@putout/cli-match';
3535

36-
const {
37-
code,
38-
message,
39-
} = await match({
36+
const {code, message} = await match({
4037
pattern,
4138
cwd: cwd(),
4239
readFile, // optional

packages/cli-match/lib/match.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ import matchErrors, {
1616

1717
export * from './codes.js';
1818

19-
const {
20-
parse,
21-
stringify,
22-
} = JSON;
19+
const {parse, stringify} = JSON;
2320

2421
const superStringify = (a) => `${stringify(a, null, 4)}\n`;
2522

packages/cli-ruler/lib/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import * as ruleProcessor from './rule-processor.js';
44

55
const cwd = process.cwd();
66

7-
const {
8-
parse,
9-
stringify,
10-
} = JSON;
7+
const {parse, stringify} = JSON;
118

129
export async function ruler(places, {disable, disableAll, enable, enableAll, readFile, writeFile}) {
1310
const name = join(cwd, '.putout.json');

packages/cli-staged/lib/staged.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ const tryToCatch = require('try-to-catch');
44
const {test, stub} = require('supertape');
55
const mockRequire = require('mock-require');
66

7-
const {
8-
reRequire,
9-
stopAll,
10-
} = mockRequire;
7+
const {reRequire, stopAll} = mockRequire;
118

129
test('putout: cli: staged', async (t) => {
1310
const findUp = stub().returns('.');

packages/compare/lib/link.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ const {
99

1010
const parseName = (node) => {
1111
node = node[0] || node;
12-
const {
13-
name,
14-
value,
15-
} = node;
12+
const {name, value} = node;
1613

1714
if (isIdentifier(node))
1815
return name;

packages/compare/lib/log.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ const {_parseValue} = require('./log');
99

1010
const {assign} = Object;
1111

12-
const {
13-
reRequire,
14-
stopAll,
15-
} = mockRequire;
12+
const {reRequire, stopAll} = mockRequire;
1613

1714
test('putout: compare: log', (t) => {
1815
const namespace = stub();

packages/compare/lib/vars.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ const jessy = require('jessy');
55
const nessy = require('nessy');
66
const {template} = require('@putout/engine-parser');
77

8-
const {
9-
replaceWith,
10-
extract,
11-
} = require('@putout/operate');
8+
const {replaceWith, extract} = require('@putout/operate');
129

1310
const {
1411
isIdentifier,

packages/compare/lib/vars.spec.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ const {getTemplateValues} = require('./vars');
1212

1313
const noop = () => {};
1414

15-
const {
16-
types,
17-
generate,
18-
} = putout;
15+
const {types, generate} = putout;
1916

2017
const {
2118
RegExpLiteral,
@@ -97,10 +94,7 @@ test('putout: compare: vars: getTemplateValues: setValues: Statement', (t) => {
9794

9895
const input = 'if (1) if (2) 3';
9996

100-
const {
101-
parse,
102-
transform,
103-
} = putout;
97+
const {parse, transform} = putout;
10498

10599
const ast = parse(input);
106100

packages/compare/test/compare.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@
33
const test = require('supertape');
44
const montag = require('montag');
55

6-
const {
7-
template,
8-
parse,
9-
} = require('@putout/engine-parser');
6+
const {template, parse} = require('@putout/engine-parser');
107

11-
const {
12-
traverse,
13-
types,
14-
} = require('putout');
8+
const {traverse, types} = require('putout');
159

1610
const {
1711
compare,

packages/engine-loader/lib/async-loader.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ const {test, stub} = require('supertape');
66

77
const mockRequire = require('mock-require');
88

9-
const {
10-
reRequire,
11-
stopAll,
12-
} = mockRequire;
9+
const {reRequire, stopAll} = mockRequire;
1310

1411
const {assign} = Object;
1512

packages/engine-loader/lib/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ const mergeRules = ([rule, plugin], rules) => {
2121
if (currentRule.rule !== rule)
2222
continue;
2323

24-
const {
25-
msg,
26-
options,
27-
} = currentRule;
24+
const {msg, options} = currentRule;
2825

2926
return {
3027
rule,

packages/engine-loader/lib/index.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
const test = require('supertape');
44
const mockRequire = require('mock-require');
55

6-
const {
7-
reRequire,
8-
stopAll,
9-
} = mockRequire;
6+
const {reRequire, stopAll} = mockRequire;
107

118
test('engine-loader: load-plugins', (t) => {
129
mockRequire('module', {

packages/engine-loader/lib/load.spec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ const tryCatch = require('try-catch');
44
const mockRequire = require('mock-require');
55
const {test, stub} = require('supertape');
66

7-
const {
8-
stopAll,
9-
reRequire,
10-
} = mockRequire;
7+
const {stopAll, reRequire} = mockRequire;
118

129
const {assign} = Object;
1310

packages/engine-loader/test/load-plugins.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@ const montag = require('montag');
1111

1212
const {readFixtures} = require('./fixture');
1313

14-
const {
15-
loadPlugins,
16-
babelPlugin,
17-
} = require('..');
18-
19-
const {
20-
reRequire,
21-
stopAll,
22-
} = mockRequire;
14+
const {loadPlugins, babelPlugin} = require('..');
15+
16+
const {reRequire, stopAll} = mockRequire;
2317

2418
const fixture = readFixtures([
2519
'shebang',

packages/engine-parser/lib/parsers/babel/move-out-directives.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ const {
66
} = require('@babel/types');
77

88
module.exports = (ast) => {
9-
const {
10-
body,
11-
directives,
12-
} = ast.program;
9+
const {body, directives} = ast.program;
1310

1411
if (!directives.length)
1512
return ast;

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ const {test} = require('supertape');
44
const montag = require('montag');
55
const putout = require('putout');
66

7-
const {
8-
parse,
9-
print,
10-
} = putout;
7+
const {parse, print} = putout;
118

129
test('putout: parser: print: long lines', (t) => {
1310
const source = montag`

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
const tryCatch = require('try-catch');
44
const test = require('supertape');
55

6-
const {
7-
Identifier,
8-
StringLiteral,
9-
} = require('@babel/types');
6+
const {Identifier, StringLiteral} = require('@babel/types');
107

118
const template = require('./template');
129

0 commit comments

Comments
 (0)