@putout/eslint 3.4.0 → 3.5.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/lib/eslint.js CHANGED
@@ -1,14 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  const process = require('node:process');
4
- const {simpleImport} = require('./simple-import.js');
5
4
  const tryToCatch = require('try-to-catch');
6
5
 
6
+ const {simpleImport} = require('./simple-import.js');
7
+ const {isIgnored} = require('./ignore');
8
+
7
9
  const {keys} = Object;
8
10
  const eslintId = ' (eslint)';
11
+
9
12
  const overrideConfigFile = process.env.ESLINT_CONFIG_FILE;
10
13
  const noESLint = process.env.NO_ESLINT;
11
14
  const noESLintWarnings = process.env.NO_ESLINT_WARNINGS;
15
+
12
16
  const NO_FLAT_CONFIG_FOUND = 'Could not find config file.';
13
17
 
14
18
  const WARNING = 1;
@@ -110,6 +114,9 @@ function convertToPlace({ruleId = 'parser', message, line = 0, column = 0, sever
110
114
  if (severity === WARNING && noESLintWarnings)
111
115
  return null;
112
116
 
117
+ if (isIgnored(message))
118
+ return null;
119
+
113
120
  return {
114
121
  rule,
115
122
  message: replaceControlChars(message),
package/lib/ignore.js ADDED
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ const MESSAGES = [
4
+ `Parsing error: Cannot use keyword 'await' outside an async function`,
5
+ `Parsing error: The keyword 'yield' is reserved`,
6
+ `Parsing error: Unexpected reserved word 'await'`,
7
+ `Parsing error: Unexpected reserved word 'yield'`,
8
+ ];
9
+
10
+ module.exports.isIgnored = (message) => {
11
+ for (const current of MESSAGES) {
12
+ if (message.includes(current))
13
+ return true;
14
+ }
15
+
16
+ return false;
17
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/eslint",
3
- "version": "3.4.0",
3
+ "version": "3.5.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",