@putout/plugin-putout 24.7.0 → 25.0.1

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 CHANGED
@@ -14,7 +14,6 @@ npm i @putout/plugin-putout -D
14
14
  ## Rules
15
15
 
16
16
  - ✅ [add-await-to-progress](#add-await-to-progress);
17
- - ✅ [add-index-to-import](#add-index-to-import);
18
17
  - ✅ [add-places-to-compare-places](#add-places-to-compare-places);
19
18
  - ✅ [add-path-arg-to-fix](#add-path-arg-to-fix);
20
19
  - ✅ [add-path-arg-to-visitors](#add-path-arg-to-visitors);
@@ -95,12 +94,11 @@ npm i @putout/plugin-putout -D
95
94
  "putout/add-traverse-args": "on",
96
95
  "putout/add-track-file": "on",
97
96
  "putout/add-await-to-progress": "on",
98
- "putout/add-index-to-import": "on",
99
97
  "putout/apply-create-test": "on",
100
98
  "putout/apply-create-nested-directory": "on",
101
99
  "putout/apply-async-formatter": "on",
102
100
  "putout/apply-declare": "on",
103
- "putout/apply-exports": "on",
101
+ "putout/apply-exports": "off",
104
102
  "putout/apply-exports-to-add-args": "on",
105
103
  "putout/apply-exports-to-match-files": "on",
106
104
  "putout/apply-exports-to-rename-files": "on",
@@ -472,13 +470,13 @@ Possible configuration:
472
470
  ```json
473
471
  {
474
472
  "rules": {
475
- "putout/apply-exports": {
473
+ "putout/apply-exports": ["on", {
476
474
  "addArgs": [
477
475
  "report",
478
476
  "fix",
479
477
  "scan"
480
478
  ]
481
- }
479
+ }]
482
480
  }
483
481
  }
484
482
  ```
@@ -1436,29 +1434,6 @@ export const scan = (root, {push, progress, trackFile}) => {
1436
1434
  };
1437
1435
  ```
1438
1436
 
1439
- ## add-index-to-import
1440
-
1441
- ESM doesn't add `index.js`, so it can be left after [`@putout/plugin-convert-esm-to-commonjs`](https://github.com/coderaiser/putout/blob/master/packages/plugin-convert-esm-to-commonjs#readme).
1442
- Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/b7c489710767efee95ecf3dd16e232a2/9f974f0a345ef4d0cb39b011097dff82e6c32b75).
1443
-
1444
- ### ❌ Example of incorrect code
1445
-
1446
- ```js
1447
- import insertRust from './insert-rust.js';
1448
- import addAction from './add-action.js';
1449
-
1450
- export const rules = {};
1451
- ```
1452
-
1453
- ### ✅ Example of correct code
1454
-
1455
- ```js
1456
- import insertRust from './insert-rust/index.js';
1457
- import addAction from './add-action/index.js';
1458
-
1459
- export const rules = {};
1460
- ```
1461
-
1462
1437
  ## convert-add-argument-to-add-args
1463
1438
 
1464
1439
  ### ❌ Example of incorrect code
package/lib/index.js CHANGED
@@ -43,7 +43,6 @@ import * as includer from './includer/index.js';
43
43
  import * as createTest from './create-test/index.js';
44
44
  import * as applyNamespaceSpecifier from './apply-namespace-specifier/index.js';
45
45
  import * as convertGetRuleToRequire from './convert-get-rule-to-require/index.js';
46
- import * as addIndexToImport from './add-index-to-import/index.js';
47
46
  import * as applyRename from './apply-rename/index.js';
48
47
  import * as applyShortProcessors from './apply-short-processors/index.js';
49
48
  import * as addTrackFile from './add-track-file/index.js';
@@ -111,7 +110,6 @@ export const rules = {
111
110
  'create-test': createTest,
112
111
  'apply-namespace-specifier': applyNamespaceSpecifier,
113
112
  'convert-get-rule-to-require': convertGetRuleToRequire,
114
- 'add-index-to-import': addIndexToImport,
115
113
  'apply-rename': applyRename,
116
114
  'apply-short-processors': applyShortProcessors,
117
115
  'convert-traverse-to-scan': convertTraverseToScan,
@@ -137,5 +135,5 @@ export const rules = {
137
135
  'apply-report': applyReport,
138
136
  'apply-exports-to-match-files': applyExportsToMatchFiles,
139
137
  'apply-exports-to-rename-files': applyExportsToRenameFiles,
140
- 'apply-exports': applyExports,
138
+ 'apply-exports': ['off', applyExports],
141
139
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "24.7.0",
3
+ "version": "25.0.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",
@@ -57,7 +57,7 @@
57
57
  "supertape": "^11.0.3"
58
58
  },
59
59
  "peerDependencies": {
60
- "putout": ">=39"
60
+ "putout": ">=40"
61
61
  },
62
62
  "license": "MIT",
63
63
  "engines": {
@@ -1,48 +0,0 @@
1
- import {operator} from 'putout';
2
-
3
- const {setLiteralValue} = operator;
4
-
5
- export const report = (path) => {
6
- const {value} = path.node.source;
7
- return `Add 'index.js' to import: '${value}' -> '${value}/index.js'`;
8
- };
9
-
10
- export const fix = (path) => {
11
- const {source} = path.node;
12
- const {value} = source;
13
-
14
- if (value.endsWith('.js')) {
15
- setLiteralValue(source, value.replace('.js', '/index.js'));
16
- return;
17
- }
18
-
19
- setLiteralValue(source, `${value}/index.js`);
20
- };
21
-
22
- export const traverse = ({push, listStore}) => ({
23
- 'export const rules = __object': listStore,
24
- 'Program': {
25
- exit: (path) => {
26
- const rules = listStore();
27
-
28
- if (!rules.length)
29
- return;
30
-
31
- operator.traverse(path, {
32
- ImportDeclaration: createImportVisitor(push),
33
- });
34
- },
35
- },
36
- });
37
-
38
- const createImportVisitor = (push) => (path) => {
39
- const {value} = path.node.source;
40
-
41
- if (value.endsWith('.cjs'))
42
- return;
43
-
44
- if (value.endsWith('index.js'))
45
- return;
46
-
47
- push(path);
48
- };