tools: update ESLint to 8.0.0

PR-URL: https://github.com/nodejs/node/pull/40394
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Rich Trott
2021-10-09 18:11:41 -07:00
parent dd8e219d71
commit 8ca76eba73
814 changed files with 34870 additions and 31943 deletions

View File

@@ -143,10 +143,12 @@ function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) {
// Public Interface
//------------------------------------------------------------------------------
/**
* Represents parsed source code.
*/
class SourceCode extends TokenStore {
/**
* Represents parsed source code.
* @param {string|Object} textOrConfig The source code text or config object.
* @param {string} textOrConfig.text The source code text.
* @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped.
@@ -175,20 +177,20 @@ class SourceCode extends TokenStore {
/**
* The flag to indicate that the source code has Unicode BOM.
* @type boolean
* @type {boolean}
*/
this.hasBOM = (text.charCodeAt(0) === 0xFEFF);
/**
* The original text source code.
* BOM was stripped from this text.
* @type string
* @type {string}
*/
this.text = (this.hasBOM ? text.slice(1) : text);
/**
* The parsed AST for the source code.
* @type ASTNode
* @type {ASTNode}
*/
this.ast = ast;
@@ -223,7 +225,7 @@ class SourceCode extends TokenStore {
/**
* The source code split into lines according to ECMA-262 specification.
* This is done to avoid each rule needing to do so separately.
* @type string[]
* @type {string[]}
*/
this.lines = [];
this.lineStartIndices = [0];
@@ -506,6 +508,7 @@ class SourceCode extends TokenStore {
/**
* Converts a source text index into a (line, column) pair.
* @param {number} index The index of a character in a file
* @throws {TypeError} If non-numeric index or index out of range.
* @returns {Object} A {line, column} location object with a 0-indexed column
* @public
*/
@@ -545,6 +548,9 @@ class SourceCode extends TokenStore {
* @param {Object} loc A line/column location
* @param {number} loc.line The line number of the location (1-indexed)
* @param {number} loc.column The column number of the location (0-indexed)
* @throws {TypeError|RangeError} If `loc` is not an object with a numeric
* `line` and `column`, if the `line` is less than or equal to zero or
* the line or column is out of the expected range.
* @returns {number} The range index of the location in the file.
* @public
*/