@@ -53,7 +53,7 @@ const CODE_PATH_EVENTS = [ |
53 | 53 | /** |
54 | 54 | * Validates that the given AST has the required information. |
55 | 55 | * @param {ASTNode} ast The Program node of the AST to check. |
56 | | - * @throws {Error} If the AST doesn't contain the correct information. |
| 56 | + * @throws {TypeError} If the AST doesn't contain the correct information. |
57 | 57 | * @returns {void} |
58 | 58 | * @private |
59 | 59 | */ |
@@ -147,8 +147,8 @@ function sortedMerge(tokens, comments) { |
147 | 147 | * Normalizes a value for a global in a config |
148 | 148 | * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in |
149 | 149 | * a global directive comment |
150 | | - * @returns {("readable"|"writeable"|"off")} The value normalized as a string |
151 | | - * @throws Error if global value is invalid |
| 150 | + * @returns {("readonly"|"writable"|"off")} The value normalized as a string |
| 151 | + * @throws {Error} if global value is invalid |
152 | 152 | */ |
153 | 153 | function normalizeConfigGlobal(configuredValue) { |
154 | 154 | switch (configuredValue) { |
@@ -471,6 +471,10 @@ class SourceCode extends TokenStore { |
471 | 471 | * @type {string[]} |
472 | 472 | */ |
473 | 473 | this.lines = []; |
| 474 | + |
| 475 | + /** |
| 476 | + * @type {number[]} |
| 477 | + */ |
474 | 478 | this.lineStartIndices = [0]; |
475 | 479 |
|
476 | 480 | const lineEndingPattern = astUtils.createGlobalLinebreakMatcher(); |
@@ -528,7 +532,7 @@ class SourceCode extends TokenStore { |
528 | 532 |
|
529 | 533 | /** |
530 | 534 | * Gets the entire source text split into an array of lines. |
531 | | - * @returns {Array} The source text as an array of lines. |
| 535 | + * @returns {string[]} The source text as an array of lines. |
532 | 536 | * @public |
533 | 537 | */ |
534 | 538 | getLines() { |
@@ -687,8 +691,8 @@ class SourceCode extends TokenStore { |
687 | 691 | /** |
688 | 692 | * Converts a source text index into a (line, column) pair. |
689 | 693 | * @param {number} index The index of a character in a file |
690 | | - * @throws {TypeError} If non-numeric index or index out of range. |
691 | | - * @returns {Object} A {line, column} location object with a 0-indexed column |
| 694 | + * @throws {TypeError|RangeError} If non-numeric index or index out of range. |
| 695 | + * @returns {{line: number, column: number}} A {line, column} location object with a 0-indexed column |
692 | 696 | * @public |
693 | 697 | */ |
694 | 698 | getLocFromIndex(index) { |
|