eslint-plugin-putout 26.0.3 → 26.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.
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  const process = require('node:process');
4
-
5
4
  const {accessSync} = require('node:fs');
6
5
 
7
6
  const {
@@ -44,6 +43,9 @@ module.exports.fix = ({node, text, filename}) => {
44
43
  module.exports.filter = ({node}) => {
45
44
  const value = getValue(node);
46
45
 
46
+ if (!value || value.endsWith('.js'))
47
+ return false;
48
+
47
49
  if (!isRelativeStart(value))
48
50
  return false;
49
51
 
@@ -55,10 +57,10 @@ function resolveSource({dir, value}) {
55
57
  const name = join(dir, value, 'package.json');
56
58
  const [error, info] = tryCatch(require, name);
57
59
 
58
- if (error)
59
- return value;
60
+ if (!error)
61
+ return join(value, info.main);
60
62
 
61
- return join(value, info.main);
63
+ return `${value}/index.js`;
62
64
  }
63
65
 
64
66
  for (const ext of ['js', 'mjs', 'cjs']) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "26.0.3",
3
+ "version": "26.1.0",
4
4
  "type": "commonjs",
5
5
  "description": "ESLint plugin for 🐊Putout",
6
6
  "release": false,