@putout/eslint 1.6.0 → 1.7.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 (3) hide show
  1. package/README.md +10 -0
  2. package/lib/eslint.js +10 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,6 +13,16 @@ Wrapper that simplifies [**ESLint**](https://eslint.org/) API and makes it compa
13
13
  npm i @putout/eslint
14
14
  ```
15
15
 
16
+ ## Environemnt Variables
17
+
18
+ - ☝️ To set custom config file for **ESLint** use `ESLINT_CONFIG_FILE` env variable:
19
+ - ☝️ To disable **ESLint** support use `NO_ESLINT=1` env variable:
20
+ - ☝️ If you want to ignore **ESLint** warnings (which is unfixable errors in 🐊**Putout** language) use `NO_ESLINT_WARNINGS=1`:
21
+
22
+
23
+ ```sh
24
+ NO_ESLINT_WARNINGS=1 putout --fix lib
25
+
16
26
  ## API
17
27
 
18
28
  ### `eslint(options)`
package/lib/eslint.js CHANGED
@@ -7,6 +7,9 @@ const {keys} = Object;
7
7
  const eslintId = ' (eslint)';
8
8
  const overrideConfigFile = process.env.ESLINT_CONFIG_FILE;
9
9
  const noESLint = process.env.NO_ESLINT;
10
+ const noESLintWarnings = process.env.NO_ESLINT_WARNINGS;
11
+
12
+ const WARNING = 1;
10
13
 
11
14
  const noConfigFound = (config, configError) => {
12
15
  if (configError && configError.messageTemplate === 'no-config-found')
@@ -78,7 +81,9 @@ module.exports = async ({name, code, fix, config, putout = false}) => {
78
81
 
79
82
  const [report] = results;
80
83
  const {output} = report;
81
- const places = report.messages.map(convertToPlace);
84
+ const places = report.messages
85
+ .map(convertToPlace)
86
+ .filter(Boolean);
82
87
 
83
88
  return [
84
89
  output || code,
@@ -91,9 +96,12 @@ module.exports._noConfigFound = noConfigFound;
91
96
  const parseRule = (rule) => rule || 'parser';
92
97
 
93
98
  module.exports.convertToPlace = convertToPlace;
94
- function convertToPlace({ruleId = 'parser', message, line = 0, column = 0}) {
99
+ function convertToPlace({ruleId = 'parser', message, line = 0, column = 0, severity}) {
95
100
  const rule = `${parseRule(ruleId)}${eslintId}`;
96
101
 
102
+ if (severity === WARNING && noESLintWarnings)
103
+ return null;
104
+
97
105
  return {
98
106
  rule,
99
107
  message: replaceControlChars(message),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/eslint",
3
- "version": "1.6.0",
3
+ "version": "1.7.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",