@putout/plugin-putout-config 8.1.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/lib/apply-assignment/index.js +21 -0
- package/lib/apply-conditions/index.js +15 -5
- package/lib/apply-esm/index.js +12 -4
- package/lib/apply-for-of/index.js +12 -4
- package/lib/apply-labels/index.js +12 -4
- package/lib/apply-math/index.js +12 -4
- package/lib/apply-nodejs/index.js +12 -4
- package/lib/apply-optional-chaining/index.js +12 -4
- package/lib/apply-parens/index.js +12 -4
- package/lib/apply-promises/index.js +12 -4
- package/lib/apply-return/index.js +12 -4
- package/lib/apply-tape/index.js +12 -4
- package/lib/apply-types/index.js +12 -4
- package/lib/convert-boolean-to-string/index.js +6 -8
- package/lib/index.js +20 -20
- package/lib/move-formatter-up/index.js +6 -7
- package/lib/remove-empty/index.js +5 -6
- package/lib/remove-empty-file/index.js +4 -5
- package/lib/rename-property.js +2 -3
- package/lib/rename-rules/index.js +12 -3
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ npm i @putout/plugin-putout-config -D
|
|
|
13
13
|
|
|
14
14
|
## Rules
|
|
15
15
|
|
|
16
|
+
- ✅ [apply-assignment](#apply-assignment);
|
|
16
17
|
- ✅ [apply-conditions](#apply-conditions);
|
|
17
18
|
- ✅ [apply-esm](#apply-esm);
|
|
18
19
|
- ✅ [apply-return](#apply-return);
|
|
@@ -37,6 +38,7 @@ npm i @putout/plugin-putout-config -D
|
|
|
37
38
|
```json
|
|
38
39
|
{
|
|
39
40
|
"rules": {
|
|
41
|
+
"putout-config/apply-assignment": "on",
|
|
40
42
|
"putout-config/apply-conditions": "on",
|
|
41
43
|
"putout-config/apply-esm": "on",
|
|
42
44
|
"putout-config/apply-for-of": "on",
|
|
@@ -58,6 +60,29 @@ npm i @putout/plugin-putout-config -D
|
|
|
58
60
|
}
|
|
59
61
|
```
|
|
60
62
|
|
|
63
|
+
## apply-assignment
|
|
64
|
+
|
|
65
|
+
Apply [`assignment`](https://github.com/coderaiser/putout/tree/master/packages/plugin-assignment#readme) according to:
|
|
66
|
+
|
|
67
|
+
- 🐊[**Putout v39**](https://github.com/coderaiser/putout/releases/tag/v39.0.0):
|
|
68
|
+
|
|
69
|
+
```diff
|
|
70
|
+
{
|
|
71
|
+
"rules": {
|
|
72
|
+
- "split-assignment-expressions": "off",
|
|
73
|
+
- "simplify-assignments": "off",
|
|
74
|
+
- "convert-assignment-to-arrow-function": "off",
|
|
75
|
+
- "convert-assignment-to-comparisson": "off",
|
|
76
|
+
- "convert-assignment-to-declaration": "off"
|
|
77
|
+
+ "assignment/split": "off",
|
|
78
|
+
+ "assignment/simplify": "off",
|
|
79
|
+
+ "assignment/convert-to-arrow-function": "off"
|
|
80
|
+
+ "assignment/convert-to-comparisson": "off",
|
|
81
|
+
+ "assignment/convert-to-declaration": "off"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
61
86
|
## apply-return
|
|
62
87
|
|
|
63
88
|
Apply [`return`](https://github.com/coderaiser/putout/tree/master/packages/plugin-return#readme) according to:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
|
+
|
|
3
|
+
const v39 = [
|
|
4
|
+
['split-assignment-expressions', 'assignment/split'],
|
|
5
|
+
['simplify-assignments', 'assignment/simplify'],
|
|
6
|
+
['convert-assignment-to-arrow-function', 'assignment/convert-to-arrow-function'],
|
|
7
|
+
['convert-assignment-to-comparisson', 'assignment/convert-to-comparisson'],
|
|
8
|
+
['convert-assignment-to-declaration', 'assignment/convert-to-declaration'],
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
report,
|
|
13
|
+
fix,
|
|
14
|
+
traverse,
|
|
15
|
+
} = createRenameProperty(v39);
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
report,
|
|
19
|
+
fix,
|
|
20
|
+
traverse,
|
|
21
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {createRenameProperty} = require('../rename-property');
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
4
2
|
|
|
5
3
|
const v32 = [
|
|
6
4
|
['remove-useless-else', 'conditions/remove-useless-else'],
|
|
@@ -19,7 +17,19 @@ const v29 = [
|
|
|
19
17
|
['remove-boolean-from-assertions', 'conditions/remove-boolean'],
|
|
20
18
|
];
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
const versions = [
|
|
23
21
|
...v32,
|
|
24
22
|
...v29,
|
|
25
|
-
]
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
report,
|
|
27
|
+
fix,
|
|
28
|
+
traverse,
|
|
29
|
+
} = createRenameProperty(versions);
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
report,
|
|
33
|
+
fix,
|
|
34
|
+
traverse,
|
|
35
|
+
};
|
package/lib/apply-esm/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {createRenameProperty} = require('../rename-property');
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
4
2
|
|
|
5
3
|
const v37 = [
|
|
6
4
|
['convert-assert-to-with', 'esm/convert-assert-to-with'],
|
|
@@ -13,4 +11,14 @@ const v37 = [
|
|
|
13
11
|
['merge-duplicate-imports', 'esm/merge-duplicate-imports'],
|
|
14
12
|
];
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
const {
|
|
15
|
+
report,
|
|
16
|
+
fix,
|
|
17
|
+
traverse,
|
|
18
|
+
} = createRenameProperty(v37);
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
report,
|
|
22
|
+
fix,
|
|
23
|
+
traverse,
|
|
24
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const {
|
|
4
|
+
report,
|
|
5
|
+
fix,
|
|
6
|
+
traverse,
|
|
7
|
+
} = createRenameProperty([
|
|
6
8
|
['convert-for-to-for-of', 'for-of/for'],
|
|
7
9
|
['convert-for-each-to-for-of', 'for-of/for-each'],
|
|
8
10
|
['convert-for-in-to-for-of', 'for-of/for-in'],
|
|
@@ -13,3 +15,9 @@ module.exports = createRenameProperty([
|
|
|
13
15
|
['remove-useless-array-from', 'for-of/remove-useless-array-from'],
|
|
14
16
|
['remove-useless-variables/for-of', 'for-of/remove-useless-variables"'],
|
|
15
17
|
]);
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
report,
|
|
21
|
+
fix,
|
|
22
|
+
traverse,
|
|
23
|
+
};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const {
|
|
4
|
+
report,
|
|
5
|
+
fix,
|
|
6
|
+
traverse,
|
|
7
|
+
} = createRenameProperty([
|
|
6
8
|
['remove-unused-labels', 'labels/remove-unused'],
|
|
7
9
|
['convert-label-to-object', 'labels/convert-to-object'],
|
|
8
10
|
]);
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
report,
|
|
14
|
+
fix,
|
|
15
|
+
traverse,
|
|
16
|
+
};
|
package/lib/apply-math/index.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const {
|
|
4
|
+
report,
|
|
5
|
+
fix,
|
|
6
|
+
traverse,
|
|
7
|
+
} = createRenameProperty([
|
|
6
8
|
['convert-math-pow', 'math/apply-exponential'],
|
|
7
9
|
['apply-numeric-separators', 'math/apply-numeric-separators'],
|
|
8
10
|
['convert-imul-to-multiplication', 'math/apply-multiplication'],
|
|
9
11
|
['convert-sqrt-to-hypot', 'math/convert-sqrt-to-hypot'],
|
|
10
12
|
]);
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
report,
|
|
16
|
+
fix,
|
|
17
|
+
traverse,
|
|
18
|
+
};
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {createRenameProperty} = require('../rename-property');
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
4
2
|
|
|
5
3
|
const v24 = [
|
|
6
4
|
['remove-process-exit', 'nodejs/remove-process-exit'],
|
|
7
5
|
['convert-top-level-return', 'nodejs/convert-top-level-return'],
|
|
8
6
|
];
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
const {
|
|
9
|
+
report,
|
|
10
|
+
fix,
|
|
11
|
+
traverse,
|
|
12
|
+
} = createRenameProperty([
|
|
11
13
|
...v24,
|
|
12
14
|
['strict-mode/add-missing', 'nodejs/add-missing-strict-mode'],
|
|
13
15
|
['strict-mode/remove-useless', 'nodejs/remove-useless-strict-mode'],
|
|
14
16
|
['convert-esm-to-commonjs', 'nodejs/convert-esm-to-commonjs'],
|
|
15
17
|
['convert-commonjs-to-esm', 'nodejs/convert-commonjs-to-esm'],
|
|
16
18
|
]);
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
report,
|
|
22
|
+
fix,
|
|
23
|
+
traverse,
|
|
24
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {createRenameProperty} = require('../rename-property');
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
4
2
|
|
|
5
3
|
const v37 = [
|
|
6
4
|
['convert-optional-to-logical/assign', 'optional-chaining/convert-optional-assign-to-logical'],
|
|
@@ -9,4 +7,14 @@ const v37 = [
|
|
|
9
7
|
['apply-optional-chaining/use', 'optional-chaining/convert-logical-to-optional'],
|
|
10
8
|
];
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
const {
|
|
11
|
+
report,
|
|
12
|
+
fix,
|
|
13
|
+
traverse,
|
|
14
|
+
} = createRenameProperty(v37);
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
report,
|
|
18
|
+
fix,
|
|
19
|
+
traverse,
|
|
20
|
+
};
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {createRenameProperty} = require('../rename-property');
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
4
2
|
|
|
5
3
|
const v37 = [
|
|
6
4
|
['add-missing-parens', 'parens/add-missing'],
|
|
7
5
|
];
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
const {
|
|
8
|
+
report,
|
|
9
|
+
fix,
|
|
10
|
+
traverse,
|
|
11
|
+
} = createRenameProperty(v37);
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
report,
|
|
15
|
+
fix,
|
|
16
|
+
traverse,
|
|
17
|
+
};
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const {
|
|
4
|
+
report,
|
|
5
|
+
fix,
|
|
6
|
+
traverse,
|
|
7
|
+
} = createRenameProperty([
|
|
6
8
|
['remove-useless-variables/await', 'promises/remove-useless-variables'],
|
|
7
9
|
]);
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
report,
|
|
13
|
+
fix,
|
|
14
|
+
traverse,
|
|
15
|
+
};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const {
|
|
4
|
+
report,
|
|
5
|
+
fix,
|
|
6
|
+
traverse,
|
|
7
|
+
} = createRenameProperty([
|
|
6
8
|
['apply-early-return', 'return/apply-early'],
|
|
7
9
|
['remove-useless-return', 'return/remove-useless'],
|
|
8
10
|
['simplify-boolean-return', 'return/simplify-boolean'],
|
|
9
11
|
['convert-break-to-return', 'return/convert-from-break'],
|
|
10
12
|
]);
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
report,
|
|
16
|
+
fix,
|
|
17
|
+
traverse,
|
|
18
|
+
};
|
package/lib/apply-tape/index.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const {
|
|
4
|
+
report,
|
|
5
|
+
fix,
|
|
6
|
+
traverse,
|
|
7
|
+
} = createRenameProperty([
|
|
6
8
|
['convert-mock-require-to-mock-import', 'tape/convert-mock-require-to-mock-import'],
|
|
7
9
|
]);
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
report,
|
|
13
|
+
fix,
|
|
14
|
+
traverse,
|
|
15
|
+
};
|
package/lib/apply-types/index.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const {
|
|
4
|
+
report,
|
|
5
|
+
fix,
|
|
6
|
+
traverse,
|
|
7
|
+
} = createRenameProperty([
|
|
6
8
|
['convert-typeof-to-is-type', 'types/convert-typeof-to-is-type'],
|
|
7
9
|
['remove-useless-type-conversions', 'types/remove-useless-type-conversions'],
|
|
8
10
|
['remove-useless-typeof', 'types/remove-useless-typeof'],
|
|
9
11
|
['apply-is-array', 'types/apply-is-array'],
|
|
10
12
|
['remove-useless-type-conversion/with-double-negations', 'types/remove-double-negations'],
|
|
11
13
|
]);
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
report,
|
|
17
|
+
fix,
|
|
18
|
+
traverse,
|
|
19
|
+
};
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const {types, operator} = require('putout');
|
|
1
|
+
import {types, operator} from 'putout';
|
|
4
2
|
|
|
5
3
|
const {replaceWith} = operator;
|
|
6
|
-
const {
|
|
4
|
+
const {stringLiteral} = types;
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
export const report = () => `Use 'String (on/off)' instead of 'Boolean (true/false)'`;
|
|
9
7
|
|
|
10
|
-
|
|
8
|
+
export const fix = (path) => {
|
|
11
9
|
const {value} = path.node;
|
|
12
|
-
const newValue =
|
|
10
|
+
const newValue = stringLiteral(value ? 'on' : 'off');
|
|
13
11
|
|
|
14
12
|
replaceWith(path, newValue);
|
|
15
13
|
};
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
export const traverse = ({push}) => ({
|
|
18
16
|
'__putout_processor_json(__object)'(path) {
|
|
19
17
|
const objectPath = path.get('arguments.0');
|
|
20
18
|
|
package/lib/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import * as applyAssignment from './apply-assignment/index.js';
|
|
2
|
+
import * as applyConditions from './apply-conditions/index.js';
|
|
3
|
+
import * as applyEsm from './apply-esm/index.js';
|
|
4
|
+
import * as applyOptionalChaining from './apply-optional-chaining/index.js';
|
|
5
|
+
import * as applyParens from './apply-parens/index.js';
|
|
6
|
+
import * as applyReturn from './apply-return/index.js';
|
|
7
|
+
import * as applyForOf from './apply-for-of/index.js';
|
|
8
|
+
import * as applyLabels from './apply-labels/index.js';
|
|
9
|
+
import * as applyMath from './apply-math/index.js';
|
|
10
|
+
import * as applyNodejs from './apply-nodejs/index.js';
|
|
11
|
+
import * as applyPromises from './apply-promises/index.js';
|
|
12
|
+
import * as applyTape from './apply-tape/index.js';
|
|
13
|
+
import * as applyTypes from './apply-types/index.js';
|
|
14
|
+
import * as convertBooleanToString from './convert-boolean-to-string/index.js';
|
|
15
|
+
import * as renameRules from './rename-rules/index.js';
|
|
16
|
+
import * as removeEmpty from './remove-empty/index.js';
|
|
17
|
+
import * as MoveFormatterUp from './move-formatter-up/index.js';
|
|
18
|
+
import * as removeEmptyFile from './remove-empty-file/index.js';
|
|
2
19
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const applyOptionalChaining = require('./apply-optional-chaining');
|
|
6
|
-
const applyParens = require('./apply-parens');
|
|
7
|
-
const applyReturn = require('./apply-return');
|
|
8
|
-
const applyForOf = require('./apply-for-of');
|
|
9
|
-
const applyLabels = require('./apply-labels');
|
|
10
|
-
const applyMath = require('./apply-math');
|
|
11
|
-
const applyNodejs = require('./apply-nodejs');
|
|
12
|
-
const applyPromises = require('./apply-promises');
|
|
13
|
-
const applyTape = require('./apply-tape');
|
|
14
|
-
const applyTypes = require('./apply-types');
|
|
15
|
-
const convertBooleanToString = require('./convert-boolean-to-string');
|
|
16
|
-
const renameRules = require('./rename-rules');
|
|
17
|
-
const removeEmpty = require('./remove-empty');
|
|
18
|
-
const MoveFormatterUp = require('./move-formatter-up');
|
|
19
|
-
const removeEmptyFile = require('./remove-empty-file');
|
|
20
|
-
|
|
21
|
-
module.exports.rules = {
|
|
20
|
+
export const rules = {
|
|
21
|
+
'apply-assignment': applyAssignment,
|
|
22
22
|
'apply-conditions': applyConditions,
|
|
23
23
|
'apply-esm': applyEsm,
|
|
24
24
|
'apply-for-of': applyForOf,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator, types} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
const {ObjectProperty} = types;
|
|
3
|
+
const {objectProperty} = types;
|
|
5
4
|
const {
|
|
6
5
|
insertAfter,
|
|
7
6
|
remove,
|
|
@@ -9,9 +8,9 @@ const {
|
|
|
9
8
|
__json,
|
|
10
9
|
} = operator;
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
export const report = () => `Move 'formatter' up`;
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
export const match = () => ({
|
|
15
14
|
[__json]: (vars, path) => {
|
|
16
15
|
const objectPath = path.get('arguments.0');
|
|
17
16
|
const {
|
|
@@ -36,7 +35,7 @@ module.exports.match = () => ({
|
|
|
36
35
|
},
|
|
37
36
|
});
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
export const replace = () => ({
|
|
40
39
|
[__json]: (vars, path) => {
|
|
41
40
|
const objectPath = path.get('arguments.0');
|
|
42
41
|
const {
|
|
@@ -46,7 +45,7 @@ module.exports.replace = () => ({
|
|
|
46
45
|
} = getProperties(objectPath, ['formatter', 'parser', 'printer']);
|
|
47
46
|
|
|
48
47
|
const {key, value} = formatterPath.node;
|
|
49
|
-
const node =
|
|
48
|
+
const node = objectProperty(key, value);
|
|
50
49
|
|
|
51
50
|
remove(formatterPath);
|
|
52
51
|
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {operator} = require('putout');
|
|
4
3
|
const {remove} = operator;
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
export const report = () => 'Avoid empty property values';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
export const fix = (path) => {
|
|
9
8
|
remove(path.parentPath);
|
|
10
9
|
};
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
export const include = () => [
|
|
13
12
|
'ObjectExpression',
|
|
14
13
|
'ArrayExpression',
|
|
15
14
|
];
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
export const filter = (path) => {
|
|
18
17
|
const {parentPath, node} = path;
|
|
19
18
|
|
|
20
19
|
const {properties, elements} = node;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {operator} = require('putout');
|
|
4
3
|
const {
|
|
5
4
|
readFileContent,
|
|
6
5
|
removeFile,
|
|
7
6
|
} = operator;
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
export const report = () => `Remove empty '.putout.json'`;
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
export const fix = (filePath) => {
|
|
12
11
|
removeFile(filePath);
|
|
13
12
|
};
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
export const scan = (path, {push, trackFile}) => {
|
|
16
15
|
for (const file of trackFile(path, '.putout.json')) {
|
|
17
16
|
const data = readFileContent(file);
|
|
18
17
|
|
package/lib/rename-property.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
-
const {operator} = require('putout');
|
|
4
3
|
const {
|
|
5
4
|
traverseProperties,
|
|
6
5
|
__json,
|
|
7
6
|
setLiteralValue,
|
|
8
7
|
} = operator;
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
export const createRenameProperty = (tuples) => ({
|
|
11
10
|
report,
|
|
12
11
|
fix,
|
|
13
12
|
traverse: createTraverse(tuples),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import {createRenameProperty} from '../rename-property.js';
|
|
2
2
|
|
|
3
|
-
const {createRenameProperty} = require('../rename-property');
|
|
4
3
|
const v29 = [
|
|
5
4
|
['declare-undefined-variables', 'declare'],
|
|
6
5
|
['apply-array-at', 'array-at'],
|
|
@@ -12,7 +11,17 @@ const v26 = [
|
|
|
12
11
|
['strict-mode/remove', 'strict-mode/remove-useless'],
|
|
13
12
|
];
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
const {
|
|
15
|
+
report,
|
|
16
|
+
fix,
|
|
17
|
+
traverse,
|
|
18
|
+
} = createRenameProperty([
|
|
16
19
|
...v29,
|
|
17
20
|
...v26,
|
|
18
21
|
]);
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
report,
|
|
25
|
+
fix,
|
|
26
|
+
traverse,
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin helps to maintain putout config",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/plugin-putout-config#readme",
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
"config"
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@putout/
|
|
34
|
+
"@putout/eslint-flat": "^3.0.0",
|
|
35
|
+
"@putout/test": "^13.0.0",
|
|
35
36
|
"c8": "^10.0.0",
|
|
36
37
|
"eslint": "^9.0.0",
|
|
37
38
|
"eslint-plugin-n": "^17.0.0",
|
|
38
|
-
"eslint-plugin-putout": "^
|
|
39
|
-
"
|
|
40
|
-
"madrun": "^10.0.0",
|
|
39
|
+
"eslint-plugin-putout": "^26.0.0",
|
|
40
|
+
"madrun": "^11.0.0",
|
|
41
41
|
"nodemon": "^3.0.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"putout": ">=
|
|
44
|
+
"putout": ">=39"
|
|
45
45
|
},
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"engines": {
|
|
48
|
-
"node": ">=
|
|
48
|
+
"node": ">=20"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|