eslint-linter-browserify 10.0.1 → 10.0.2
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/linter.cjs +178 -54
- package/linter.js +178 -54
- package/linter.min.js +1 -1
- package/linter.mjs +178 -54
- package/package.json +3 -3
package/linter.cjs
CHANGED
|
@@ -4216,7 +4216,7 @@ function requireEslintVisitorKeys$2 () {
|
|
|
4216
4216
|
return eslintVisitorKeys$2;
|
|
4217
4217
|
}
|
|
4218
4218
|
|
|
4219
|
-
var version = "10.0.
|
|
4219
|
+
var version = "10.0.2";
|
|
4220
4220
|
var require$$3$1 = {
|
|
4221
4221
|
version: version};
|
|
4222
4222
|
|
|
@@ -45691,6 +45691,13 @@ function requireAstUtils () {
|
|
|
45691
45691
|
const globals = requireGlobals();
|
|
45692
45692
|
const { LATEST_ECMA_VERSION } = requireEcmaVersion();
|
|
45693
45693
|
|
|
45694
|
+
//------------------------------------------------------------------------------
|
|
45695
|
+
// Types
|
|
45696
|
+
//------------------------------------------------------------------------------
|
|
45697
|
+
|
|
45698
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
45699
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
45700
|
+
|
|
45694
45701
|
//------------------------------------------------------------------------------
|
|
45695
45702
|
// Helpers
|
|
45696
45703
|
//------------------------------------------------------------------------------
|
|
@@ -47250,9 +47257,9 @@ function requireAstUtils () {
|
|
|
47250
47257
|
|
|
47251
47258
|
/**
|
|
47252
47259
|
* Finds the variable by a given name in a given scope and its upper scopes.
|
|
47253
|
-
* @param {
|
|
47260
|
+
* @param {Scope} initScope A scope to start find.
|
|
47254
47261
|
* @param {string} name A variable name to find.
|
|
47255
|
-
* @returns {
|
|
47262
|
+
* @returns {Variable|null} A found variable or `null`.
|
|
47256
47263
|
*/
|
|
47257
47264
|
getVariableByName(initScope, name) {
|
|
47258
47265
|
let scope = initScope;
|
|
@@ -47279,7 +47286,7 @@ function requireAstUtils () {
|
|
|
47279
47286
|
* - The given node is not `StaticBlock`.
|
|
47280
47287
|
* - The function name does not start with uppercase. It's a convention to capitalize the names
|
|
47281
47288
|
* of constructor functions. This check is not performed if `capIsConstructor` is set to `false`.
|
|
47282
|
-
* - The function does not have a JSDoc comment that has a
|
|
47289
|
+
* - The function does not have a JSDoc comment that has a `@this` tag.
|
|
47283
47290
|
*
|
|
47284
47291
|
* Next, this checks the location of the node.
|
|
47285
47292
|
* If the location is below, this judges `this` is valid.
|
|
@@ -51331,6 +51338,13 @@ function requireBlockScopedVar () {
|
|
|
51331
51338
|
if (hasRequiredBlockScopedVar) return blockScopedVar;
|
|
51332
51339
|
hasRequiredBlockScopedVar = 1;
|
|
51333
51340
|
|
|
51341
|
+
//------------------------------------------------------------------------------
|
|
51342
|
+
// Types
|
|
51343
|
+
//------------------------------------------------------------------------------
|
|
51344
|
+
|
|
51345
|
+
/** @typedef {import("eslint-scope").Definition} Definition */
|
|
51346
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
51347
|
+
|
|
51334
51348
|
//------------------------------------------------------------------------------
|
|
51335
51349
|
// Rule Definition
|
|
51336
51350
|
//------------------------------------------------------------------------------
|
|
@@ -51378,8 +51392,8 @@ function requireBlockScopedVar () {
|
|
|
51378
51392
|
|
|
51379
51393
|
/**
|
|
51380
51394
|
* Reports a given reference.
|
|
51381
|
-
* @param {
|
|
51382
|
-
* @param {
|
|
51395
|
+
* @param {Reference} reference A reference to report.
|
|
51396
|
+
* @param {Definition} definition A definition for which to report reference.
|
|
51383
51397
|
* @returns {void}
|
|
51384
51398
|
*/
|
|
51385
51399
|
function report(reference, definition) {
|
|
@@ -57994,9 +58008,19 @@ function requireFuncNames () {
|
|
|
57994
58008
|
|
|
57995
58009
|
const astUtils = requireAstUtils();
|
|
57996
58010
|
|
|
58011
|
+
//------------------------------------------------------------------------------
|
|
58012
|
+
// Types
|
|
58013
|
+
//------------------------------------------------------------------------------
|
|
58014
|
+
|
|
58015
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
58016
|
+
|
|
58017
|
+
//------------------------------------------------------------------------------
|
|
58018
|
+
// Helpers
|
|
58019
|
+
//------------------------------------------------------------------------------
|
|
58020
|
+
|
|
57997
58021
|
/**
|
|
57998
58022
|
* Checks whether or not a given variable is a function name.
|
|
57999
|
-
* @param {
|
|
58023
|
+
* @param {Variable} variable A variable to check.
|
|
58000
58024
|
* @returns {boolean} `true` if the variable is a function name.
|
|
58001
58025
|
*/
|
|
58002
58026
|
function isFunctionName(variable) {
|
|
@@ -74598,6 +74622,12 @@ function requireNoConsole () {
|
|
|
74598
74622
|
|
|
74599
74623
|
const astUtils = requireAstUtils();
|
|
74600
74624
|
|
|
74625
|
+
//------------------------------------------------------------------------------
|
|
74626
|
+
// Types
|
|
74627
|
+
//------------------------------------------------------------------------------
|
|
74628
|
+
|
|
74629
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
74630
|
+
|
|
74601
74631
|
//------------------------------------------------------------------------------
|
|
74602
74632
|
// Rule Definition
|
|
74603
74633
|
//------------------------------------------------------------------------------
|
|
@@ -74649,7 +74679,7 @@ function requireNoConsole () {
|
|
|
74649
74679
|
|
|
74650
74680
|
/**
|
|
74651
74681
|
* Checks whether the given reference is 'console' or not.
|
|
74652
|
-
* @param {
|
|
74682
|
+
* @param {Reference} reference The reference to check.
|
|
74653
74683
|
* @returns {boolean} `true` if the reference is 'console'.
|
|
74654
74684
|
*/
|
|
74655
74685
|
function isConsole(reference) {
|
|
@@ -74673,7 +74703,7 @@ function requireNoConsole () {
|
|
|
74673
74703
|
/**
|
|
74674
74704
|
* Checks whether the given reference is a member access which is not
|
|
74675
74705
|
* allowed by options or not.
|
|
74676
|
-
* @param {
|
|
74706
|
+
* @param {Reference} reference The reference to check.
|
|
74677
74707
|
* @returns {boolean} `true` if the reference is a member access which
|
|
74678
74708
|
* is not allowed by options.
|
|
74679
74709
|
*/
|
|
@@ -74750,7 +74780,7 @@ function requireNoConsole () {
|
|
|
74750
74780
|
|
|
74751
74781
|
/**
|
|
74752
74782
|
* Reports the given reference as a violation.
|
|
74753
|
-
* @param {
|
|
74783
|
+
* @param {Reference} reference The reference to report.
|
|
74754
74784
|
* @returns {void}
|
|
74755
74785
|
*/
|
|
74756
74786
|
function report(reference) {
|
|
@@ -79188,6 +79218,12 @@ function requireNoDupeArgs () {
|
|
|
79188
79218
|
|
|
79189
79219
|
const astUtils = requireAstUtils();
|
|
79190
79220
|
|
|
79221
|
+
//------------------------------------------------------------------------------
|
|
79222
|
+
// Types
|
|
79223
|
+
//------------------------------------------------------------------------------
|
|
79224
|
+
|
|
79225
|
+
/** @typedef {import("eslint-scope").Definition} Definition */
|
|
79226
|
+
|
|
79191
79227
|
//------------------------------------------------------------------------------
|
|
79192
79228
|
// Rule Definition
|
|
79193
79229
|
//------------------------------------------------------------------------------
|
|
@@ -79220,7 +79256,7 @@ function requireNoDupeArgs () {
|
|
|
79220
79256
|
|
|
79221
79257
|
/**
|
|
79222
79258
|
* Checks whether or not a given definition is a parameter's.
|
|
79223
|
-
* @param {
|
|
79259
|
+
* @param {Definition} def A definition to check.
|
|
79224
79260
|
* @returns {boolean} `true` if the definition is a parameter's.
|
|
79225
79261
|
*/
|
|
79226
79262
|
function isParameter(def) {
|
|
@@ -80337,6 +80373,12 @@ function requireNoElseReturn () {
|
|
|
80337
80373
|
const astUtils = requireAstUtils();
|
|
80338
80374
|
const FixTracker = requireFixTracker();
|
|
80339
80375
|
|
|
80376
|
+
//------------------------------------------------------------------------------
|
|
80377
|
+
// Types
|
|
80378
|
+
//------------------------------------------------------------------------------
|
|
80379
|
+
|
|
80380
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
80381
|
+
|
|
80340
80382
|
//------------------------------------------------------------------------------
|
|
80341
80383
|
// Rule Definition
|
|
80342
80384
|
//------------------------------------------------------------------------------
|
|
@@ -80391,7 +80433,7 @@ function requireNoElseReturn () {
|
|
|
80391
80433
|
* This is not a generic function. In particular, it is assumed that the scope is a function scope or
|
|
80392
80434
|
* a function's inner scope, and that the names can be valid identifiers in the given scope.
|
|
80393
80435
|
* @param {string[]} names Array of variable names.
|
|
80394
|
-
* @param {
|
|
80436
|
+
* @param {Scope} scope Function scope or a function's inner scope.
|
|
80395
80437
|
* @returns {boolean} True if all names can be safely declared, false otherwise.
|
|
80396
80438
|
*/
|
|
80397
80439
|
function isSafeToDeclare(names, scope) {
|
|
@@ -80483,7 +80525,7 @@ function requireNoElseReturn () {
|
|
|
80483
80525
|
/**
|
|
80484
80526
|
* Checks whether the removal of `else` and its braces is safe from variable name collisions.
|
|
80485
80527
|
* @param {Node} node The 'else' node.
|
|
80486
|
-
* @param {
|
|
80528
|
+
* @param {Scope} scope The scope in which the node and the whole 'if' statement is.
|
|
80487
80529
|
* @returns {boolean} True if it is safe, false otherwise.
|
|
80488
80530
|
*/
|
|
80489
80531
|
function isSafeFromNameCollisions(node, scope) {
|
|
@@ -81526,6 +81568,12 @@ function requireNoEval () {
|
|
|
81526
81568
|
|
|
81527
81569
|
const astUtils = requireAstUtils();
|
|
81528
81570
|
|
|
81571
|
+
//------------------------------------------------------------------------------
|
|
81572
|
+
// Types
|
|
81573
|
+
//------------------------------------------------------------------------------
|
|
81574
|
+
|
|
81575
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
81576
|
+
|
|
81529
81577
|
//------------------------------------------------------------------------------
|
|
81530
81578
|
// Helpers
|
|
81531
81579
|
//------------------------------------------------------------------------------
|
|
@@ -81653,7 +81701,7 @@ function requireNoEval () {
|
|
|
81653
81701
|
|
|
81654
81702
|
/**
|
|
81655
81703
|
* Reports accesses of `eval` via the global object.
|
|
81656
|
-
* @param {
|
|
81704
|
+
* @param {Scope} globalScope The global scope.
|
|
81657
81705
|
* @returns {void}
|
|
81658
81706
|
*/
|
|
81659
81707
|
function reportAccessingEvalViaGlobalObject(globalScope) {
|
|
@@ -81686,7 +81734,7 @@ function requireNoEval () {
|
|
|
81686
81734
|
|
|
81687
81735
|
/**
|
|
81688
81736
|
* Reports all accesses of `eval` (excludes direct calls to eval).
|
|
81689
|
-
* @param {
|
|
81737
|
+
* @param {Scope} globalScope The global scope.
|
|
81690
81738
|
* @returns {void}
|
|
81691
81739
|
*/
|
|
81692
81740
|
function reportAccessingEval(globalScope) {
|
|
@@ -88026,6 +88074,12 @@ function requireNoLoopFunc () {
|
|
|
88026
88074
|
if (hasRequiredNoLoopFunc) return noLoopFunc;
|
|
88027
88075
|
hasRequiredNoLoopFunc = 1;
|
|
88028
88076
|
|
|
88077
|
+
//------------------------------------------------------------------------------
|
|
88078
|
+
// Types
|
|
88079
|
+
//------------------------------------------------------------------------------
|
|
88080
|
+
|
|
88081
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
88082
|
+
|
|
88029
88083
|
//------------------------------------------------------------------------------
|
|
88030
88084
|
// Helpers
|
|
88031
88085
|
//------------------------------------------------------------------------------
|
|
@@ -88157,7 +88211,7 @@ function requireNoLoopFunc () {
|
|
|
88157
88211
|
* Checks whether a given reference which refers to an upper scope's variable is
|
|
88158
88212
|
* safe or not.
|
|
88159
88213
|
* @param {ASTNode} loopNode A containing loop node.
|
|
88160
|
-
* @param {
|
|
88214
|
+
* @param {Reference} reference A reference to check.
|
|
88161
88215
|
* @returns {boolean} `true` if the reference is safe or not.
|
|
88162
88216
|
*/
|
|
88163
88217
|
function isSafe(loopNode, reference) {
|
|
@@ -88203,7 +88257,7 @@ function requireNoLoopFunc () {
|
|
|
88203
88257
|
* It's safe if the reference matches one of the following condition.
|
|
88204
88258
|
* - is readonly.
|
|
88205
88259
|
* - doesn't exist inside a local function and after the border.
|
|
88206
|
-
* @param {
|
|
88260
|
+
* @param {Reference} upperRef A reference to check.
|
|
88207
88261
|
* @returns {boolean} `true` if the reference is safe.
|
|
88208
88262
|
*/
|
|
88209
88263
|
function isSafeReference(upperRef) {
|
|
@@ -97837,6 +97891,12 @@ function requireNoShadow () {
|
|
|
97837
97891
|
|
|
97838
97892
|
const astUtils = requireAstUtils();
|
|
97839
97893
|
|
|
97894
|
+
//------------------------------------------------------------------------------
|
|
97895
|
+
// Types
|
|
97896
|
+
//------------------------------------------------------------------------------
|
|
97897
|
+
|
|
97898
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
97899
|
+
|
|
97840
97900
|
//------------------------------------------------------------------------------
|
|
97841
97901
|
// Helpers
|
|
97842
97902
|
//------------------------------------------------------------------------------
|
|
@@ -98278,7 +98338,7 @@ function requireNoShadow () {
|
|
|
98278
98338
|
|
|
98279
98339
|
/**
|
|
98280
98340
|
* Get declared line and column of a variable.
|
|
98281
|
-
* @param {
|
|
98341
|
+
* @param {Variable} variable The variable to get.
|
|
98282
98342
|
* @returns {Object} The declared line and column of the variable.
|
|
98283
98343
|
*/
|
|
98284
98344
|
function getDeclaredLocation(variable) {
|
|
@@ -100101,6 +100161,12 @@ function requireNoUndefined () {
|
|
|
100101
100161
|
if (hasRequiredNoUndefined) return noUndefined;
|
|
100102
100162
|
hasRequiredNoUndefined = 1;
|
|
100103
100163
|
|
|
100164
|
+
//------------------------------------------------------------------------------
|
|
100165
|
+
// Types
|
|
100166
|
+
//------------------------------------------------------------------------------
|
|
100167
|
+
|
|
100168
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
100169
|
+
|
|
100104
100170
|
//------------------------------------------------------------------------------
|
|
100105
100171
|
// Rule Definition
|
|
100106
100172
|
//------------------------------------------------------------------------------
|
|
@@ -100142,7 +100208,7 @@ function requireNoUndefined () {
|
|
|
100142
100208
|
/**
|
|
100143
100209
|
* Checks the given scope for references to `undefined` and reports
|
|
100144
100210
|
* all references found.
|
|
100145
|
-
* @param {
|
|
100211
|
+
* @param {Scope} scope The scope to check.
|
|
100146
100212
|
* @returns {void}
|
|
100147
100213
|
*/
|
|
100148
100214
|
function checkScope(scope) {
|
|
@@ -100732,6 +100798,13 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
100732
100798
|
const Traverser = requireTraverser(),
|
|
100733
100799
|
astUtils = requireAstUtils();
|
|
100734
100800
|
|
|
100801
|
+
//------------------------------------------------------------------------------
|
|
100802
|
+
// Types
|
|
100803
|
+
//------------------------------------------------------------------------------
|
|
100804
|
+
|
|
100805
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
100806
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
100807
|
+
|
|
100735
100808
|
//------------------------------------------------------------------------------
|
|
100736
100809
|
// Helpers
|
|
100737
100810
|
//------------------------------------------------------------------------------
|
|
@@ -100745,7 +100818,7 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
100745
100818
|
|
|
100746
100819
|
/**
|
|
100747
100820
|
* @typedef {Object} LoopConditionInfo
|
|
100748
|
-
* @property {
|
|
100821
|
+
* @property {Reference} reference - The reference.
|
|
100749
100822
|
* @property {ASTNode} group - BinaryExpression or ConditionalExpression nodes
|
|
100750
100823
|
* that the reference is belonging to.
|
|
100751
100824
|
* @property {Function} isInLoop - The predicate which checks a given reference
|
|
@@ -100756,7 +100829,7 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
100756
100829
|
|
|
100757
100830
|
/**
|
|
100758
100831
|
* Checks whether or not a given reference is a write reference.
|
|
100759
|
-
* @param {
|
|
100832
|
+
* @param {Reference} reference A reference to check.
|
|
100760
100833
|
* @returns {boolean} `true` if the reference is a write reference.
|
|
100761
100834
|
*/
|
|
100762
100835
|
function isWriteReference(reference) {
|
|
@@ -100793,7 +100866,7 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
100793
100866
|
/**
|
|
100794
100867
|
* Checks whether or not a given reference is inside of a given node.
|
|
100795
100868
|
* @param {ASTNode} node A node to check.
|
|
100796
|
-
* @param {
|
|
100869
|
+
* @param {Reference} reference A reference to check.
|
|
100797
100870
|
* @returns {boolean} `true` if the reference is inside of the node.
|
|
100798
100871
|
*/
|
|
100799
100872
|
function isInRange(node, reference) {
|
|
@@ -100806,7 +100879,7 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
100806
100879
|
/**
|
|
100807
100880
|
* Checks whether or not a given reference is inside of a loop node's condition.
|
|
100808
100881
|
* @param {ASTNode} node A node to check.
|
|
100809
|
-
* @param {
|
|
100882
|
+
* @param {Reference} reference A reference to check.
|
|
100810
100883
|
* @returns {boolean} `true` if the reference is inside of the loop node's
|
|
100811
100884
|
* condition.
|
|
100812
100885
|
*/
|
|
@@ -100824,7 +100897,7 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
100824
100897
|
/**
|
|
100825
100898
|
* Gets the function which encloses a given reference.
|
|
100826
100899
|
* This supports only FunctionDeclaration.
|
|
100827
|
-
* @param {
|
|
100900
|
+
* @param {Reference} reference A reference to get.
|
|
100828
100901
|
* @returns {ASTNode|null} The function node or null.
|
|
100829
100902
|
*/
|
|
100830
100903
|
function getEncloseFunctionDeclaration(reference) {
|
|
@@ -100844,7 +100917,7 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
100844
100917
|
/**
|
|
100845
100918
|
* Updates the "modified" flags of given loop conditions with given modifiers.
|
|
100846
100919
|
* @param {LoopConditionInfo[]} conditions The loop conditions to be updated.
|
|
100847
|
-
* @param {
|
|
100920
|
+
* @param {Reference[]} modifiers The references to update.
|
|
100848
100921
|
* @returns {void}
|
|
100849
100922
|
*/
|
|
100850
100923
|
function updateModifiedFlag(conditions, modifiers) {
|
|
@@ -100978,7 +101051,7 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
100978
101051
|
|
|
100979
101052
|
/**
|
|
100980
101053
|
* Creates the loop condition information from a given reference.
|
|
100981
|
-
* @param {
|
|
101054
|
+
* @param {Reference} reference A reference to create.
|
|
100982
101055
|
* @returns {LoopConditionInfo|null} Created loop condition info, or null.
|
|
100983
101056
|
*/
|
|
100984
101057
|
function toLoopCondition(reference) {
|
|
@@ -101029,7 +101102,7 @@ function requireNoUnmodifiedLoopCondition () {
|
|
|
101029
101102
|
/**
|
|
101030
101103
|
* Finds unmodified references which are inside of a loop condition.
|
|
101031
101104
|
* Then reports the references which are outside of groups.
|
|
101032
|
-
* @param {
|
|
101105
|
+
* @param {Variable} variable A variable to report.
|
|
101033
101106
|
* @returns {void}
|
|
101034
101107
|
*/
|
|
101035
101108
|
function checkReferences(variable) {
|
|
@@ -102989,6 +103062,13 @@ function requireNoUnusedVars () {
|
|
|
102989
103062
|
|
|
102990
103063
|
const astUtils = requireAstUtils();
|
|
102991
103064
|
|
|
103065
|
+
//------------------------------------------------------------------------------
|
|
103066
|
+
// Types
|
|
103067
|
+
//------------------------------------------------------------------------------
|
|
103068
|
+
|
|
103069
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
103070
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
103071
|
+
|
|
102992
103072
|
//------------------------------------------------------------------------------
|
|
102993
103073
|
// Typedefs
|
|
102994
103074
|
//------------------------------------------------------------------------------
|
|
@@ -103502,7 +103582,7 @@ function requireNoUnusedVars () {
|
|
|
103502
103582
|
* - The reference is inside of a loop.
|
|
103503
103583
|
* - The reference is inside of a function scope which is different from
|
|
103504
103584
|
* the declaration.
|
|
103505
|
-
* @param {
|
|
103585
|
+
* @param {Reference} ref A reference to check.
|
|
103506
103586
|
* @param {ASTNode} prevRhsNode The previous RHS node.
|
|
103507
103587
|
* @returns {ASTNode|null} The RHS node or null.
|
|
103508
103588
|
* @private
|
|
@@ -103609,7 +103689,7 @@ function requireNoUnusedVars () {
|
|
|
103609
103689
|
|
|
103610
103690
|
/**
|
|
103611
103691
|
* Checks whether a given reference is a read to update itself or not.
|
|
103612
|
-
* @param {
|
|
103692
|
+
* @param {Reference} ref A reference to check.
|
|
103613
103693
|
* @param {ASTNode} rhsNode The RHS node of the previous assignment.
|
|
103614
103694
|
* @returns {boolean} The reference is a read to update itself.
|
|
103615
103695
|
* @private
|
|
@@ -103710,7 +103790,7 @@ function requireNoUnusedVars () {
|
|
|
103710
103790
|
|
|
103711
103791
|
/**
|
|
103712
103792
|
* Checks whether the given variable is after the last used parameter.
|
|
103713
|
-
* @param {
|
|
103793
|
+
* @param {Variable} variable The variable to check.
|
|
103714
103794
|
* @returns {boolean} `true` if the variable is defined after the last
|
|
103715
103795
|
* used parameter.
|
|
103716
103796
|
*/
|
|
@@ -104730,6 +104810,13 @@ function requireNoUseBeforeDefine () {
|
|
|
104730
104810
|
if (hasRequiredNoUseBeforeDefine) return noUseBeforeDefine;
|
|
104731
104811
|
hasRequiredNoUseBeforeDefine = 1;
|
|
104732
104812
|
|
|
104813
|
+
//------------------------------------------------------------------------------
|
|
104814
|
+
// Types
|
|
104815
|
+
//------------------------------------------------------------------------------
|
|
104816
|
+
|
|
104817
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
104818
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
104819
|
+
|
|
104733
104820
|
//------------------------------------------------------------------------------
|
|
104734
104821
|
// Helpers
|
|
104735
104822
|
//------------------------------------------------------------------------------
|
|
@@ -104793,7 +104880,7 @@ function requireNoUseBeforeDefine () {
|
|
|
104793
104880
|
/**
|
|
104794
104881
|
* Checks whether a given scope is the scope of a class static initializer.
|
|
104795
104882
|
* Static initializers are static blocks and initializers of static fields.
|
|
104796
|
-
* @param {
|
|
104883
|
+
* @param {Scope} scope A scope to check.
|
|
104797
104884
|
* @returns {boolean} `true` if the scope is a class static initializer scope.
|
|
104798
104885
|
*/
|
|
104799
104886
|
function isClassStaticInitializerScope(scope) {
|
|
@@ -104844,7 +104931,7 @@ function requireNoUseBeforeDefine () {
|
|
|
104844
104931
|
* x; // returns `false`
|
|
104845
104932
|
* }
|
|
104846
104933
|
* }
|
|
104847
|
-
* @param {
|
|
104934
|
+
* @param {Reference} reference A reference to check.
|
|
104848
104935
|
* @returns {boolean} `true` if the reference is from a separate execution context.
|
|
104849
104936
|
*/
|
|
104850
104937
|
function isFromSeparateExecutionContext(reference) {
|
|
@@ -105058,7 +105145,7 @@ function requireNoUseBeforeDefine () {
|
|
|
105058
105145
|
* - referring to a variable that is defined, but not in the given source code
|
|
105059
105146
|
* (e.g., global environment variable or `arguments` in functions).
|
|
105060
105147
|
* - allowed by options.
|
|
105061
|
-
* @param {
|
|
105148
|
+
* @param {Reference} reference The reference
|
|
105062
105149
|
* @returns {boolean} `true` if the reference should be checked
|
|
105063
105150
|
*/
|
|
105064
105151
|
function shouldCheck(reference) {
|
|
@@ -105137,7 +105224,7 @@ function requireNoUseBeforeDefine () {
|
|
|
105137
105224
|
|
|
105138
105225
|
/**
|
|
105139
105226
|
* Finds and validates all references in a given scope and its child scopes.
|
|
105140
|
-
* @param {
|
|
105227
|
+
* @param {Scope} scope The scope object.
|
|
105141
105228
|
* @returns {void}
|
|
105142
105229
|
*/
|
|
105143
105230
|
function checkReferencesInScope(scope) {
|
|
@@ -107942,13 +108029,21 @@ function requireNoVar () {
|
|
|
107942
108029
|
|
|
107943
108030
|
const astUtils = requireAstUtils();
|
|
107944
108031
|
|
|
108032
|
+
//------------------------------------------------------------------------------
|
|
108033
|
+
// Types
|
|
108034
|
+
//------------------------------------------------------------------------------
|
|
108035
|
+
|
|
108036
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
108037
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
108038
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
108039
|
+
|
|
107945
108040
|
//------------------------------------------------------------------------------
|
|
107946
108041
|
// Helpers
|
|
107947
108042
|
//------------------------------------------------------------------------------
|
|
107948
108043
|
|
|
107949
108044
|
/**
|
|
107950
108045
|
* Check whether a given variable is a global variable or not.
|
|
107951
|
-
* @param {
|
|
108046
|
+
* @param {Variable} variable The variable to check.
|
|
107952
108047
|
* @returns {boolean} `true` if the variable is a global variable.
|
|
107953
108048
|
*/
|
|
107954
108049
|
function isGlobal(variable) {
|
|
@@ -107958,8 +108053,8 @@ function requireNoVar () {
|
|
|
107958
108053
|
/**
|
|
107959
108054
|
* Finds the nearest function scope or global scope walking up the scope
|
|
107960
108055
|
* hierarchy.
|
|
107961
|
-
* @param {
|
|
107962
|
-
* @returns {
|
|
108056
|
+
* @param {Scope} scope The scope to traverse.
|
|
108057
|
+
* @returns {Scope} a function scope or global scope containing the given
|
|
107963
108058
|
* scope.
|
|
107964
108059
|
*/
|
|
107965
108060
|
function getEnclosingFunctionScope(scope) {
|
|
@@ -107974,7 +108069,7 @@ function requireNoVar () {
|
|
|
107974
108069
|
/**
|
|
107975
108070
|
* Checks whether the given variable has any references from a more specific
|
|
107976
108071
|
* function expression (i.e. a closure).
|
|
107977
|
-
* @param {
|
|
108072
|
+
* @param {Variable} variable A variable to check.
|
|
107978
108073
|
* @returns {boolean} `true` if the variable is used from a closure.
|
|
107979
108074
|
*/
|
|
107980
108075
|
function isReferencedInClosure(variable) {
|
|
@@ -108038,7 +108133,7 @@ function requireNoVar () {
|
|
|
108038
108133
|
|
|
108039
108134
|
/**
|
|
108040
108135
|
* Checks whether a given variable is redeclared or not.
|
|
108041
|
-
* @param {
|
|
108136
|
+
* @param {Variable} variable A variable to check.
|
|
108042
108137
|
* @returns {boolean} `true` if the variable is redeclared.
|
|
108043
108138
|
*/
|
|
108044
108139
|
function isRedeclared(variable) {
|
|
@@ -108054,7 +108149,7 @@ function requireNoVar () {
|
|
|
108054
108149
|
function isUsedFromOutsideOf(scopeNode) {
|
|
108055
108150
|
/**
|
|
108056
108151
|
* Checks whether a given reference is inside of the specified scope or not.
|
|
108057
|
-
* @param {
|
|
108152
|
+
* @param {Reference} reference A reference to check.
|
|
108058
108153
|
* @returns {boolean} `true` if the reference is inside of the specified
|
|
108059
108154
|
* scope.
|
|
108060
108155
|
*/
|
|
@@ -108115,7 +108210,7 @@ function requireNoVar () {
|
|
|
108115
108210
|
/**
|
|
108116
108211
|
* Checks whether a given variable has name that is allowed for 'var' declarations,
|
|
108117
108212
|
* but disallowed for `let` declarations.
|
|
108118
|
-
* @param {
|
|
108213
|
+
* @param {Variable} variable The variable to check.
|
|
108119
108214
|
* @returns {boolean} `true` if the variable has a disallowed name.
|
|
108120
108215
|
*/
|
|
108121
108216
|
function hasNameDisallowedForLetDeclarations(variable) {
|
|
@@ -113018,13 +113113,20 @@ function requirePreferArrowCallback () {
|
|
|
113018
113113
|
|
|
113019
113114
|
const astUtils = requireAstUtils();
|
|
113020
113115
|
|
|
113116
|
+
//------------------------------------------------------------------------------
|
|
113117
|
+
// Types
|
|
113118
|
+
//------------------------------------------------------------------------------
|
|
113119
|
+
|
|
113120
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
113121
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
113122
|
+
|
|
113021
113123
|
//------------------------------------------------------------------------------
|
|
113022
113124
|
// Helpers
|
|
113023
113125
|
//------------------------------------------------------------------------------
|
|
113024
113126
|
|
|
113025
113127
|
/**
|
|
113026
113128
|
* Checks whether or not a given variable is a function name.
|
|
113027
|
-
* @param {
|
|
113129
|
+
* @param {Variable} variable A variable to check.
|
|
113028
113130
|
* @returns {boolean} `true` if the variable is a function name.
|
|
113029
113131
|
*/
|
|
113030
113132
|
function isFunctionName(variable) {
|
|
@@ -113044,8 +113146,8 @@ function requirePreferArrowCallback () {
|
|
|
113044
113146
|
|
|
113045
113147
|
/**
|
|
113046
113148
|
* Gets the variable object of `arguments` which is defined implicitly.
|
|
113047
|
-
* @param {
|
|
113048
|
-
* @returns {
|
|
113149
|
+
* @param {Scope} scope A scope to get.
|
|
113150
|
+
* @returns {Variable} The found variable object.
|
|
113049
113151
|
*/
|
|
113050
113152
|
function getVariableOfArguments(scope) {
|
|
113051
113153
|
const variables = scope.variables;
|
|
@@ -113468,6 +113570,14 @@ function requirePreferConst () {
|
|
|
113468
113570
|
const FixTracker = requireFixTracker();
|
|
113469
113571
|
const astUtils = requireAstUtils();
|
|
113470
113572
|
|
|
113573
|
+
//------------------------------------------------------------------------------
|
|
113574
|
+
// Types
|
|
113575
|
+
//------------------------------------------------------------------------------
|
|
113576
|
+
|
|
113577
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
113578
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
113579
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
113580
|
+
|
|
113471
113581
|
//------------------------------------------------------------------------------
|
|
113472
113582
|
// Helpers
|
|
113473
113583
|
//------------------------------------------------------------------------------
|
|
@@ -113512,7 +113622,7 @@ function requirePreferConst () {
|
|
|
113512
113622
|
* Checks if an property or element is from outer scope or function parameters
|
|
113513
113623
|
* in destructing pattern.
|
|
113514
113624
|
* @param {string} name A variable name to be checked.
|
|
113515
|
-
* @param {
|
|
113625
|
+
* @param {Scope} initScope A scope to start find.
|
|
113516
113626
|
* @returns {boolean} Indicates if the variable is from outer scope or function parameters.
|
|
113517
113627
|
*/
|
|
113518
113628
|
function isOuterVariableInDestructing(name, initScope) {
|
|
@@ -113538,7 +113648,7 @@ function requirePreferConst () {
|
|
|
113538
113648
|
* belongs to.
|
|
113539
113649
|
* This is used to detect a mix of reassigned and never reassigned in a
|
|
113540
113650
|
* destructuring.
|
|
113541
|
-
* @param {
|
|
113651
|
+
* @param {Reference} reference A reference to get.
|
|
113542
113652
|
* @returns {ASTNode|null} A VariableDeclarator/AssignmentExpression node or
|
|
113543
113653
|
* null.
|
|
113544
113654
|
*/
|
|
@@ -113624,7 +113734,7 @@ function requirePreferConst () {
|
|
|
113624
113734
|
* `/*exported foo` directive comment makes such variables. This rule does not
|
|
113625
113735
|
* warn such variables because this rule cannot distinguish whether the
|
|
113626
113736
|
* exported variables are reassigned or not.
|
|
113627
|
-
* @param {
|
|
113737
|
+
* @param {Variable} variable A variable to get.
|
|
113628
113738
|
* @param {boolean} ignoreReadBeforeAssign
|
|
113629
113739
|
* The value of `ignoreReadBeforeAssign` option.
|
|
113630
113740
|
* @returns {ASTNode|null}
|
|
@@ -113724,7 +113834,7 @@ function requirePreferConst () {
|
|
|
113724
113834
|
* reference of given variables belongs to.
|
|
113725
113835
|
* This is used to detect a mix of reassigned and never reassigned in a
|
|
113726
113836
|
* destructuring.
|
|
113727
|
-
* @param {
|
|
113837
|
+
* @param {Variable[]} variables Variables to group by destructuring.
|
|
113728
113838
|
* @param {boolean} ignoreReadBeforeAssign
|
|
113729
113839
|
* The value of `ignoreReadBeforeAssign` option.
|
|
113730
113840
|
* @returns {Map<ASTNode, ASTNode[]>} Grouped identifier nodes.
|
|
@@ -113845,7 +113955,7 @@ function requirePreferConst () {
|
|
|
113845
113955
|
* nullable. In simple declaration or assignment cases, the length of
|
|
113846
113956
|
* the array is 1. In destructuring cases, the length of the array can
|
|
113847
113957
|
* be 2 or more.
|
|
113848
|
-
* @param {(
|
|
113958
|
+
* @param {(Reference|null)[]} nodes
|
|
113849
113959
|
* References which are grouped by destructuring to report.
|
|
113850
113960
|
* @returns {void}
|
|
113851
113961
|
*/
|
|
@@ -116387,14 +116497,22 @@ function requirePreferRestParams () {
|
|
|
116387
116497
|
if (hasRequiredPreferRestParams) return preferRestParams;
|
|
116388
116498
|
hasRequiredPreferRestParams = 1;
|
|
116389
116499
|
|
|
116500
|
+
//------------------------------------------------------------------------------
|
|
116501
|
+
// Types
|
|
116502
|
+
//------------------------------------------------------------------------------
|
|
116503
|
+
|
|
116504
|
+
/** @typedef {import("eslint-scope").Scope} Scope */
|
|
116505
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
116506
|
+
/** @typedef {import("eslint-scope").Reference} Reference */
|
|
116507
|
+
|
|
116390
116508
|
//------------------------------------------------------------------------------
|
|
116391
116509
|
// Helpers
|
|
116392
116510
|
//------------------------------------------------------------------------------
|
|
116393
116511
|
|
|
116394
116512
|
/**
|
|
116395
116513
|
* Gets the variable object of `arguments` which is defined implicitly.
|
|
116396
|
-
* @param {
|
|
116397
|
-
* @returns {
|
|
116514
|
+
* @param {Scope} scope A scope to get.
|
|
116515
|
+
* @returns {Variable} The found variable object.
|
|
116398
116516
|
*/
|
|
116399
116517
|
function getVariableOfArguments(scope) {
|
|
116400
116518
|
const variables = scope.variables;
|
|
@@ -116422,7 +116540,7 @@ function requirePreferRestParams () {
|
|
|
116422
116540
|
* - arguments[i] .... true // computed member access
|
|
116423
116541
|
* - arguments[0] .... true // computed member access
|
|
116424
116542
|
* - arguments.length .... false // normal member access
|
|
116425
|
-
* @param {
|
|
116543
|
+
* @param {Reference} reference The reference to check.
|
|
116426
116544
|
* @returns {boolean} `true` if the reference is not normal member access.
|
|
116427
116545
|
*/
|
|
116428
116546
|
function isNotNormalMemberAccess(reference) {
|
|
@@ -116463,7 +116581,7 @@ function requirePreferRestParams () {
|
|
|
116463
116581
|
|
|
116464
116582
|
/**
|
|
116465
116583
|
* Reports a given reference.
|
|
116466
|
-
* @param {
|
|
116584
|
+
* @param {Reference} reference A reference to report.
|
|
116467
116585
|
* @returns {void}
|
|
116468
116586
|
*/
|
|
116469
116587
|
function report(reference) {
|
|
@@ -118343,6 +118461,12 @@ function requireRadix () {
|
|
|
118343
118461
|
|
|
118344
118462
|
const astUtils = requireAstUtils();
|
|
118345
118463
|
|
|
118464
|
+
//------------------------------------------------------------------------------
|
|
118465
|
+
// Types
|
|
118466
|
+
//------------------------------------------------------------------------------
|
|
118467
|
+
|
|
118468
|
+
/** @typedef {import("eslint-scope").Variable} Variable */
|
|
118469
|
+
|
|
118346
118470
|
//------------------------------------------------------------------------------
|
|
118347
118471
|
// Helpers
|
|
118348
118472
|
//------------------------------------------------------------------------------
|
|
@@ -118353,7 +118477,7 @@ function requireRadix () {
|
|
|
118353
118477
|
|
|
118354
118478
|
/**
|
|
118355
118479
|
* Checks whether a given variable is shadowed or not.
|
|
118356
|
-
* @param {
|
|
118480
|
+
* @param {Variable} variable A variable to check.
|
|
118357
118481
|
* @returns {boolean} `true` if the variable is shadowed.
|
|
118358
118482
|
*/
|
|
118359
118483
|
function isShadowed(variable) {
|