Skip to content

Commit 6df7980

Browse files
committed
feature: @putout/plugin-putout-config: apply-assignment: add
1 parent 2f86e89 commit 6df7980

File tree

11 files changed

+105
-1
lines changed

11 files changed

+105
-1
lines changed

packages/plugin-minify/.putout.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"match": {
33
"*.md": {
44
"split-variable-declarations": "off",
5-
"split-assignment-expressions": "off",
5+
"assignment/split": "off",
66
"convert-template-to-string": "off",
77
"conditions/convert-equal-to-strict-equal": "off"
88
}

packages/plugin-putout-config/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ npm i @putout/plugin-putout-config -D
1313

1414
## Rules
1515

16+
-[apply-assignment](#apply-assignment);
1617
-[apply-conditions](#apply-conditions);
1718
-[apply-esm](#apply-esm);
1819
-[apply-return](#apply-return);
@@ -37,6 +38,7 @@ npm i @putout/plugin-putout-config -D
3738
```json
3839
{
3940
"rules": {
41+
"putout-config/apply-assignment": "on",
4042
"putout-config/apply-conditions": "on",
4143
"putout-config/apply-esm": "on",
4244
"putout-config/apply-for-of": "on",
@@ -58,6 +60,29 @@ npm i @putout/plugin-putout-config -D
5860
}
5961
```
6062

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+
6186
## apply-return
6287

6388
Apply [`return`](https://github.com/coderaiser/putout/tree/master/packages/plugin-return#readme) according to:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__putout_processor_json({
2+
"rules": {
3+
"assignment/split": "off",
4+
"assignment/simplify": "off",
5+
"assignment/convert-to-arrow-function": "off",
6+
"assignment/convert-to-comparisson": "off",
7+
"assignment/convert-to-declaration": "off"
8+
}
9+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__putout_processor_json({
2+
"rules": {
3+
"split-assignment-expressions": "off",
4+
"simplify-assignments": "off",
5+
"convert-assignment-to-arrow-function": "off",
6+
"convert-assignment-to-comparisson": "off",
7+
"convert-assignment-to-declaration": "off"
8+
}
9+
});
Original file line numberDiff line numberDiff line change
@@ -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+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import {createTest} from '@putout/test';
2+
import * as plugin from './index.js';
3+
4+
const test = createTest(import.meta.url, {
5+
plugins: [
6+
['apply-assignment', plugin],
7+
],
8+
});
9+
10+
test('putout-config: apply-assignment: report', (t) => {
11+
t.report('apply-assignment', `Rename property: 'split-assignment-expressions' -> 'assignment/split'`);
12+
t.end();
13+
});
14+
15+
test('putout-config: apply-assignment: transform', (t) => {
16+
t.transform('apply-assignment');
17+
t.end();
18+
});

packages/plugin-putout-config/lib/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as applyAssignment from './apply-assignment/index.js';
12
import * as applyConditions from './apply-conditions/index.js';
23
import * as applyEsm from './apply-esm/index.js';
34
import * as applyOptionalChaining from './apply-optional-chaining/index.js';
@@ -17,6 +18,7 @@ import * as MoveFormatterUp from './move-formatter-up/index.js';
1718
import * as removeEmptyFile from './remove-empty-file/index.js';
1819

1920
export const rules = {
21+
'apply-assignment': applyAssignment,
2022
'apply-conditions': applyConditions,
2123
'apply-esm': applyEsm,
2224
'apply-for-of': applyForOf,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__putout_processor_json({
2+
"rules": {
3+
"assignment/split": "off",
4+
"assignment/simplify": "off",
5+
"assignment/convert-to-arrow-function": "off",
6+
"assignment/convert-to-comparisson": "off",
7+
"assignment/convert-to-declaration": "off"
8+
}
9+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__putout_processor_json({
2+
"rules": {
3+
"split-assignment-expressions": "off",
4+
"simplify-assignments": "off",
5+
"convert-assignment-to-arrow-function": "off",
6+
"convert-assignment-to-comparisson": "off",
7+
"convert-assignment-to-declaration": "off"
8+
}
9+
});

packages/putout/putout.json

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
},
4949
"*.md": {
5050
"apply-arrow": "off",
51+
"assignment/convert-to-declaration": "off",
5152
"conditions/apply-consistent-blocks": "off",
5253
"conditions/convert-comparison-to-boolean": "off",
5354
"conditions/remove-constant": "off",

packages/putout/test/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ test('putout: config: markdown', (t) => {
9595

9696
const expected = {
9797
'apply-arrow': 'off',
98+
'assignment/convert-to-declaration': 'off',
9899
'conditions/apply-consistent-blocks': 'off',
99100
'conditions/convert-comparison-to-boolean': 'off',
100101
'conditions/remove-constant': 'off',

0 commit comments

Comments
 (0)