@putout/eslint 3.6.0 → 3.8.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.
Files changed (2) hide show
  1. package/lib/eslint.js +14 -6
  2. package/package.json +2 -2
package/lib/eslint.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const {join} = require('node:path');
3
4
  const process = require('node:process');
4
5
  const tryToCatch = require('try-to-catch');
5
6
 
@@ -9,9 +10,12 @@ const {isIgnored} = require('./ignore');
9
10
  const {keys} = Object;
10
11
  const eslintId = ' (eslint)';
11
12
 
12
- const overrideConfigFile = process.env.ESLINT_CONFIG_FILE;
13
13
  const noESLint = process.env.NO_ESLINT;
14
14
  const noESLintWarnings = process.env.NO_ESLINT_WARNINGS;
15
+ const {ESLINT_CONFIG_FILE} = process.env;
16
+
17
+ const dir = process.cwd();
18
+ const overrideConfigFile = parseOverride(dir, ESLINT_CONFIG_FILE);
15
19
 
16
20
  const NO_FLAT_CONFIG_FOUND = 'Could not find config file.';
17
21
  const WARNING = 1;
@@ -95,17 +99,14 @@ module.exports = async ({name, code, fix, config, putout = false}) => {
95
99
  return noChanges;
96
100
 
97
101
  const [report] = results;
98
- const {output} = report;
102
+ const {output = code} = report;
99
103
 
100
104
  const places = report
101
105
  .messages
102
106
  .map(convertToPlace)
103
107
  .filter(Boolean);
104
108
 
105
- return [
106
- output || code,
107
- places,
108
- ];
109
+ return [output, places];
109
110
  };
110
111
 
111
112
  module.exports._noConfigFound = noConfigFound;
@@ -161,3 +162,10 @@ function parseError(e) {
161
162
  message: `Plugin missing: ${messageData.pluginName}`,
162
163
  };
163
164
  }
165
+
166
+ function parseOverride(dir, configFilePath) {
167
+ if (!configFilePath)
168
+ return configFilePath;
169
+
170
+ return join(dir, configFilePath);
171
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/eslint",
3
- "version": "3.6.0",
3
+ "version": "3.8.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Wrapper that simplifies ESLint API and makes it compatible with 🐊Putout",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",
19
- "url": "git://github.com/coderaiser/putout.git"
19
+ "url": "git+https://github.com/coderaiser/putout.git"
20
20
  },
21
21
  "scripts": {
22
22
  "test": "madrun test",