Update ESLint-related packages
R=jacktfranklin@chromium.org
No-Presubmit: True
Bug: none
Change-Id: I52dc24b12e350787085c5e3d131cface7ea87142
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3060705
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
diff --git a/node_modules/eslint-module-utils/parse.js b/node_modules/eslint-module-utils/parse.js
index b3a4692..9cc2380 100644
--- a/node_modules/eslint-module-utils/parse.js
+++ b/node_modules/eslint-module-utils/parse.js
@@ -1,82 +1,82 @@
-'use strict'
-exports.__esModule = true
+'use strict';
+exports.__esModule = true;
-const moduleRequire = require('./module-require').default
-const extname = require('path').extname
+const moduleRequire = require('./module-require').default;
+const extname = require('path').extname;
-const log = require('debug')('eslint-plugin-import:parse')
+const log = require('debug')('eslint-plugin-import:parse');
exports.default = function parse(path, content, context) {
- if (context == null) throw new Error('need context to parse properly')
+ if (context == null) throw new Error('need context to parse properly');
- let parserOptions = context.parserOptions
- const parserPath = getParserPath(path, context)
+ let parserOptions = context.parserOptions;
+ const parserPath = getParserPath(path, context);
- if (!parserPath) throw new Error('parserPath is required!')
+ if (!parserPath) throw new Error('parserPath is required!');
// hack: espree blows up with frozen options
- parserOptions = Object.assign({}, parserOptions)
- parserOptions.ecmaFeatures = Object.assign({}, parserOptions.ecmaFeatures)
+ parserOptions = Object.assign({}, parserOptions);
+ parserOptions.ecmaFeatures = Object.assign({}, parserOptions.ecmaFeatures);
// always include comments and tokens (for doc parsing)
- parserOptions.comment = true
- parserOptions.attachComment = true // keeping this for backward-compat with older parsers
- parserOptions.tokens = true
+ parserOptions.comment = true;
+ parserOptions.attachComment = true; // keeping this for backward-compat with older parsers
+ parserOptions.tokens = true;
// attach node locations
- parserOptions.loc = true
- parserOptions.range = true
+ parserOptions.loc = true;
+ parserOptions.range = true;
// provide the `filePath` like eslint itself does, in `parserOptions`
// https://github.com/eslint/eslint/blob/3ec436ee/lib/linter.js#L637
- parserOptions.filePath = path
-
+ parserOptions.filePath = path;
+
// @typescript-eslint/parser will parse the entire project with typechecking if you provide
// "project" or "projects" in parserOptions. Removing these options means the parser will
// only parse one file in isolate mode, which is much, much faster.
// https://github.com/benmosher/eslint-plugin-import/issues/1408#issuecomment-509298962
- delete parserOptions.project
- delete parserOptions.projects
-
+ delete parserOptions.project;
+ delete parserOptions.projects;
+
// require the parser relative to the main module (i.e., ESLint)
- const parser = moduleRequire(parserPath)
+ const parser = moduleRequire(parserPath);
if (typeof parser.parseForESLint === 'function') {
- let ast
+ let ast;
try {
- ast = parser.parseForESLint(content, parserOptions).ast
+ ast = parser.parseForESLint(content, parserOptions).ast;
} catch (e) {
- console.warn()
- console.warn('Error while parsing ' + parserOptions.filePath)
- console.warn('Line ' + e.lineNumber + ', column ' + e.column + ': ' + e.message)
+ console.warn();
+ console.warn('Error while parsing ' + parserOptions.filePath);
+ console.warn('Line ' + e.lineNumber + ', column ' + e.column + ': ' + e.message);
}
if (!ast || typeof ast !== 'object') {
console.warn(
'`parseForESLint` from parser `' +
parserPath +
'` is invalid and will just be ignored'
- )
+ );
} else {
- return ast
+ return ast;
}
}
- return parser.parse(content, parserOptions)
-}
+ return parser.parse(content, parserOptions);
+};
function getParserPath(path, context) {
- const parsers = context.settings['import/parsers']
+ const parsers = context.settings['import/parsers'];
if (parsers != null) {
- const extension = extname(path)
- for (let parserPath in parsers) {
+ const extension = extname(path);
+ for (const parserPath in parsers) {
if (parsers[parserPath].indexOf(extension) > -1) {
// use this alternate parser
- log('using alt parser:', parserPath)
- return parserPath
+ log('using alt parser:', parserPath);
+ return parserPath;
}
}
}
// default to use ESLint parser
- return context.parserPath
+ return context.parserPath;
}