@putout/plugin-putout 13.3.0 β†’ 14.1.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 CHANGED
@@ -23,6 +23,7 @@ npm i @putout/plugin-putout -D
23
23
  "putout/apply-remove": "on",
24
24
  "putout/apply-insert-before": "on",
25
25
  "putout/apply-insert-after": "on",
26
+ "putout/apply-namaspace-specifier": "on",
26
27
  "putout/add-args": "on",
27
28
  "putout/add-push": "on",
28
29
  "putout/check-match": "on",
@@ -212,6 +213,24 @@ const test = createTest({
212
213
  });
213
214
  ```
214
215
 
216
+ ## apply-namaspace-specifier
217
+
218
+ Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/c8ccc07044299e463807773705aec583/71722e57f2b0b03eb8300ab6fe268251dc696629).
219
+
220
+ ### ❌ Example of incorrect code
221
+
222
+ ```js
223
+ import a from './index.js';
224
+ import b from '../lib/index.js';
225
+ ```
226
+
227
+ ### βœ… Example of correct code
228
+
229
+ ```js
230
+ import * as a from './index.js';
231
+ import * as b from '../lib/index.js';
232
+ ```
233
+
215
234
  ## create-test
216
235
 
217
236
  Add properties to `createTest` options, here is exmample of `.putout.json`:
@@ -38,7 +38,10 @@ const checkArgs = (push) => (path) => {
38
38
  return;
39
39
 
40
40
  traverse(path, {
41
- 'push(__)': () => {
41
+ 'push(__)': (currentPath) => {
42
+ if (currentPath.scope.getAllBindings().push)
43
+ return;
44
+
42
45
  push({
43
46
  path,
44
47
  fn,
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ module.exports.report = () => `Use 'if condition' instead of 'ternary expression'`;
4
+
5
+ module.exports.fix = (path) => {
6
+ path.node.specifiers[0].type = 'ImportNamespaceSpecifier';
7
+ };
8
+
9
+ module.exports.traverse = ({push}) => ({
10
+ ImportDeclaration(path) {
11
+ const {value} = path.node.source;
12
+
13
+ if (value === './index.js') {
14
+ push(path);
15
+ return;
16
+ }
17
+
18
+ if (value === '../lib/index.js')
19
+ push(path);
20
+ },
21
+ });
@@ -22,6 +22,7 @@
22
22
  "isESM": "const {isESM} = operator",
23
23
  "getProperty": "const {getProperty} = operator",
24
24
  "getProperties": "const {getProperties} = operator",
25
+ "traverseProperties": "const {traverseProperties} = operator",
25
26
  "isSimple": "const {isSimple} = operator",
26
27
  "setLiteralValue": "const {setLiteralValue} = operator"
27
28
  }
package/lib/index.js CHANGED
@@ -43,4 +43,5 @@ module.exports.rules = {
43
43
  ...getRule('move-require-on-top-level'),
44
44
  ...getRule('includer'),
45
45
  ...getRule('create-test'),
46
+ ...getRule('apply-namaspace-specifier'),
46
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "13.3.0",
3
+ "version": "14.1.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",
@@ -40,14 +40,14 @@
40
40
  "c8": "^8.0.0",
41
41
  "eslint": "^8.0.1",
42
42
  "eslint-plugin-n": "^16.0.0",
43
- "eslint-plugin-putout": "^18.0.0",
43
+ "eslint-plugin-putout": "^19.0.0",
44
44
  "lerna": "^6.0.1",
45
45
  "madrun": "^9.0.0",
46
46
  "montag": "^1.2.1",
47
47
  "nodemon": "^3.0.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "putout": ">=30"
50
+ "putout": ">=31"
51
51
  },
52
52
  "license": "MIT",
53
53
  "engines": {