eslintrb 2.0.1 → 2.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.
- checksums.yaml +4 -4
- data/lib/eslintrb/version.rb +2 -2
- data/lib/js/eslint.js +1531 -437
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d399f3d117ed76f5036c69c23a6353403f8e0dd3
|
4
|
+
data.tar.gz: 1a969137a9574dc9777e0bd950d88e51ceb0c36d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 160d8e7ead8b3cedd4d82fa4514cbb6aafe97b9e373e4e0dc23ce6701628594f40ebbb0f3b03d73918c5886d254d08b068875e284644bb2a24a57aed3d949fe4
|
7
|
+
data.tar.gz: 5b6e22012811fab64ae79c142208681b2182dbba9fd15d46ada058026c7b058e3311cf316bcb67eaff772b614b9e903fc9e12bd3b797ca5557725219a2f97ac6
|
data/lib/eslintrb/version.rb
CHANGED
data/lib/js/eslint.js
CHANGED
@@ -1818,9 +1818,11 @@ pp.parseParenArrowList = function (startPos, startLoc, exprList) {
|
|
1818
1818
|
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList);
|
1819
1819
|
};
|
1820
1820
|
|
1821
|
-
// New's precedence is slightly tricky. It must allow its argument
|
1822
|
-
//
|
1823
|
-
//
|
1821
|
+
// New's precedence is slightly tricky. It must allow its argument to
|
1822
|
+
// be a `[]` or dot subscript expression, but not a call — at least,
|
1823
|
+
// not without wrapping it in parentheses. Thus, it uses the noCalls
|
1824
|
+
// argument to parseSubscripts to prevent it from consuming the
|
1825
|
+
// argument list.
|
1824
1826
|
|
1825
1827
|
var empty = [];
|
1826
1828
|
|
@@ -1924,6 +1926,7 @@ pp.parsePropertyValue = function (prop, isPattern, isGenerator, startPos, startL
|
|
1924
1926
|
var start = prop.value.start;
|
1925
1927
|
if (prop.kind === "get") this.raise(start, "getter should have no params");else this.raise(start, "setter should have exactly one param");
|
1926
1928
|
}
|
1929
|
+
if (prop.kind === "set" && prop.value.params[0].type === "RestElement") this.raise(prop.value.params[0].start, "Setter cannot use rest params");
|
1927
1930
|
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
|
1928
1931
|
prop.kind = "init";
|
1929
1932
|
if (isPattern) {
|
@@ -2290,7 +2293,7 @@ var _whitespace = _dereq_("./whitespace");
|
|
2290
2293
|
exports.isNewLine = _whitespace.isNewLine;
|
2291
2294
|
exports.lineBreak = _whitespace.lineBreak;
|
2292
2295
|
exports.lineBreakG = _whitespace.lineBreakG;
|
2293
|
-
var version = "2.
|
2296
|
+
var version = "2.7.0";
|
2294
2297
|
|
2295
2298
|
exports.version = version;
|
2296
2299
|
// The main exported interface (under `self.acorn` when in the
|
@@ -3518,6 +3521,7 @@ pp.parseClass = function (node, isStatement) {
|
|
3518
3521
|
var start = method.value.start;
|
3519
3522
|
if (method.kind === "get") this.raise(start, "getter should have no params");else this.raise(start, "setter should have exactly one param");
|
3520
3523
|
}
|
3524
|
+
if (method.kind === "set" && method.value.params[0].type === "RestElement") this.raise(method.value.params[0].start, "Setter cannot use rest params");
|
3521
3525
|
}
|
3522
3526
|
}
|
3523
3527
|
node.body = this.finishNode(classBody, "ClassBody");
|
@@ -3661,7 +3665,13 @@ pp.parseImportSpecifiers = function () {
|
|
3661
3665
|
|
3662
3666
|
var node = this.startNode();
|
3663
3667
|
node.imported = this.parseIdent(true);
|
3664
|
-
|
3668
|
+
if (this.eatContextual("as")) {
|
3669
|
+
node.local = this.parseIdent();
|
3670
|
+
} else {
|
3671
|
+
node.local = node.imported;
|
3672
|
+
if (this.isKeyword(node.local.name)) this.unexpected(node.local.start);
|
3673
|
+
if (this.reservedWordsStrict.test(node.local.name)) this.raise(node.local.start, "The keyword '" + node.local.name + "' is reserved");
|
3674
|
+
}
|
3665
3675
|
this.checkLVal(node.local, true);
|
3666
3676
|
nodes.push(this.finishNode(node, "ImportSpecifier"));
|
3667
3677
|
}
|
@@ -4232,8 +4242,8 @@ pp.readRegexp = function () {
|
|
4232
4242
|
var mods = this.readWord1();
|
4233
4243
|
var tmp = content;
|
4234
4244
|
if (mods) {
|
4235
|
-
var validFlags = /^[
|
4236
|
-
if (this.options.ecmaVersion >= 6) validFlags = /^[
|
4245
|
+
var validFlags = /^[gim]*$/;
|
4246
|
+
if (this.options.ecmaVersion >= 6) validFlags = /^[gimuy]*$/;
|
4237
4247
|
if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag");
|
4238
4248
|
if (mods.indexOf('u') >= 0 && !regexpUnicodeSupport) {
|
4239
4249
|
// Replace each astral symbol and every Unicode escape sequence that
|
@@ -4461,7 +4471,7 @@ pp.readEscapedChar = function (inTemplate) {
|
|
4461
4471
|
octalStr = octalStr.slice(0, -1);
|
4462
4472
|
octal = parseInt(octalStr, 8);
|
4463
4473
|
}
|
4464
|
-
if (
|
4474
|
+
if (octalStr !== "0" && (this.strict || inTemplate)) {
|
4465
4475
|
this.raise(this.pos - 2, "Octal literal in strict mode");
|
4466
4476
|
}
|
4467
4477
|
this.pos += octalStr.length - 1;
|
@@ -4761,7 +4771,7 @@ module.exports={
|
|
4761
4771
|
},
|
4762
4772
|
"repository": {
|
4763
4773
|
"type": "git",
|
4764
|
-
"url": "
|
4774
|
+
"url": "git+ssh://git@github.com/eslint/espree.git"
|
4765
4775
|
},
|
4766
4776
|
"bugs": {
|
4767
4777
|
"url": "http://github.com/eslint/espree.git"
|
@@ -4780,7 +4790,7 @@ module.exports={
|
|
4780
4790
|
"dateformat": "^1.0.11",
|
4781
4791
|
"eslint": "^1.10.3",
|
4782
4792
|
"eslint-config-eslint": "^1.0.1",
|
4783
|
-
"esprima": "git://github.com/jquery/esprima",
|
4793
|
+
"esprima": "git://github.com/jquery/esprima.git",
|
4784
4794
|
"esprima-fb": "^8001.2001.0-dev-harmony-fb",
|
4785
4795
|
"istanbul": "~0.2.6",
|
4786
4796
|
"json-diff": "~0.3.1",
|
@@ -4834,7 +4844,8 @@ module.exports={
|
|
4834
4844
|
"tarball": "http://registry.npmjs.org/espree/-/espree-3.0.0-alpha-3.tgz"
|
4835
4845
|
},
|
4836
4846
|
"directories": {},
|
4837
|
-
"_resolved": "https://registry.npmjs.org/espree/-/espree-3.0.0-alpha-3.tgz"
|
4847
|
+
"_resolved": "https://registry.npmjs.org/espree/-/espree-3.0.0-alpha-3.tgz",
|
4848
|
+
"readme": "ERROR: No README data found!"
|
4838
4849
|
}
|
4839
4850
|
|
4840
4851
|
},{}],"espree":[function(require,module,exports){
|
@@ -5698,6 +5709,9 @@ module.exports = {
|
|
5698
5709
|
serviceworker: {
|
5699
5710
|
globals: globals.serviceworker
|
5700
5711
|
},
|
5712
|
+
atomtest: {
|
5713
|
+
globals: globals.atomtest
|
5714
|
+
},
|
5701
5715
|
embertest: {
|
5702
5716
|
globals: globals.embertest
|
5703
5717
|
},
|
@@ -5762,7 +5776,7 @@ module.exports={
|
|
5762
5776
|
"no-implicit-globals": 0,
|
5763
5777
|
"no-implied-eval": 0,
|
5764
5778
|
"no-inline-comments": 0,
|
5765
|
-
"no-inner-declarations":
|
5779
|
+
"no-inner-declarations": 2,
|
5766
5780
|
"no-invalid-regexp": 2,
|
5767
5781
|
"no-invalid-this": 0,
|
5768
5782
|
"no-irregular-whitespace": 2,
|
@@ -5772,12 +5786,12 @@ module.exports={
|
|
5772
5786
|
"no-lone-blocks": 0,
|
5773
5787
|
"no-lonely-if": 0,
|
5774
5788
|
"no-loop-func": 0,
|
5775
|
-
"no-mixed-requires":
|
5776
|
-
"no-mixed-spaces-and-tabs":
|
5777
|
-
"linebreak-style":
|
5789
|
+
"no-mixed-requires": 0,
|
5790
|
+
"no-mixed-spaces-and-tabs": 2,
|
5791
|
+
"linebreak-style": 0,
|
5778
5792
|
"no-multi-spaces": 0,
|
5779
5793
|
"no-multi-str": 0,
|
5780
|
-
"no-multiple-empty-lines":
|
5794
|
+
"no-multiple-empty-lines": 0,
|
5781
5795
|
"no-native-reassign": 0,
|
5782
5796
|
"no-negated-condition": 0,
|
5783
5797
|
"no-negated-in-lhs": 2,
|
@@ -5786,6 +5800,7 @@ module.exports={
|
|
5786
5800
|
"no-new-func": 0,
|
5787
5801
|
"no-new-object": 0,
|
5788
5802
|
"no-new-require": 0,
|
5803
|
+
"no-new-symbol": 0,
|
5789
5804
|
"no-new-wrappers": 0,
|
5790
5805
|
"no-obj-calls": 2,
|
5791
5806
|
"no-octal": 2,
|
@@ -5807,6 +5822,7 @@ module.exports={
|
|
5807
5822
|
"no-sequences": 0,
|
5808
5823
|
"no-shadow": 0,
|
5809
5824
|
"no-shadow-restricted-names": 0,
|
5825
|
+
"no-whitespace-before-property": 0,
|
5810
5826
|
"no-spaced-func": 0,
|
5811
5827
|
"no-sparse-arrays": 2,
|
5812
5828
|
"no-sync": 0,
|
@@ -5823,43 +5839,44 @@ module.exports={
|
|
5823
5839
|
"no-unneeded-ternary": 0,
|
5824
5840
|
"no-unreachable": 2,
|
5825
5841
|
"no-unused-expressions": 0,
|
5826
|
-
"no-unused-vars":
|
5842
|
+
"no-unused-vars": 2,
|
5827
5843
|
"no-use-before-define": 0,
|
5828
5844
|
"no-useless-call": 0,
|
5829
5845
|
"no-useless-concat": 0,
|
5846
|
+
"no-useless-constructor": 0,
|
5830
5847
|
"no-void": 0,
|
5831
5848
|
"no-var": 0,
|
5832
|
-
"no-warning-comments":
|
5849
|
+
"no-warning-comments": 0,
|
5833
5850
|
"no-with": 0,
|
5834
5851
|
"no-magic-numbers": 0,
|
5835
5852
|
|
5836
|
-
"array-bracket-spacing":
|
5853
|
+
"array-bracket-spacing": 0,
|
5837
5854
|
"array-callback-return": 0,
|
5838
|
-
"arrow-body-style":
|
5855
|
+
"arrow-body-style": 0,
|
5839
5856
|
"arrow-parens": 0,
|
5840
5857
|
"arrow-spacing": 0,
|
5841
5858
|
"accessor-pairs": 0,
|
5842
5859
|
"block-scoped-var": 0,
|
5843
5860
|
"block-spacing": 0,
|
5844
|
-
"brace-style":
|
5861
|
+
"brace-style": 0,
|
5845
5862
|
"callback-return": 0,
|
5846
5863
|
"camelcase": 0,
|
5847
|
-
"comma-dangle":
|
5864
|
+
"comma-dangle": 2,
|
5848
5865
|
"comma-spacing": 0,
|
5849
5866
|
"comma-style": 0,
|
5850
5867
|
"complexity": [0, 11],
|
5851
|
-
"computed-property-spacing":
|
5868
|
+
"computed-property-spacing": 0,
|
5852
5869
|
"consistent-return": 0,
|
5853
|
-
"consistent-this":
|
5870
|
+
"consistent-this": 0,
|
5854
5871
|
"constructor-super": 0,
|
5855
|
-
"curly":
|
5872
|
+
"curly": 0,
|
5856
5873
|
"default-case": 0,
|
5857
5874
|
"dot-location": 0,
|
5858
|
-
"dot-notation":
|
5875
|
+
"dot-notation": 0,
|
5859
5876
|
"eol-last": 0,
|
5860
5877
|
"eqeqeq": 0,
|
5861
5878
|
"func-names": 0,
|
5862
|
-
"func-style":
|
5879
|
+
"func-style": 0,
|
5863
5880
|
"generator-star-spacing": 0,
|
5864
5881
|
"global-require": 0,
|
5865
5882
|
"guard-for-in": 0,
|
@@ -5867,21 +5884,22 @@ module.exports={
|
|
5867
5884
|
"id-length": 0,
|
5868
5885
|
"indent": 0,
|
5869
5886
|
"init-declarations": 0,
|
5870
|
-
"jsx-quotes":
|
5871
|
-
"key-spacing":
|
5887
|
+
"jsx-quotes": 0,
|
5888
|
+
"key-spacing": 0,
|
5889
|
+
"keyword-spacing": 0,
|
5872
5890
|
"lines-around-comment": 0,
|
5873
|
-
"max-depth":
|
5874
|
-
"max-len":
|
5875
|
-
"max-nested-callbacks":
|
5876
|
-
"max-params":
|
5877
|
-
"max-statements":
|
5891
|
+
"max-depth": 0,
|
5892
|
+
"max-len": 0,
|
5893
|
+
"max-nested-callbacks": 0,
|
5894
|
+
"max-params": 0,
|
5895
|
+
"max-statements": 0,
|
5878
5896
|
"new-cap": 0,
|
5879
5897
|
"new-parens": 0,
|
5880
5898
|
"newline-after-var": 0,
|
5881
|
-
"object-curly-spacing":
|
5899
|
+
"object-curly-spacing": 0,
|
5882
5900
|
"object-shorthand": 0,
|
5883
|
-
"one-var":
|
5884
|
-
"operator-assignment":
|
5901
|
+
"one-var": 0,
|
5902
|
+
"operator-assignment": 0,
|
5885
5903
|
"operator-linebreak": 0,
|
5886
5904
|
"padded-blocks": 0,
|
5887
5905
|
"prefer-arrow-callback": 0,
|
@@ -5891,22 +5909,23 @@ module.exports={
|
|
5891
5909
|
"prefer-spread": 0,
|
5892
5910
|
"prefer-template": 0,
|
5893
5911
|
"quote-props": 0,
|
5894
|
-
"quotes":
|
5912
|
+
"quotes": 0,
|
5895
5913
|
"radix": 0,
|
5896
5914
|
"id-match": 0,
|
5897
5915
|
"require-jsdoc": 0,
|
5898
5916
|
"require-yield": 0,
|
5899
5917
|
"semi": 0,
|
5900
|
-
"semi-spacing":
|
5918
|
+
"semi-spacing": 0,
|
5901
5919
|
"sort-vars": 0,
|
5902
|
-
"
|
5903
|
-
"space-
|
5904
|
-
"space-before-
|
5905
|
-
"space-before-
|
5906
|
-
"space-
|
5920
|
+
"sort-imports": 0,
|
5921
|
+
"space-after-keywords": 0,
|
5922
|
+
"space-before-keywords": 0,
|
5923
|
+
"space-before-blocks": 0,
|
5924
|
+
"space-before-function-paren": 0,
|
5925
|
+
"space-in-parens": 0,
|
5907
5926
|
"space-infix-ops": 0,
|
5908
5927
|
"space-return-throw-case": 0,
|
5909
|
-
"space-unary-ops":
|
5928
|
+
"space-unary-ops": 0,
|
5910
5929
|
"spaced-comment": 0,
|
5911
5930
|
"strict": 0,
|
5912
5931
|
"use-isnan": 2,
|
@@ -5916,7 +5935,7 @@ module.exports={
|
|
5916
5935
|
"wrap-iife": 0,
|
5917
5936
|
"wrap-regex": 0,
|
5918
5937
|
"yield-star-spacing": 0,
|
5919
|
-
"yoda":
|
5938
|
+
"yoda": 0
|
5920
5939
|
}
|
5921
5940
|
}
|
5922
5941
|
|
@@ -5933,8 +5952,11 @@ module.exports={
|
|
5933
5952
|
"no-space-before-semi": ["semi-spacing"],
|
5934
5953
|
"no-wrap-func": ["no-extra-parens"],
|
5935
5954
|
"space-after-function-name": ["space-before-function-paren"],
|
5955
|
+
"space-after-keywords": ["keyword-spacing"],
|
5936
5956
|
"space-before-function-parentheses": ["space-before-function-paren"],
|
5957
|
+
"space-before-keywords": ["keyword-spacing"],
|
5937
5958
|
"space-in-brackets": ["object-curly-spacing", "array-bracket-spacing", "computed-property-spacing"],
|
5959
|
+
"space-return-throw-case": ["keyword-spacing"],
|
5938
5960
|
"space-unary-word-ops": ["space-unary-ops"],
|
5939
5961
|
"spaced-line-comment": ["spaced-comment"]
|
5940
5962
|
}
|
@@ -8344,6 +8366,22 @@ function plural(ms, n, name) {
|
|
8344
8366
|
return true;
|
8345
8367
|
};
|
8346
8368
|
|
8369
|
+
TagParser.prototype.parseCaption = function parseDescription() {
|
8370
|
+
var description = trim(sliceSource(source, index, this._last));
|
8371
|
+
var captionStartTag = '<caption>';
|
8372
|
+
var captionEndTag = '</caption>';
|
8373
|
+
var captionStart = description.indexOf(captionStartTag);
|
8374
|
+
var captionEnd = description.indexOf(captionEndTag);
|
8375
|
+
if (captionStart >= 0 && captionEnd >= 0) {
|
8376
|
+
this._tag.caption = trim(description.substring(
|
8377
|
+
captionStart + captionStartTag.length, captionEnd));
|
8378
|
+
this._tag.description = trim(description.substring(captionEnd + captionEndTag.length));
|
8379
|
+
} else {
|
8380
|
+
this._tag.description = description;
|
8381
|
+
}
|
8382
|
+
return true;
|
8383
|
+
};
|
8384
|
+
|
8347
8385
|
TagParser.prototype.parseKind = function parseKind() {
|
8348
8386
|
var kind, kinds;
|
8349
8387
|
kinds = {
|
@@ -8381,6 +8419,23 @@ function plural(ms, n, name) {
|
|
8381
8419
|
return true;
|
8382
8420
|
};
|
8383
8421
|
|
8422
|
+
TagParser.prototype.parseThis = function parseAccess() {
|
8423
|
+
// this name may be a name expression (e.g. {foo.bar})
|
8424
|
+
// or a name path (e.g. foo.bar)
|
8425
|
+
var value = trim(sliceSource(source, index, this._last));
|
8426
|
+
if (value && value.charAt(0) === '{') {
|
8427
|
+
var gotType = this.parseType();
|
8428
|
+
if (gotType && this._tag.type.type === 'NameExpression') {
|
8429
|
+
this._tag.name = this._tag.type.name;
|
8430
|
+
return true;
|
8431
|
+
} else {
|
8432
|
+
return this.addError('Invalid name for this');
|
8433
|
+
}
|
8434
|
+
} else {
|
8435
|
+
return this.parseNamePath();
|
8436
|
+
}
|
8437
|
+
};
|
8438
|
+
|
8384
8439
|
TagParser.prototype.parseVariation = function parseVariation() {
|
8385
8440
|
var variation, text;
|
8386
8441
|
text = trim(sliceSource(source, index, this._last));
|
@@ -8438,6 +8493,8 @@ function plural(ms, n, name) {
|
|
8438
8493
|
'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
8439
8494
|
// Synonym: http://usejsdoc.org/tags-extends.html
|
8440
8495
|
'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
8496
|
+
// http://usejsdoc.org/tags-example.html
|
8497
|
+
'example': ['parseCaption'],
|
8441
8498
|
// http://usejsdoc.org/tags-deprecated.html
|
8442
8499
|
'deprecated': ['parseDescription'],
|
8443
8500
|
// http://usejsdoc.org/tags-global.html
|
@@ -8485,7 +8542,7 @@ function plural(ms, n, name) {
|
|
8485
8542
|
// http://usejsdoc.org/tags-summary.html
|
8486
8543
|
'summary': ['parseDescription'],
|
8487
8544
|
// http://usejsdoc.org/tags-this.html
|
8488
|
-
'this': ['
|
8545
|
+
'this': ['parseThis', 'ensureEnd'],
|
8489
8546
|
// http://usejsdoc.org/tags-todo.html
|
8490
8547
|
'todo': ['parseDescription'],
|
8491
8548
|
// http://usejsdoc.org/tags-typedef.html
|
@@ -9650,7 +9707,7 @@ function plural(ms, n, name) {
|
|
9650
9707
|
return expr;
|
9651
9708
|
}
|
9652
9709
|
|
9653
|
-
elements = [
|
9710
|
+
elements = [expr];
|
9654
9711
|
consume(Token.PIPE);
|
9655
9712
|
while (true) {
|
9656
9713
|
elements.push(parseTypeExpression());
|
@@ -10400,7 +10457,7 @@ module.exports={
|
|
10400
10457
|
"description": "JSDoc parser",
|
10401
10458
|
"homepage": "https://github.com/eslint/doctrine",
|
10402
10459
|
"main": "lib/doctrine.js",
|
10403
|
-
"version": "
|
10460
|
+
"version": "1.1.0",
|
10404
10461
|
"engines": {
|
10405
10462
|
"node": ">=0.10.0"
|
10406
10463
|
},
|
@@ -10431,17 +10488,8 @@ module.exports={
|
|
10431
10488
|
"devDependencies": {
|
10432
10489
|
"coveralls": "^2.11.2",
|
10433
10490
|
"dateformat": "^1.0.11",
|
10434
|
-
"eslint": "^1.
|
10435
|
-
"
|
10436
|
-
"gulp-bump": "^0.1.13",
|
10437
|
-
"gulp-eslint": "^0.5.0",
|
10438
|
-
"gulp-filter": "^2.0.2",
|
10439
|
-
"gulp-git": "^1.0.0",
|
10440
|
-
"gulp-istanbul": "^0.6.0",
|
10441
|
-
"gulp-jshint": "^1.9.0",
|
10442
|
-
"gulp-mocha": "^2.0.0",
|
10443
|
-
"gulp-tag-version": "^1.2.1",
|
10444
|
-
"jshint-stylish": "^1.0.0",
|
10491
|
+
"eslint": "^1.10.3",
|
10492
|
+
"istanbul": "^0.4.1",
|
10445
10493
|
"linefix": "^0.1.1",
|
10446
10494
|
"mocha": "^2.3.3",
|
10447
10495
|
"npm-license": "^0.3.1",
|
@@ -10457,32 +10505,30 @@ module.exports={
|
|
10457
10505
|
}
|
10458
10506
|
],
|
10459
10507
|
"scripts": {
|
10460
|
-
"test": "
|
10461
|
-
"
|
10462
|
-
"lint": "gulp lint",
|
10463
|
-
"coveralls": "cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"
|
10508
|
+
"test": "node Makefile.js test",
|
10509
|
+
"lint": "node Makefile.js lint"
|
10464
10510
|
},
|
10465
10511
|
"dependencies": {
|
10466
10512
|
"esutils": "^1.1.6",
|
10467
10513
|
"isarray": "0.0.1"
|
10468
10514
|
},
|
10469
|
-
"gitHead": "
|
10515
|
+
"gitHead": "165fc189b184b0daa72a2ee2f696e8cf7312d288",
|
10470
10516
|
"bugs": {
|
10471
10517
|
"url": "https://github.com/eslint/doctrine/issues"
|
10472
10518
|
},
|
10473
|
-
"_id": "doctrine@
|
10474
|
-
"_shasum": "
|
10475
|
-
"_from": "doctrine@>=
|
10476
|
-
"_npmVersion": "1.4.
|
10519
|
+
"_id": "doctrine@1.1.0",
|
10520
|
+
"_shasum": "1c36612937cf7d1596b983e9c5d0c6233eeaa3cf",
|
10521
|
+
"_from": "doctrine@>=1.1.0 <2.0.0",
|
10522
|
+
"_npmVersion": "1.4.29",
|
10477
10523
|
"_npmUser": {
|
10478
10524
|
"name": "nzakas",
|
10479
10525
|
"email": "nicholas@nczconsulting.com"
|
10480
10526
|
},
|
10481
10527
|
"dist": {
|
10482
|
-
"shasum": "
|
10483
|
-
"tarball": "http://registry.npmjs.org/doctrine/-/doctrine-
|
10528
|
+
"shasum": "1c36612937cf7d1596b983e9c5d0c6233eeaa3cf",
|
10529
|
+
"tarball": "http://registry.npmjs.org/doctrine/-/doctrine-1.1.0.tgz"
|
10484
10530
|
},
|
10485
|
-
"_resolved": "https://registry.npmjs.org/doctrine/-/doctrine-
|
10531
|
+
"_resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.1.0.tgz"
|
10486
10532
|
}
|
10487
10533
|
|
10488
10534
|
},{}],23:[function(require,module,exports){
|
@@ -11803,7 +11849,7 @@ module.exports = function (str) {
|
|
11803
11849
|
throw new TypeError('Expected a string');
|
11804
11850
|
}
|
11805
11851
|
|
11806
|
-
return str.replace(matchOperatorsRe,
|
11852
|
+
return str.replace(matchOperatorsRe, '\\$&');
|
11807
11853
|
};
|
11808
11854
|
|
11809
11855
|
},{}],77:[function(require,module,exports){
|
@@ -15376,7 +15422,7 @@ module.exports={
|
|
15376
15422
|
],
|
15377
15423
|
"repository": {
|
15378
15424
|
"type": "git",
|
15379
|
-
"url": "
|
15425
|
+
"url": "git+ssh://git@github.com/estools/estraverse.git"
|
15380
15426
|
},
|
15381
15427
|
"devDependencies": {
|
15382
15428
|
"chai": "^2.1.1",
|
@@ -15418,7 +15464,8 @@ module.exports={
|
|
15418
15464
|
"tarball": "http://registry.npmjs.org/estraverse/-/estraverse-3.1.0.tgz"
|
15419
15465
|
},
|
15420
15466
|
"directories": {},
|
15421
|
-
"_resolved": "https://registry.npmjs.org/estraverse/-/estraverse-3.1.0.tgz"
|
15467
|
+
"_resolved": "https://registry.npmjs.org/estraverse/-/estraverse-3.1.0.tgz",
|
15468
|
+
"readme": "ERROR: No README data found!"
|
15422
15469
|
}
|
15423
15470
|
|
15424
15471
|
},{}],133:[function(require,module,exports){
|
@@ -15443,7 +15490,7 @@ module.exports={
|
|
15443
15490
|
],
|
15444
15491
|
"repository": {
|
15445
15492
|
"type": "git",
|
15446
|
-
"url": "
|
15493
|
+
"url": "git+ssh://git@github.com/estools/esrecurse.git"
|
15447
15494
|
},
|
15448
15495
|
"dependencies": {
|
15449
15496
|
"estraverse": "~3.1.0"
|
@@ -15490,7 +15537,8 @@ module.exports={
|
|
15490
15537
|
"tarball": "http://registry.npmjs.org/esrecurse/-/esrecurse-3.1.1.tgz"
|
15491
15538
|
},
|
15492
15539
|
"directories": {},
|
15493
|
-
"_resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-3.1.1.tgz"
|
15540
|
+
"_resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-3.1.1.tgz",
|
15541
|
+
"readme": "ERROR: No README data found!"
|
15494
15542
|
}
|
15495
15543
|
|
15496
15544
|
},{}],134:[function(require,module,exports){
|
@@ -15577,7 +15625,8 @@ module.exports={
|
|
15577
15625
|
"tarball": "http://registry.npmjs.org/escope/-/escope-3.3.0.tgz"
|
15578
15626
|
},
|
15579
15627
|
"directories": {},
|
15580
|
-
"_resolved": "https://registry.npmjs.org/escope/-/escope-3.3.0.tgz"
|
15628
|
+
"_resolved": "https://registry.npmjs.org/escope/-/escope-3.3.0.tgz",
|
15629
|
+
"readme": "ERROR: No README data found!"
|
15581
15630
|
}
|
15582
15631
|
|
15583
15632
|
},{}],135:[function(require,module,exports){
|
@@ -16547,7 +16596,8 @@ module.exports={
|
|
16547
16596
|
"tarball": "http://registry.npmjs.org/estraverse/-/estraverse-4.1.1.tgz"
|
16548
16597
|
},
|
16549
16598
|
"directories": {},
|
16550
|
-
"_resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.1.1.tgz"
|
16599
|
+
"_resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.1.1.tgz",
|
16600
|
+
"readme": "ERROR: No README data found!"
|
16551
16601
|
}
|
16552
16602
|
|
16553
16603
|
},{}],138:[function(require,module,exports){
|
@@ -17617,6 +17667,7 @@ module.exports={
|
|
17617
17667
|
"worker": {
|
17618
17668
|
"applicationCache": false,
|
17619
17669
|
"atob": false,
|
17670
|
+
"Blob": false,
|
17620
17671
|
"BroadcastChannel": false,
|
17621
17672
|
"btoa": false,
|
17622
17673
|
"Cache": false,
|
@@ -17704,7 +17755,8 @@ module.exports={
|
|
17704
17755
|
"commonjs": {
|
17705
17756
|
"exports": true,
|
17706
17757
|
"module": false,
|
17707
|
-
"require": false
|
17758
|
+
"require": false,
|
17759
|
+
"global": false
|
17708
17760
|
},
|
17709
17761
|
"amd": {
|
17710
17762
|
"define": false,
|
@@ -18040,6 +18092,15 @@ module.exports={
|
|
18040
18092
|
"skipWaiting": false,
|
18041
18093
|
"WindowClient": false
|
18042
18094
|
},
|
18095
|
+
"atomtest": {
|
18096
|
+
"advanceClock": false,
|
18097
|
+
"fakeClearInterval": false,
|
18098
|
+
"fakeClearTimeout": false,
|
18099
|
+
"fakeSetInterval": false,
|
18100
|
+
"fakeSetTimeout": false,
|
18101
|
+
"resetTimeouts": false,
|
18102
|
+
"waitsForPromise": false
|
18103
|
+
},
|
18043
18104
|
"embertest": {
|
18044
18105
|
"andThen": false,
|
18045
18106
|
"click": false,
|
@@ -21459,7 +21520,7 @@ CodePathState.prototype = {
|
|
21459
21520
|
|
21460
21521
|
module.exports = CodePathState;
|
21461
21522
|
|
21462
|
-
},{"../util":
|
21523
|
+
},{"../util":369,"./code-path-segment":154,"./fork-context":158}],156:[function(require,module,exports){
|
21463
21524
|
/**
|
21464
21525
|
* @fileoverview A class of the code path.
|
21465
21526
|
* @author Toru Nagashima
|
@@ -22272,6 +22333,7 @@ module.exports = {
|
|
22272
22333
|
* @fileoverview Validates configs.
|
22273
22334
|
* @author Brandon Mills
|
22274
22335
|
* @copyright 2015 Brandon Mills
|
22336
|
+
* See LICENSE file in root directory for full license.
|
22275
22337
|
*/
|
22276
22338
|
|
22277
22339
|
"use strict";
|
@@ -22311,7 +22373,11 @@ function getRuleOptionsSchema(id) {
|
|
22311
22373
|
"maxItems": schema.length
|
22312
22374
|
};
|
22313
22375
|
} else {
|
22314
|
-
return
|
22376
|
+
return {
|
22377
|
+
"type": "array",
|
22378
|
+
"minItems": 0,
|
22379
|
+
"maxItems": 0
|
22380
|
+
};
|
22315
22381
|
}
|
22316
22382
|
}
|
22317
22383
|
|
@@ -22832,7 +22898,7 @@ function prepareConfig(config) {
|
|
22832
22898
|
if (typeof config.env === "object") {
|
22833
22899
|
Object.keys(config.env).forEach(function(env) {
|
22834
22900
|
if (config.env[env] && environments[env] && environments[env].parserOptions) {
|
22835
|
-
|
22901
|
+
parserOptions = ConfigOps.merge(parserOptions, environments[env].parserOptions);
|
22836
22902
|
}
|
22837
22903
|
});
|
22838
22904
|
}
|
@@ -23516,7 +23582,7 @@ module.exports = (function() {
|
|
23516
23582
|
|
23517
23583
|
}());
|
23518
23584
|
|
23519
|
-
},{"../conf/blank-script.json":1,"../conf/environments":2,"../conf/eslint.json":3,"../conf/replacements.json":4,"./code-path-analysis/code-path-analyzer":153,"./config/config-ops":160,"./config/config-validator":161,"./rule-context":164,"./rules":165,"./timing":
|
23585
|
+
},{"../conf/blank-script.json":1,"../conf/environments":2,"../conf/eslint.json":3,"../conf/replacements.json":4,"./code-path-analysis/code-path-analyzer":153,"./config/config-ops":160,"./config/config-validator":161,"./rule-context":164,"./rules":165,"./timing":367,"./util/comment-event-generator":370,"./util/estraverse":371,"./util/node-event-generator":373,"./util/source-code":375,"assert":5,"escope":78,"events":6,"object-assign":151}],163:[function(require,module,exports){
|
23520
23586
|
module.exports = function() {
|
23521
23587
|
var rules = Object.create(null);
|
23522
23588
|
rules["accessor-pairs"] = require("./rules/accessor-pairs");
|
@@ -23556,6 +23622,7 @@ module.exports = function() {
|
|
23556
23622
|
rules["init-declarations"] = require("./rules/init-declarations");
|
23557
23623
|
rules["jsx-quotes"] = require("./rules/jsx-quotes");
|
23558
23624
|
rules["key-spacing"] = require("./rules/key-spacing");
|
23625
|
+
rules["keyword-spacing"] = require("./rules/keyword-spacing");
|
23559
23626
|
rules["linebreak-style"] = require("./rules/linebreak-style");
|
23560
23627
|
rules["lines-around-comment"] = require("./rules/lines-around-comment");
|
23561
23628
|
rules["max-depth"] = require("./rules/max-depth");
|
@@ -23631,6 +23698,7 @@ module.exports = function() {
|
|
23631
23698
|
rules["no-new-func"] = require("./rules/no-new-func");
|
23632
23699
|
rules["no-new-object"] = require("./rules/no-new-object");
|
23633
23700
|
rules["no-new-require"] = require("./rules/no-new-require");
|
23701
|
+
rules["no-new-symbol"] = require("./rules/no-new-symbol");
|
23634
23702
|
rules["no-new-wrappers"] = require("./rules/no-new-wrappers");
|
23635
23703
|
rules["no-new"] = require("./rules/no-new");
|
23636
23704
|
rules["no-obj-calls"] = require("./rules/no-obj-calls");
|
@@ -23673,9 +23741,11 @@ module.exports = function() {
|
|
23673
23741
|
rules["no-use-before-define"] = require("./rules/no-use-before-define");
|
23674
23742
|
rules["no-useless-call"] = require("./rules/no-useless-call");
|
23675
23743
|
rules["no-useless-concat"] = require("./rules/no-useless-concat");
|
23744
|
+
rules["no-useless-constructor"] = require("./rules/no-useless-constructor");
|
23676
23745
|
rules["no-var"] = require("./rules/no-var");
|
23677
23746
|
rules["no-void"] = require("./rules/no-void");
|
23678
23747
|
rules["no-warning-comments"] = require("./rules/no-warning-comments");
|
23748
|
+
rules["no-whitespace-before-property"] = require("./rules/no-whitespace-before-property");
|
23679
23749
|
rules["no-with"] = require("./rules/no-with");
|
23680
23750
|
rules["object-curly-spacing"] = require("./rules/object-curly-spacing");
|
23681
23751
|
rules["object-shorthand"] = require("./rules/object-shorthand");
|
@@ -23696,6 +23766,7 @@ module.exports = function() {
|
|
23696
23766
|
rules["require-yield"] = require("./rules/require-yield");
|
23697
23767
|
rules["semi-spacing"] = require("./rules/semi-spacing");
|
23698
23768
|
rules["semi"] = require("./rules/semi");
|
23769
|
+
rules["sort-imports"] = require("./rules/sort-imports");
|
23699
23770
|
rules["sort-vars"] = require("./rules/sort-vars");
|
23700
23771
|
rules["space-after-keywords"] = require("./rules/space-after-keywords");
|
23701
23772
|
rules["space-before-blocks"] = require("./rules/space-before-blocks");
|
@@ -23718,7 +23789,7 @@ module.exports = function() {
|
|
23718
23789
|
|
23719
23790
|
return rules;
|
23720
23791
|
};
|
23721
|
-
},{"./rules/accessor-pairs":166,"./rules/array-bracket-spacing":167,"./rules/array-callback-return":168,"./rules/arrow-body-style":169,"./rules/arrow-parens":170,"./rules/arrow-spacing":171,"./rules/block-scoped-var":172,"./rules/block-spacing":173,"./rules/brace-style":174,"./rules/callback-return":175,"./rules/camelcase":176,"./rules/comma-dangle":177,"./rules/comma-spacing":178,"./rules/comma-style":179,"./rules/complexity":180,"./rules/computed-property-spacing":181,"./rules/consistent-return":182,"./rules/consistent-this":183,"./rules/constructor-super":184,"./rules/curly":185,"./rules/default-case":186,"./rules/dot-location":187,"./rules/dot-notation":188,"./rules/eol-last":189,"./rules/eqeqeq":190,"./rules/func-names":191,"./rules/func-style":192,"./rules/generator-star-spacing":193,"./rules/global-require":194,"./rules/guard-for-in":195,"./rules/handle-callback-err":196,"./rules/id-length":197,"./rules/id-match":198,"./rules/indent":199,"./rules/init-declarations":200,"./rules/jsx-quotes":201,"./rules/key-spacing":202,"./rules/linebreak-style":
|
23792
|
+
},{"./rules/accessor-pairs":166,"./rules/array-bracket-spacing":167,"./rules/array-callback-return":168,"./rules/arrow-body-style":169,"./rules/arrow-parens":170,"./rules/arrow-spacing":171,"./rules/block-scoped-var":172,"./rules/block-spacing":173,"./rules/brace-style":174,"./rules/callback-return":175,"./rules/camelcase":176,"./rules/comma-dangle":177,"./rules/comma-spacing":178,"./rules/comma-style":179,"./rules/complexity":180,"./rules/computed-property-spacing":181,"./rules/consistent-return":182,"./rules/consistent-this":183,"./rules/constructor-super":184,"./rules/curly":185,"./rules/default-case":186,"./rules/dot-location":187,"./rules/dot-notation":188,"./rules/eol-last":189,"./rules/eqeqeq":190,"./rules/func-names":191,"./rules/func-style":192,"./rules/generator-star-spacing":193,"./rules/global-require":194,"./rules/guard-for-in":195,"./rules/handle-callback-err":196,"./rules/id-length":197,"./rules/id-match":198,"./rules/indent":199,"./rules/init-declarations":200,"./rules/jsx-quotes":201,"./rules/key-spacing":202,"./rules/keyword-spacing":203,"./rules/linebreak-style":204,"./rules/lines-around-comment":205,"./rules/max-depth":206,"./rules/max-len":207,"./rules/max-nested-callbacks":208,"./rules/max-params":209,"./rules/max-statements":210,"./rules/new-cap":211,"./rules/new-parens":212,"./rules/newline-after-var":213,"./rules/no-alert":214,"./rules/no-array-constructor":215,"./rules/no-arrow-condition":216,"./rules/no-bitwise":217,"./rules/no-caller":218,"./rules/no-case-declarations":219,"./rules/no-catch-shadow":220,"./rules/no-class-assign":221,"./rules/no-cond-assign":222,"./rules/no-confusing-arrow":223,"./rules/no-console":224,"./rules/no-const-assign":225,"./rules/no-constant-condition":226,"./rules/no-continue":227,"./rules/no-control-regex":228,"./rules/no-debugger":229,"./rules/no-delete-var":230,"./rules/no-div-regex":231,"./rules/no-dupe-args":232,"./rules/no-dupe-class-members":233,"./rules/no-dupe-keys":234,"./rules/no-duplicate-case":235,"./rules/no-else-return":236,"./rules/no-empty":240,"./rules/no-empty-character-class":237,"./rules/no-empty-label":238,"./rules/no-empty-pattern":239,"./rules/no-eq-null":241,"./rules/no-eval":242,"./rules/no-ex-assign":243,"./rules/no-extend-native":244,"./rules/no-extra-bind":245,"./rules/no-extra-boolean-cast":246,"./rules/no-extra-parens":247,"./rules/no-extra-semi":248,"./rules/no-fallthrough":249,"./rules/no-floating-decimal":250,"./rules/no-func-assign":251,"./rules/no-implicit-coercion":252,"./rules/no-implicit-globals":253,"./rules/no-implied-eval":254,"./rules/no-inline-comments":255,"./rules/no-inner-declarations":256,"./rules/no-invalid-regexp":257,"./rules/no-invalid-this":258,"./rules/no-irregular-whitespace":259,"./rules/no-iterator":260,"./rules/no-label-var":261,"./rules/no-labels":262,"./rules/no-lone-blocks":263,"./rules/no-lonely-if":264,"./rules/no-loop-func":265,"./rules/no-magic-numbers":266,"./rules/no-mixed-requires":267,"./rules/no-mixed-spaces-and-tabs":268,"./rules/no-multi-spaces":269,"./rules/no-multi-str":270,"./rules/no-multiple-empty-lines":271,"./rules/no-native-reassign":272,"./rules/no-negated-condition":273,"./rules/no-negated-in-lhs":274,"./rules/no-nested-ternary":275,"./rules/no-new":281,"./rules/no-new-func":276,"./rules/no-new-object":277,"./rules/no-new-require":278,"./rules/no-new-symbol":279,"./rules/no-new-wrappers":280,"./rules/no-obj-calls":282,"./rules/no-octal":284,"./rules/no-octal-escape":283,"./rules/no-param-reassign":285,"./rules/no-path-concat":286,"./rules/no-plusplus":287,"./rules/no-process-env":288,"./rules/no-process-exit":289,"./rules/no-proto":290,"./rules/no-redeclare":291,"./rules/no-regex-spaces":292,"./rules/no-restricted-imports":293,"./rules/no-restricted-modules":294,"./rules/no-restricted-syntax":295,"./rules/no-return-assign":296,"./rules/no-script-url":297,"./rules/no-self-compare":298,"./rules/no-sequences":299,"./rules/no-shadow":301,"./rules/no-shadow-restricted-names":300,"./rules/no-spaced-func":302,"./rules/no-sparse-arrays":303,"./rules/no-sync":304,"./rules/no-ternary":305,"./rules/no-this-before-super":306,"./rules/no-throw-literal":307,"./rules/no-trailing-spaces":308,"./rules/no-undef":310,"./rules/no-undef-init":309,"./rules/no-undefined":311,"./rules/no-underscore-dangle":312,"./rules/no-unexpected-multiline":313,"./rules/no-unmodified-loop-condition":314,"./rules/no-unneeded-ternary":315,"./rules/no-unreachable":316,"./rules/no-unused-expressions":317,"./rules/no-unused-vars":318,"./rules/no-use-before-define":319,"./rules/no-useless-call":320,"./rules/no-useless-concat":321,"./rules/no-useless-constructor":322,"./rules/no-var":323,"./rules/no-void":324,"./rules/no-warning-comments":325,"./rules/no-whitespace-before-property":326,"./rules/no-with":327,"./rules/object-curly-spacing":328,"./rules/object-shorthand":329,"./rules/one-var":330,"./rules/operator-assignment":331,"./rules/operator-linebreak":332,"./rules/padded-blocks":333,"./rules/prefer-arrow-callback":334,"./rules/prefer-const":335,"./rules/prefer-reflect":336,"./rules/prefer-rest-params":337,"./rules/prefer-spread":338,"./rules/prefer-template":339,"./rules/quote-props":340,"./rules/quotes":341,"./rules/radix":342,"./rules/require-jsdoc":343,"./rules/require-yield":344,"./rules/semi":346,"./rules/semi-spacing":345,"./rules/sort-imports":347,"./rules/sort-vars":348,"./rules/space-after-keywords":349,"./rules/space-before-blocks":350,"./rules/space-before-function-paren":351,"./rules/space-before-keywords":352,"./rules/space-in-parens":353,"./rules/space-infix-ops":354,"./rules/space-return-throw-case":355,"./rules/space-unary-ops":356,"./rules/spaced-comment":357,"./rules/strict":358,"./rules/use-isnan":359,"./rules/valid-jsdoc":360,"./rules/valid-typeof":361,"./rules/vars-on-top":362,"./rules/wrap-iife":363,"./rules/wrap-regex":364,"./rules/yield-star-spacing":365,"./rules/yoda":366}],164:[function(require,module,exports){
|
23722
23793
|
/**
|
23723
23794
|
* @fileoverview RuleContext utility for rules
|
23724
23795
|
* @author Nicholas C. Zakas
|
@@ -23759,8 +23830,7 @@ var PASSTHROUGHS = [
|
|
23759
23830
|
"getTokensAfter",
|
23760
23831
|
"getTokensBefore",
|
23761
23832
|
"getTokensBetween",
|
23762
|
-
"markVariableAsUsed"
|
23763
|
-
"isMarkedAsUsed"
|
23833
|
+
"markVariableAsUsed"
|
23764
23834
|
];
|
23765
23835
|
|
23766
23836
|
//------------------------------------------------------------------------------
|
@@ -23875,7 +23945,7 @@ PASSTHROUGHS.forEach(function(name) {
|
|
23875
23945
|
|
23876
23946
|
module.exports = RuleContext;
|
23877
23947
|
|
23878
|
-
},{"./util/rule-fixer":
|
23948
|
+
},{"./util/rule-fixer":374}],165:[function(require,module,exports){
|
23879
23949
|
/**
|
23880
23950
|
* @fileoverview Defines a storage for rules.
|
23881
23951
|
* @author Nicholas C. Zakas
|
@@ -24852,7 +24922,7 @@ module.exports = function(context) {
|
|
24852
24922
|
var identifier = reference.identifier;
|
24853
24923
|
context.report(
|
24854
24924
|
identifier,
|
24855
|
-
"
|
24925
|
+
"'{{name}}' used outside of binding context.",
|
24856
24926
|
{name: identifier.name});
|
24857
24927
|
}
|
24858
24928
|
|
@@ -25003,7 +25073,7 @@ module.exports = function(context) {
|
|
25003
25073
|
context.report({
|
25004
25074
|
node: node,
|
25005
25075
|
loc: openBrace.loc.start,
|
25006
|
-
message: message + " after
|
25076
|
+
message: message + " after '{'.",
|
25007
25077
|
fix: function(fixer) {
|
25008
25078
|
if (always) {
|
25009
25079
|
return fixer.insertTextBefore(firstToken, " ");
|
@@ -25017,7 +25087,7 @@ module.exports = function(context) {
|
|
25017
25087
|
context.report({
|
25018
25088
|
node: node,
|
25019
25089
|
loc: closeBrace.loc.start,
|
25020
|
-
message: message + " before
|
25090
|
+
message: message + " before '}'.",
|
25021
25091
|
fix: function(fixer) {
|
25022
25092
|
if (always) {
|
25023
25093
|
return fixer.insertTextAfter(lastToken, " ");
|
@@ -25428,6 +25498,9 @@ module.exports = function(context) {
|
|
25428
25498
|
// Helpers
|
25429
25499
|
//--------------------------------------------------------------------------
|
25430
25500
|
|
25501
|
+
// contains reported nodes to avoid reporting twice on destructuring with shorthand notation
|
25502
|
+
var reported = [];
|
25503
|
+
|
25431
25504
|
/**
|
25432
25505
|
* Checks if a string contains an underscore and isn't all upper-case
|
25433
25506
|
* @param {String} name The string to check.
|
@@ -25447,7 +25520,10 @@ module.exports = function(context) {
|
|
25447
25520
|
* @private
|
25448
25521
|
*/
|
25449
25522
|
function report(node) {
|
25450
|
-
|
25523
|
+
if (reported.indexOf(node) < 0) {
|
25524
|
+
reported.push(node);
|
25525
|
+
context.report(node, "Identifier '{{name}}' is not in camel case.", { name: node.name });
|
25526
|
+
}
|
25451
25527
|
}
|
25452
25528
|
|
25453
25529
|
var options = context.options[0] || {},
|
@@ -25460,7 +25536,6 @@ module.exports = function(context) {
|
|
25460
25536
|
return {
|
25461
25537
|
|
25462
25538
|
"Identifier": function(node) {
|
25463
|
-
|
25464
25539
|
// Leading and trailing underscores are commonly used to flag private/protected identifiers, strip them
|
25465
25540
|
var name = node.name.replace(/^_+|_+$/g, ""),
|
25466
25541
|
effectiveParent = (node.parent.type === "MemberExpression") ? node.parent.parent : node.parent;
|
@@ -25490,12 +25565,16 @@ module.exports = function(context) {
|
|
25490
25565
|
|
25491
25566
|
// Properties have their own rules
|
25492
25567
|
} else if (node.parent.type === "Property") {
|
25493
|
-
|
25494
25568
|
// "never" check properties
|
25495
25569
|
if (properties === "never") {
|
25496
25570
|
return;
|
25497
25571
|
}
|
25498
25572
|
|
25573
|
+
if (node.parent.parent && node.parent.parent.type === "ObjectPattern" &&
|
25574
|
+
node.parent.key === node && node.parent.value !== node) {
|
25575
|
+
return;
|
25576
|
+
}
|
25577
|
+
|
25499
25578
|
if (isUnderscored(name) && effectiveParent.type !== "CallExpression") {
|
25500
25579
|
report(node);
|
25501
25580
|
}
|
@@ -25595,7 +25674,7 @@ module.exports = function(context) {
|
|
25595
25674
|
* This rule handles a given node as multiline when the closing parenthesis
|
25596
25675
|
* and the last element are not on the same line.
|
25597
25676
|
*
|
25598
|
-
* @param {ASTNode} node - A
|
25677
|
+
* @param {ASTNode} node - A node to check.
|
25599
25678
|
* @returns {boolean} `true` if the node is multiline.
|
25600
25679
|
*/
|
25601
25680
|
function isMultiline(node) {
|
@@ -25606,7 +25685,13 @@ module.exports = function(context) {
|
|
25606
25685
|
|
25607
25686
|
var sourceCode = context.getSourceCode(),
|
25608
25687
|
penultimateToken = sourceCode.getLastToken(lastItem),
|
25609
|
-
lastToken = sourceCode.
|
25688
|
+
lastToken = sourceCode.getTokenAfter(penultimateToken);
|
25689
|
+
|
25690
|
+
// parentheses are a pain
|
25691
|
+
while (lastToken.value === ")") {
|
25692
|
+
penultimateToken = lastToken;
|
25693
|
+
lastToken = sourceCode.getTokenAfter(lastToken);
|
25694
|
+
}
|
25610
25695
|
|
25611
25696
|
if (lastToken.value === ",") {
|
25612
25697
|
penultimateToken = lastToken;
|
@@ -26120,7 +26205,7 @@ module.exports.schema = [
|
|
26120
26205
|
|
26121
26206
|
module.exports = function(context) {
|
26122
26207
|
|
26123
|
-
var THRESHOLD = context.options[0];
|
26208
|
+
var THRESHOLD = (typeof context.options[0] !== "undefined") ? context.options[0] : 20;
|
26124
26209
|
|
26125
26210
|
//--------------------------------------------------------------------------
|
26126
26211
|
// Helpers
|
@@ -26511,7 +26596,7 @@ module.exports.schema = [];
|
|
26511
26596
|
//------------------------------------------------------------------------------
|
26512
26597
|
|
26513
26598
|
module.exports = function(context) {
|
26514
|
-
var alias = context.options[0];
|
26599
|
+
var alias = context.options[0] || "that";
|
26515
26600
|
|
26516
26601
|
/**
|
26517
26602
|
* Reports that a variable declarator or assignment expression is assigning
|
@@ -26734,8 +26819,8 @@ module.exports = function(context) {
|
|
26734
26819
|
if (!calledInEveryPaths) {
|
26735
26820
|
context.report({
|
26736
26821
|
message: calledInSomePaths ?
|
26737
|
-
"Lacked a call of
|
26738
|
-
"Expected to call
|
26822
|
+
"Lacked a call of 'super()' in some code paths." :
|
26823
|
+
"Expected to call 'super()'.",
|
26739
26824
|
node: node.parent
|
26740
26825
|
});
|
26741
26826
|
}
|
@@ -26802,7 +26887,7 @@ module.exports = function(context) {
|
|
26802
26887
|
|
26803
26888
|
if (duplicate) {
|
26804
26889
|
context.report({
|
26805
|
-
message: "Unexpected duplicate
|
26890
|
+
message: "Unexpected duplicate 'super()'.",
|
26806
26891
|
node: node
|
26807
26892
|
});
|
26808
26893
|
}
|
@@ -26810,7 +26895,7 @@ module.exports = function(context) {
|
|
26810
26895
|
// This class does not have a valid `extends` part.
|
26811
26896
|
// Disallow `super()`.
|
26812
26897
|
context.report({
|
26813
|
-
message: "Unexpected
|
26898
|
+
message: "Unexpected 'super()'.",
|
26814
26899
|
node: node
|
26815
26900
|
});
|
26816
26901
|
}
|
@@ -27309,7 +27394,7 @@ module.exports.schema = [
|
|
27309
27394
|
}
|
27310
27395
|
];
|
27311
27396
|
|
27312
|
-
},{"../util/keywords":
|
27397
|
+
},{"../util/keywords":372}],189:[function(require,module,exports){
|
27313
27398
|
/**
|
27314
27399
|
* @fileoverview Require file to end with single newline.
|
27315
27400
|
* @author Nodeca Team <https://github.com/nodeca>
|
@@ -29085,8 +29170,8 @@ function isSingleLine(node) {
|
|
29085
29170
|
//------------------------------------------------------------------------------
|
29086
29171
|
|
29087
29172
|
var messages = {
|
29088
|
-
key: "{{error}} space after {{computed}}key
|
29089
|
-
value: "{{error}} space before value for {{computed}}key
|
29173
|
+
key: "{{error}} space after {{computed}}key '{{key}}'.",
|
29174
|
+
value: "{{error}} space before value for {{computed}}key '{{key}}'."
|
29090
29175
|
};
|
29091
29176
|
|
29092
29177
|
module.exports = function(context) {
|
@@ -29106,6 +29191,20 @@ module.exports = function(context) {
|
|
29106
29191
|
beforeColon = +!!options.beforeColon, // Defaults to false
|
29107
29192
|
afterColon = +!(options.afterColon === false); // Defaults to true
|
29108
29193
|
|
29194
|
+
/**
|
29195
|
+
* Determines if the given property is key-value property.
|
29196
|
+
* @param {ASTNode} property Property node to check.
|
29197
|
+
* @returns {Boolean} Whether the property is a key-value property.
|
29198
|
+
*/
|
29199
|
+
function isKeyValueProperty(property) {
|
29200
|
+
return !(
|
29201
|
+
property.method ||
|
29202
|
+
property.shorthand ||
|
29203
|
+
property.kind !== "init" ||
|
29204
|
+
property.type !== "Property" // Could be "ExperimentalSpreadProperty" or "SpreadProperty"
|
29205
|
+
);
|
29206
|
+
}
|
29207
|
+
|
29109
29208
|
/**
|
29110
29209
|
* Starting from the given a node (a property.key node here) looks forward
|
29111
29210
|
* until it finds the last token before a colon punctuator and returns it.
|
@@ -29188,11 +29287,6 @@ module.exports = function(context) {
|
|
29188
29287
|
function getKeyWidth(property) {
|
29189
29288
|
var startToken, endToken;
|
29190
29289
|
|
29191
|
-
// Ignore shorthand methods and properties, as they have no colon
|
29192
|
-
if (property.method || property.shorthand) {
|
29193
|
-
return 0;
|
29194
|
-
}
|
29195
|
-
|
29196
29290
|
startToken = context.getFirstToken(property);
|
29197
29291
|
endToken = getLastTokenBeforeColon(property.key);
|
29198
29292
|
|
@@ -29283,7 +29377,7 @@ module.exports = function(context) {
|
|
29283
29377
|
*/
|
29284
29378
|
function verifyAlignment(node) {
|
29285
29379
|
createGroups(node).forEach(function(group) {
|
29286
|
-
verifyGroupAlignment(group);
|
29380
|
+
verifyGroupAlignment(group.filter(isKeyValueProperty));
|
29287
29381
|
});
|
29288
29382
|
}
|
29289
29383
|
|
@@ -29363,6 +29457,498 @@ module.exports.schema = [
|
|
29363
29457
|
];
|
29364
29458
|
|
29365
29459
|
},{}],203:[function(require,module,exports){
|
29460
|
+
/**
|
29461
|
+
* @fileoverview Rule to enforce spacing before and after keywords.
|
29462
|
+
* @author Toru Nagashima
|
29463
|
+
* @copyright 2015 Toru Nagashima. All rights reserved.
|
29464
|
+
* See LICENSE file in root directory for full license.
|
29465
|
+
*/
|
29466
|
+
|
29467
|
+
"use strict";
|
29468
|
+
|
29469
|
+
//------------------------------------------------------------------------------
|
29470
|
+
// Requirements
|
29471
|
+
//------------------------------------------------------------------------------
|
29472
|
+
|
29473
|
+
var astUtils = require("../ast-utils"),
|
29474
|
+
keywords = require("../util/keywords");
|
29475
|
+
|
29476
|
+
//------------------------------------------------------------------------------
|
29477
|
+
// Constants
|
29478
|
+
//------------------------------------------------------------------------------
|
29479
|
+
|
29480
|
+
var PREV_TOKEN = /^[\)\]\}>]$/;
|
29481
|
+
var NEXT_TOKEN = /^(?:[\(\[\{<~!]|\+\+?|--?)$/;
|
29482
|
+
var PREV_TOKEN_M = /^[\)\]\}>*]$/;
|
29483
|
+
var NEXT_TOKEN_M = /^[\{*]$/;
|
29484
|
+
var CHECK_TYPE = /^(?:JSXElement|RegularExpression|String|Template)$/;
|
29485
|
+
var KEYS = keywords.concat(["as", "await", "from", "get", "let", "of", "set", "yield"]);
|
29486
|
+
|
29487
|
+
// check duplications.
|
29488
|
+
(function() {
|
29489
|
+
KEYS.sort();
|
29490
|
+
for (var i = 1; i < KEYS.length; ++i) {
|
29491
|
+
if (KEYS[i] === KEYS[i - 1]) {
|
29492
|
+
throw new Error("Duplication was found in the keyword list: " + KEYS[i]);
|
29493
|
+
}
|
29494
|
+
}
|
29495
|
+
}());
|
29496
|
+
|
29497
|
+
//------------------------------------------------------------------------------
|
29498
|
+
// Rule Definition
|
29499
|
+
//------------------------------------------------------------------------------
|
29500
|
+
|
29501
|
+
module.exports = function(context) {
|
29502
|
+
var sourceCode = context.getSourceCode();
|
29503
|
+
|
29504
|
+
/**
|
29505
|
+
* Reports a given token if there are not space(s) before the token.
|
29506
|
+
*
|
29507
|
+
* @param {Token} token - A token to report.
|
29508
|
+
* @param {RegExp|undefined} pattern - Optional. A pattern of the previous
|
29509
|
+
* token to check.
|
29510
|
+
* @returns {void}
|
29511
|
+
*/
|
29512
|
+
function expectSpaceBefore(token, pattern) {
|
29513
|
+
pattern = pattern || PREV_TOKEN;
|
29514
|
+
|
29515
|
+
var prevToken = sourceCode.getTokenBefore(token);
|
29516
|
+
if (prevToken &&
|
29517
|
+
(CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) &&
|
29518
|
+
astUtils.isTokenOnSameLine(prevToken, token) &&
|
29519
|
+
!sourceCode.isSpaceBetweenTokens(prevToken, token)
|
29520
|
+
) {
|
29521
|
+
context.report({
|
29522
|
+
loc: token.loc.start,
|
29523
|
+
message: "Expected space(s) before \"{{value}}\".",
|
29524
|
+
data: token,
|
29525
|
+
fix: function(fixer) {
|
29526
|
+
return fixer.insertTextBefore(token, " ");
|
29527
|
+
}
|
29528
|
+
});
|
29529
|
+
}
|
29530
|
+
}
|
29531
|
+
|
29532
|
+
/**
|
29533
|
+
* Reports a given token if there are space(s) before the token.
|
29534
|
+
*
|
29535
|
+
* @param {Token} token - A token to report.
|
29536
|
+
* @param {RegExp|undefined} pattern - Optional. A pattern of the previous
|
29537
|
+
* token to check.
|
29538
|
+
* @returns {void}
|
29539
|
+
*/
|
29540
|
+
function unexpectSpaceBefore(token, pattern) {
|
29541
|
+
pattern = pattern || PREV_TOKEN;
|
29542
|
+
|
29543
|
+
var prevToken = sourceCode.getTokenBefore(token);
|
29544
|
+
if (prevToken &&
|
29545
|
+
(CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) &&
|
29546
|
+
astUtils.isTokenOnSameLine(prevToken, token) &&
|
29547
|
+
sourceCode.isSpaceBetweenTokens(prevToken, token)
|
29548
|
+
) {
|
29549
|
+
context.report({
|
29550
|
+
loc: token.loc.start,
|
29551
|
+
message: "Unexpected space(s) before \"{{value}}\".",
|
29552
|
+
data: token,
|
29553
|
+
fix: function(fixer) {
|
29554
|
+
return fixer.removeRange([prevToken.range[1], token.range[0]]);
|
29555
|
+
}
|
29556
|
+
});
|
29557
|
+
}
|
29558
|
+
}
|
29559
|
+
|
29560
|
+
/**
|
29561
|
+
* Reports a given token if there are not space(s) after the token.
|
29562
|
+
*
|
29563
|
+
* @param {Token} token - A token to report.
|
29564
|
+
* @param {RegExp|undefined} pattern - Optional. A pattern of the next
|
29565
|
+
* token to check.
|
29566
|
+
* @returns {void}
|
29567
|
+
*/
|
29568
|
+
function expectSpaceAfter(token, pattern) {
|
29569
|
+
pattern = pattern || NEXT_TOKEN;
|
29570
|
+
|
29571
|
+
var nextToken = sourceCode.getTokenAfter(token);
|
29572
|
+
if (nextToken &&
|
29573
|
+
(CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) &&
|
29574
|
+
astUtils.isTokenOnSameLine(token, nextToken) &&
|
29575
|
+
!sourceCode.isSpaceBetweenTokens(token, nextToken)
|
29576
|
+
) {
|
29577
|
+
context.report({
|
29578
|
+
loc: token.loc.start,
|
29579
|
+
message: "Expected space(s) after \"{{value}}\".",
|
29580
|
+
data: token,
|
29581
|
+
fix: function(fixer) {
|
29582
|
+
return fixer.insertTextAfter(token, " ");
|
29583
|
+
}
|
29584
|
+
});
|
29585
|
+
}
|
29586
|
+
}
|
29587
|
+
|
29588
|
+
/**
|
29589
|
+
* Reports a given token if there are space(s) after the token.
|
29590
|
+
*
|
29591
|
+
* @param {Token} token - A token to report.
|
29592
|
+
* @param {RegExp|undefined} pattern - Optional. A pattern of the next
|
29593
|
+
* token to check.
|
29594
|
+
* @returns {void}
|
29595
|
+
*/
|
29596
|
+
function unexpectSpaceAfter(token, pattern) {
|
29597
|
+
pattern = pattern || NEXT_TOKEN;
|
29598
|
+
|
29599
|
+
var nextToken = sourceCode.getTokenAfter(token);
|
29600
|
+
if (nextToken &&
|
29601
|
+
(CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) &&
|
29602
|
+
astUtils.isTokenOnSameLine(token, nextToken) &&
|
29603
|
+
sourceCode.isSpaceBetweenTokens(token, nextToken)
|
29604
|
+
) {
|
29605
|
+
context.report({
|
29606
|
+
loc: token.loc.start,
|
29607
|
+
message: "Unexpected space(s) after \"{{value}}\".",
|
29608
|
+
data: token,
|
29609
|
+
fix: function(fixer) {
|
29610
|
+
return fixer.removeRange([token.range[1], nextToken.range[0]]);
|
29611
|
+
}
|
29612
|
+
});
|
29613
|
+
}
|
29614
|
+
}
|
29615
|
+
|
29616
|
+
/**
|
29617
|
+
* Parses the option object and determines check methods for each keyword.
|
29618
|
+
*
|
29619
|
+
* @param {object|undefined} options - The option object to parse.
|
29620
|
+
* @returns {object} - Normalized option object.
|
29621
|
+
* Keys are keywords (there are for every keyword).
|
29622
|
+
* Values are instances of `{"before": function, "after": function}`.
|
29623
|
+
*/
|
29624
|
+
function parseOptions(options) {
|
29625
|
+
var before = !options || options.before !== false;
|
29626
|
+
var after = !options || options.after !== false;
|
29627
|
+
var defaultValue = {
|
29628
|
+
before: before ? expectSpaceBefore : unexpectSpaceBefore,
|
29629
|
+
after: after ? expectSpaceAfter : unexpectSpaceAfter
|
29630
|
+
};
|
29631
|
+
var overrides = (options && options.overrides) || {};
|
29632
|
+
var retv = Object.create(null);
|
29633
|
+
|
29634
|
+
for (var i = 0; i < KEYS.length; ++i) {
|
29635
|
+
var key = KEYS[i];
|
29636
|
+
var override = overrides[key];
|
29637
|
+
|
29638
|
+
if (override) {
|
29639
|
+
var thisBefore = ("before" in override) ? override.before : before;
|
29640
|
+
var thisAfter = ("after" in override) ? override.after : after;
|
29641
|
+
retv[key] = {
|
29642
|
+
before: thisBefore ? expectSpaceBefore : unexpectSpaceBefore,
|
29643
|
+
after: thisAfter ? expectSpaceAfter : unexpectSpaceAfter
|
29644
|
+
};
|
29645
|
+
} else {
|
29646
|
+
retv[key] = defaultValue;
|
29647
|
+
}
|
29648
|
+
}
|
29649
|
+
|
29650
|
+
return retv;
|
29651
|
+
}
|
29652
|
+
|
29653
|
+
var checkMethodMap = parseOptions(context.options[0]);
|
29654
|
+
|
29655
|
+
/**
|
29656
|
+
* Reports a given token if usage of spacing followed by the token is
|
29657
|
+
* invalid.
|
29658
|
+
*
|
29659
|
+
* @param {Token} token - A token to report.
|
29660
|
+
* @param {RegExp|undefined} pattern - Optional. A pattern of the previous
|
29661
|
+
* token to check.
|
29662
|
+
* @returns {void}
|
29663
|
+
*/
|
29664
|
+
function checkSpacingBefore(token, pattern) {
|
29665
|
+
checkMethodMap[token.value].before(token, pattern);
|
29666
|
+
}
|
29667
|
+
|
29668
|
+
/**
|
29669
|
+
* Reports a given token if usage of spacing preceded by the token is
|
29670
|
+
* invalid.
|
29671
|
+
*
|
29672
|
+
* @param {Token} token - A token to report.
|
29673
|
+
* @param {RegExp|undefined} pattern - Optional. A pattern of the next
|
29674
|
+
* token to check.
|
29675
|
+
* @returns {void}
|
29676
|
+
*/
|
29677
|
+
function checkSpacingAfter(token, pattern) {
|
29678
|
+
checkMethodMap[token.value].after(token, pattern);
|
29679
|
+
}
|
29680
|
+
|
29681
|
+
/**
|
29682
|
+
* Reports a given token if usage of spacing around the token is invalid.
|
29683
|
+
*
|
29684
|
+
* @param {Token} token - A token to report.
|
29685
|
+
* @returns {void}
|
29686
|
+
*/
|
29687
|
+
function checkSpacingAround(token) {
|
29688
|
+
checkSpacingBefore(token);
|
29689
|
+
checkSpacingAfter(token);
|
29690
|
+
}
|
29691
|
+
|
29692
|
+
/**
|
29693
|
+
* Reports the first token of a given node if the first token is a keyword
|
29694
|
+
* and usage of spacing around the token is invalid.
|
29695
|
+
*
|
29696
|
+
* @param {ASTNode|null} node - A node to report.
|
29697
|
+
* @returns {void}
|
29698
|
+
*/
|
29699
|
+
function checkSpacingAroundFirstToken(node) {
|
29700
|
+
var firstToken = node && sourceCode.getFirstToken(node);
|
29701
|
+
if (firstToken && firstToken.type === "Keyword") {
|
29702
|
+
checkSpacingAround(firstToken);
|
29703
|
+
}
|
29704
|
+
}
|
29705
|
+
|
29706
|
+
/**
|
29707
|
+
* Reports the first token of a given node if the first token is a keyword
|
29708
|
+
* and usage of spacing followed by the token is invalid.
|
29709
|
+
*
|
29710
|
+
* This is used for unary operators (e.g. `typeof`), `function`, and `super`.
|
29711
|
+
* Other rules are handling usage of spacing preceded by those keywords.
|
29712
|
+
*
|
29713
|
+
* @param {ASTNode|null} node - A node to report.
|
29714
|
+
* @returns {void}
|
29715
|
+
*/
|
29716
|
+
function checkSpacingBeforeFirstToken(node) {
|
29717
|
+
var firstToken = node && sourceCode.getFirstToken(node);
|
29718
|
+
if (firstToken && firstToken.type === "Keyword") {
|
29719
|
+
checkSpacingBefore(firstToken);
|
29720
|
+
}
|
29721
|
+
}
|
29722
|
+
|
29723
|
+
/**
|
29724
|
+
* Reports the previous token of a given node if the token is a keyword and
|
29725
|
+
* usage of spacing around the token is invalid.
|
29726
|
+
*
|
29727
|
+
* @param {ASTNode|null} node - A node to report.
|
29728
|
+
* @returns {void}
|
29729
|
+
*/
|
29730
|
+
function checkSpacingAroundTokenBefore(node) {
|
29731
|
+
if (node) {
|
29732
|
+
var token = sourceCode.getTokenBefore(node);
|
29733
|
+
while (token.type !== "Keyword") {
|
29734
|
+
token = sourceCode.getTokenBefore(token);
|
29735
|
+
}
|
29736
|
+
|
29737
|
+
checkSpacingAround(token);
|
29738
|
+
}
|
29739
|
+
}
|
29740
|
+
|
29741
|
+
/**
|
29742
|
+
* Reports `class` and `extends` keywords of a given node if usage of
|
29743
|
+
* spacing around those keywords is invalid.
|
29744
|
+
*
|
29745
|
+
* @param {ASTNode} node - A node to report.
|
29746
|
+
* @returns {void}
|
29747
|
+
*/
|
29748
|
+
function checkSpacingForClass(node) {
|
29749
|
+
checkSpacingAroundFirstToken(node);
|
29750
|
+
checkSpacingAroundTokenBefore(node.superClass);
|
29751
|
+
}
|
29752
|
+
|
29753
|
+
/**
|
29754
|
+
* Reports `if` and `else` keywords of a given node if usage of spacing
|
29755
|
+
* around those keywords is invalid.
|
29756
|
+
*
|
29757
|
+
* @param {ASTNode} node - A node to report.
|
29758
|
+
* @returns {void}
|
29759
|
+
*/
|
29760
|
+
function checkSpacingForIfStatement(node) {
|
29761
|
+
checkSpacingAroundFirstToken(node);
|
29762
|
+
checkSpacingAroundTokenBefore(node.alternate);
|
29763
|
+
}
|
29764
|
+
|
29765
|
+
/**
|
29766
|
+
* Reports `try`, `catch`, and `finally` keywords of a given node if usage
|
29767
|
+
* of spacing around those keywords is invalid.
|
29768
|
+
*
|
29769
|
+
* @param {ASTNode} node - A node to report.
|
29770
|
+
* @returns {void}
|
29771
|
+
*/
|
29772
|
+
function checkSpacingForTryStatement(node) {
|
29773
|
+
checkSpacingAroundFirstToken(node);
|
29774
|
+
checkSpacingAroundFirstToken(node.handler);
|
29775
|
+
checkSpacingAroundTokenBefore(node.finalizer);
|
29776
|
+
}
|
29777
|
+
|
29778
|
+
/**
|
29779
|
+
* Reports `do` and `while` keywords of a given node if usage of spacing
|
29780
|
+
* around those keywords is invalid.
|
29781
|
+
*
|
29782
|
+
* @param {ASTNode} node - A node to report.
|
29783
|
+
* @returns {void}
|
29784
|
+
*/
|
29785
|
+
function checkSpacingForDoWhileStatement(node) {
|
29786
|
+
checkSpacingAroundFirstToken(node);
|
29787
|
+
checkSpacingAroundTokenBefore(node.test);
|
29788
|
+
}
|
29789
|
+
|
29790
|
+
/**
|
29791
|
+
* Reports `for` and `in` keywords of a given node if usage of spacing
|
29792
|
+
* around those keywords is invalid.
|
29793
|
+
*
|
29794
|
+
* @param {ASTNode} node - A node to report.
|
29795
|
+
* @returns {void}
|
29796
|
+
*/
|
29797
|
+
function checkSpacingForForInStatement(node) {
|
29798
|
+
checkSpacingAroundFirstToken(node);
|
29799
|
+
checkSpacingAroundTokenBefore(node.right);
|
29800
|
+
}
|
29801
|
+
|
29802
|
+
/**
|
29803
|
+
* Reports `for` and `of` keywords of a given node if usage of spacing
|
29804
|
+
* around those keywords is invalid.
|
29805
|
+
*
|
29806
|
+
* @param {ASTNode} node - A node to report.
|
29807
|
+
* @returns {void}
|
29808
|
+
*/
|
29809
|
+
function checkSpacingForForOfStatement(node) {
|
29810
|
+
checkSpacingAroundFirstToken(node);
|
29811
|
+
|
29812
|
+
// `of` is not a keyword token.
|
29813
|
+
var token = sourceCode.getTokenBefore(node.right);
|
29814
|
+
while (token.value !== "of") {
|
29815
|
+
token = sourceCode.getTokenBefore(token);
|
29816
|
+
}
|
29817
|
+
checkSpacingAround(token);
|
29818
|
+
}
|
29819
|
+
|
29820
|
+
/**
|
29821
|
+
* Reports `import`, `export`, `as`, and `from` keywords of a given node if
|
29822
|
+
* usage of spacing around those keywords is invalid.
|
29823
|
+
*
|
29824
|
+
* This rule handles the `*` token in module declarations.
|
29825
|
+
*
|
29826
|
+
* import*as A from "./a"; /*error Expected space(s) after "import".
|
29827
|
+
* error Expected space(s) before "as".
|
29828
|
+
*
|
29829
|
+
* @param {ASTNode} node - A node to report.
|
29830
|
+
* @returns {void}
|
29831
|
+
*/
|
29832
|
+
function checkSpacingForModuleDeclaration(node) {
|
29833
|
+
var firstToken = sourceCode.getFirstToken(node);
|
29834
|
+
checkSpacingBefore(firstToken, PREV_TOKEN_M);
|
29835
|
+
checkSpacingAfter(firstToken, NEXT_TOKEN_M);
|
29836
|
+
|
29837
|
+
if (node.source) {
|
29838
|
+
var fromToken = sourceCode.getTokenBefore(node.source);
|
29839
|
+
checkSpacingBefore(fromToken, PREV_TOKEN_M);
|
29840
|
+
checkSpacingAfter(fromToken, NEXT_TOKEN_M);
|
29841
|
+
}
|
29842
|
+
}
|
29843
|
+
|
29844
|
+
/**
|
29845
|
+
* Reports `as` keyword of a given node if usage of spacing around this
|
29846
|
+
* keyword is invalid.
|
29847
|
+
*
|
29848
|
+
* @param {ASTNode} node - A node to report.
|
29849
|
+
* @returns {void}
|
29850
|
+
*/
|
29851
|
+
function checkSpacingForImportNamespaceSpecifier(node) {
|
29852
|
+
var asToken = sourceCode.getFirstToken(node, 1);
|
29853
|
+
checkSpacingBefore(asToken, PREV_TOKEN_M);
|
29854
|
+
}
|
29855
|
+
|
29856
|
+
/**
|
29857
|
+
* Reports `static`, `get`, and `set` keywords of a given node if usage of
|
29858
|
+
* spacing around those keywords is invalid.
|
29859
|
+
*
|
29860
|
+
* @param {ASTNode} node - A node to report.
|
29861
|
+
* @returns {void}
|
29862
|
+
*/
|
29863
|
+
function checkSpacingForProperty(node) {
|
29864
|
+
if (node.static) {
|
29865
|
+
checkSpacingAroundFirstToken(node);
|
29866
|
+
}
|
29867
|
+
if (node.kind === "get" || node.kind === "set") {
|
29868
|
+
var token = sourceCode.getFirstToken(
|
29869
|
+
node,
|
29870
|
+
node.static ? 1 : 0
|
29871
|
+
);
|
29872
|
+
checkSpacingAround(token);
|
29873
|
+
}
|
29874
|
+
}
|
29875
|
+
|
29876
|
+
return {
|
29877
|
+
// Statements
|
29878
|
+
DebuggerStatement: checkSpacingAroundFirstToken,
|
29879
|
+
WithStatement: checkSpacingAroundFirstToken,
|
29880
|
+
|
29881
|
+
// Statements - Control flow
|
29882
|
+
BreakStatement: checkSpacingAroundFirstToken,
|
29883
|
+
ContinueStatement: checkSpacingAroundFirstToken,
|
29884
|
+
ReturnStatement: checkSpacingAroundFirstToken,
|
29885
|
+
ThrowStatement: checkSpacingAroundFirstToken,
|
29886
|
+
TryStatement: checkSpacingForTryStatement,
|
29887
|
+
|
29888
|
+
// Statements - Choice
|
29889
|
+
IfStatement: checkSpacingForIfStatement,
|
29890
|
+
SwitchStatement: checkSpacingAroundFirstToken,
|
29891
|
+
SwitchCase: checkSpacingAroundFirstToken,
|
29892
|
+
|
29893
|
+
// Statements - Loops
|
29894
|
+
DoWhileStatement: checkSpacingForDoWhileStatement,
|
29895
|
+
ForInStatement: checkSpacingForForInStatement,
|
29896
|
+
ForOfStatement: checkSpacingForForOfStatement,
|
29897
|
+
ForStatement: checkSpacingAroundFirstToken,
|
29898
|
+
WhileStatement: checkSpacingAroundFirstToken,
|
29899
|
+
|
29900
|
+
// Statements - Declarations
|
29901
|
+
ClassDeclaration: checkSpacingForClass,
|
29902
|
+
ExportNamedDeclaration: checkSpacingForModuleDeclaration,
|
29903
|
+
ExportDefaultDeclaration: checkSpacingAroundFirstToken,
|
29904
|
+
ExportAllDeclaration: checkSpacingForModuleDeclaration,
|
29905
|
+
FunctionDeclaration: checkSpacingBeforeFirstToken,
|
29906
|
+
ImportDeclaration: checkSpacingForModuleDeclaration,
|
29907
|
+
VariableDeclaration: checkSpacingAroundFirstToken,
|
29908
|
+
|
29909
|
+
// Expressions
|
29910
|
+
ClassExpression: checkSpacingForClass,
|
29911
|
+
FunctionExpression: checkSpacingBeforeFirstToken,
|
29912
|
+
NewExpression: checkSpacingBeforeFirstToken,
|
29913
|
+
Super: checkSpacingBeforeFirstToken,
|
29914
|
+
ThisExpression: checkSpacingBeforeFirstToken,
|
29915
|
+
UnaryExpression: checkSpacingBeforeFirstToken,
|
29916
|
+
YieldExpression: checkSpacingBeforeFirstToken,
|
29917
|
+
|
29918
|
+
// Others
|
29919
|
+
ImportNamespaceSpecifier: checkSpacingForImportNamespaceSpecifier,
|
29920
|
+
MethodDefinition: checkSpacingForProperty,
|
29921
|
+
Property: checkSpacingForProperty
|
29922
|
+
};
|
29923
|
+
};
|
29924
|
+
|
29925
|
+
module.exports.schema = [
|
29926
|
+
{
|
29927
|
+
"type": "object",
|
29928
|
+
"properties": {
|
29929
|
+
"before": {"type": "boolean"},
|
29930
|
+
"after": {"type": "boolean"},
|
29931
|
+
"overrides": {
|
29932
|
+
"type": "object",
|
29933
|
+
"properties": KEYS.reduce(function(retv, key) {
|
29934
|
+
retv[key] = {
|
29935
|
+
"type": "object",
|
29936
|
+
"properties": {
|
29937
|
+
"before": {"type": "boolean"},
|
29938
|
+
"after": {"type": "boolean"}
|
29939
|
+
},
|
29940
|
+
"additionalProperties": false
|
29941
|
+
};
|
29942
|
+
return retv;
|
29943
|
+
}, {}),
|
29944
|
+
"additionalProperties": false
|
29945
|
+
}
|
29946
|
+
},
|
29947
|
+
"additionalProperties": false
|
29948
|
+
}
|
29949
|
+
];
|
29950
|
+
|
29951
|
+
},{"../ast-utils":152,"../util/keywords":372}],204:[function(require,module,exports){
|
29366
29952
|
/**
|
29367
29953
|
* @fileoverview Rule to forbid mixing LF and LFCR line breaks.
|
29368
29954
|
* @author Erik Mueller
|
@@ -29443,7 +30029,7 @@ module.exports.schema = [
|
|
29443
30029
|
}
|
29444
30030
|
];
|
29445
30031
|
|
29446
|
-
},{}],
|
30032
|
+
},{}],205:[function(require,module,exports){
|
29447
30033
|
/**
|
29448
30034
|
* @fileoverview Enforces empty lines around comments.
|
29449
30035
|
* @author Jamund Ferguson
|
@@ -29779,7 +30365,7 @@ module.exports.schema = [
|
|
29779
30365
|
}
|
29780
30366
|
];
|
29781
30367
|
|
29782
|
-
},{"object-assign":151}],
|
30368
|
+
},{"object-assign":151}],206:[function(require,module,exports){
|
29783
30369
|
/**
|
29784
30370
|
* @fileoverview A rule to set the maximum depth block can be nested in a function.
|
29785
30371
|
* @author Ian Christian Myers
|
@@ -29891,7 +30477,7 @@ module.exports.schema = [
|
|
29891
30477
|
}
|
29892
30478
|
];
|
29893
30479
|
|
29894
|
-
},{}],
|
30480
|
+
},{}],207:[function(require,module,exports){
|
29895
30481
|
/**
|
29896
30482
|
* @fileoverview Rule to check for max length on a line.
|
29897
30483
|
* @author Matt DuVall <http://www.mattduvall.com>
|
@@ -30113,7 +30699,7 @@ module.exports.schema = [
|
|
30113
30699
|
OPTIONS_SCHEMA
|
30114
30700
|
];
|
30115
30701
|
|
30116
|
-
},{}],
|
30702
|
+
},{}],208:[function(require,module,exports){
|
30117
30703
|
/**
|
30118
30704
|
* @fileoverview Rule to enforce a maximum number of nested callbacks.
|
30119
30705
|
* @author Ian Christian Myers
|
@@ -30188,7 +30774,7 @@ module.exports.schema = [
|
|
30188
30774
|
}
|
30189
30775
|
];
|
30190
30776
|
|
30191
|
-
},{}],
|
30777
|
+
},{}],209:[function(require,module,exports){
|
30192
30778
|
/**
|
30193
30779
|
* @fileoverview Rule to flag when a function has too many parameters
|
30194
30780
|
* @author Ilya Volodin
|
@@ -30235,7 +30821,7 @@ module.exports.schema = [
|
|
30235
30821
|
}
|
30236
30822
|
];
|
30237
30823
|
|
30238
|
-
},{}],
|
30824
|
+
},{}],210:[function(require,module,exports){
|
30239
30825
|
/**
|
30240
30826
|
* @fileoverview A rule to set the maximum number of statements in a function.
|
30241
30827
|
* @author Ian Christian Myers
|
@@ -30255,7 +30841,26 @@ module.exports = function(context) {
|
|
30255
30841
|
//--------------------------------------------------------------------------
|
30256
30842
|
|
30257
30843
|
var functionStack = [],
|
30258
|
-
maxStatements = context.options[0] || 10
|
30844
|
+
maxStatements = context.options[0] || 10,
|
30845
|
+
ignoreTopLevelFunctions = context.options[1] && context.options[1].ignoreTopLevelFunctions || false,
|
30846
|
+
topLevelFunctions = [];
|
30847
|
+
|
30848
|
+
/**
|
30849
|
+
* Reports a node if it has too many statements
|
30850
|
+
* @param {ASTNode} node node to evaluate
|
30851
|
+
* @param {int} count Number of statements in node
|
30852
|
+
* @param {int} max Maximum number of statements allowed
|
30853
|
+
* @returns {void}
|
30854
|
+
* @private
|
30855
|
+
*/
|
30856
|
+
function reportIfTooManyStatements(node, count, max) {
|
30857
|
+
if (count > max) {
|
30858
|
+
context.report(
|
30859
|
+
node,
|
30860
|
+
"This function has too many statements ({{count}}). Maximum allowed is {{max}}.",
|
30861
|
+
{ count: count, max: max });
|
30862
|
+
}
|
30863
|
+
}
|
30259
30864
|
|
30260
30865
|
/**
|
30261
30866
|
* When parsing a new function, store it in our function stack
|
@@ -30274,10 +30879,10 @@ module.exports = function(context) {
|
|
30274
30879
|
*/
|
30275
30880
|
function endFunction(node) {
|
30276
30881
|
var count = functionStack.pop();
|
30277
|
-
|
30278
|
-
|
30279
|
-
|
30280
|
-
|
30882
|
+
if (ignoreTopLevelFunctions && functionStack.length === 0) {
|
30883
|
+
topLevelFunctions.push({ node: node, count: count});
|
30884
|
+
} else {
|
30885
|
+
reportIfTooManyStatements(node, count, maxStatements);
|
30281
30886
|
}
|
30282
30887
|
}
|
30283
30888
|
|
@@ -30304,7 +30909,19 @@ module.exports = function(context) {
|
|
30304
30909
|
|
30305
30910
|
"FunctionDeclaration:exit": endFunction,
|
30306
30911
|
"FunctionExpression:exit": endFunction,
|
30307
|
-
"ArrowFunctionExpression:exit": endFunction
|
30912
|
+
"ArrowFunctionExpression:exit": endFunction,
|
30913
|
+
|
30914
|
+
"Program:exit": function() {
|
30915
|
+
if (topLevelFunctions.length === 1) {
|
30916
|
+
return;
|
30917
|
+
}
|
30918
|
+
|
30919
|
+
topLevelFunctions.forEach(function(element) {
|
30920
|
+
var count = element.count;
|
30921
|
+
var node = element.node;
|
30922
|
+
reportIfTooManyStatements(node, count, maxStatements);
|
30923
|
+
});
|
30924
|
+
}
|
30308
30925
|
};
|
30309
30926
|
|
30310
30927
|
};
|
@@ -30312,10 +30929,19 @@ module.exports = function(context) {
|
|
30312
30929
|
module.exports.schema = [
|
30313
30930
|
{
|
30314
30931
|
"type": "integer"
|
30932
|
+
},
|
30933
|
+
{
|
30934
|
+
"type": "object",
|
30935
|
+
"properties": {
|
30936
|
+
"ignoreTopLevelFunctions": {
|
30937
|
+
"type": "boolean"
|
30938
|
+
}
|
30939
|
+
},
|
30940
|
+
"additionalProperties": false
|
30315
30941
|
}
|
30316
30942
|
];
|
30317
30943
|
|
30318
|
-
},{}],
|
30944
|
+
},{}],211:[function(require,module,exports){
|
30319
30945
|
/**
|
30320
30946
|
* @fileoverview Rule to flag use of constructors without capital letters
|
30321
30947
|
* @author Nicholas C. Zakas
|
@@ -30558,7 +31184,7 @@ module.exports.schema = [
|
|
30558
31184
|
}
|
30559
31185
|
];
|
30560
31186
|
|
30561
|
-
},{"object-assign":151}],
|
31187
|
+
},{"object-assign":151}],212:[function(require,module,exports){
|
30562
31188
|
/**
|
30563
31189
|
* @fileoverview Rule to flag when using constructor without parentheses
|
30564
31190
|
* @author Ilya Volodin
|
@@ -30589,7 +31215,7 @@ module.exports = function(context) {
|
|
30589
31215
|
|
30590
31216
|
module.exports.schema = [];
|
30591
31217
|
|
30592
|
-
},{}],
|
31218
|
+
},{}],213:[function(require,module,exports){
|
30593
31219
|
/**
|
30594
31220
|
* @fileoverview Rule to check empty newline after "var" statement
|
30595
31221
|
* @author Gopal Venkatesan
|
@@ -30767,7 +31393,7 @@ module.exports.schema = [
|
|
30767
31393
|
}
|
30768
31394
|
];
|
30769
31395
|
|
30770
|
-
},{}],
|
31396
|
+
},{}],214:[function(require,module,exports){
|
30771
31397
|
/**
|
30772
31398
|
* @fileoverview Rule to flag use of alert, confirm, prompt
|
30773
31399
|
* @author Nicholas C. Zakas
|
@@ -30904,7 +31530,7 @@ module.exports = function(context) {
|
|
30904
31530
|
|
30905
31531
|
module.exports.schema = [];
|
30906
31532
|
|
30907
|
-
},{}],
|
31533
|
+
},{}],215:[function(require,module,exports){
|
30908
31534
|
/**
|
30909
31535
|
* @fileoverview Disallow construction of dense arrays using the Array constructor
|
30910
31536
|
* @author Matt DuVall <http://www.mattduvall.com/>
|
@@ -30943,7 +31569,7 @@ module.exports = function(context) {
|
|
30943
31569
|
|
30944
31570
|
module.exports.schema = [];
|
30945
31571
|
|
30946
|
-
},{}],
|
31572
|
+
},{}],216:[function(require,module,exports){
|
30947
31573
|
/**
|
30948
31574
|
* @fileoverview A rule to warn against using arrow functions in conditions.
|
30949
31575
|
* @author Jxck <https://github.com/Jxck>
|
@@ -31007,7 +31633,7 @@ module.exports = function(context) {
|
|
31007
31633
|
*/
|
31008
31634
|
function checkCondition(node) {
|
31009
31635
|
if (isArrowFunction(node)) {
|
31010
|
-
context.report(node, "Arrow function
|
31636
|
+
context.report(node, "Arrow function '=>' used inside {{statementType}} instead of comparison operator.", {statementType: node.type});
|
31011
31637
|
}
|
31012
31638
|
}
|
31013
31639
|
|
@@ -31033,7 +31659,7 @@ module.exports = function(context) {
|
|
31033
31659
|
|
31034
31660
|
module.exports.schema = [];
|
31035
31661
|
|
31036
|
-
},{}],
|
31662
|
+
},{}],217:[function(require,module,exports){
|
31037
31663
|
/**
|
31038
31664
|
* @fileoverview Rule to flag bitwise identifiers
|
31039
31665
|
* @author Nicholas C. Zakas
|
@@ -31041,17 +31667,22 @@ module.exports.schema = [];
|
|
31041
31667
|
|
31042
31668
|
"use strict";
|
31043
31669
|
|
31670
|
+
//
|
31671
|
+
// Set of bitwise operators.
|
31672
|
+
//
|
31673
|
+
var BITWISE_OPERATORS = [
|
31674
|
+
"^", "|", "&", "<<", ">>", ">>>",
|
31675
|
+
"^=", "|=", "&=", "<<=", ">>=", ">>>=",
|
31676
|
+
"~"
|
31677
|
+
];
|
31678
|
+
|
31044
31679
|
//------------------------------------------------------------------------------
|
31045
31680
|
// Rule Definition
|
31046
31681
|
//------------------------------------------------------------------------------
|
31047
31682
|
|
31048
31683
|
module.exports = function(context) {
|
31049
|
-
|
31050
|
-
var
|
31051
|
-
"^", "|", "&", "<<", ">>", ">>>",
|
31052
|
-
"^=", "|=", "&=", "<<=", ">>=", ">>>=",
|
31053
|
-
"~"
|
31054
|
-
];
|
31684
|
+
var options = context.options[0] || {};
|
31685
|
+
var allowed = options.allow || [];
|
31055
31686
|
|
31056
31687
|
/**
|
31057
31688
|
* Reports an unexpected use of a bitwise operator.
|
@@ -31071,13 +31702,22 @@ module.exports = function(context) {
|
|
31071
31702
|
return BITWISE_OPERATORS.indexOf(node.operator) !== -1;
|
31072
31703
|
}
|
31073
31704
|
|
31705
|
+
/**
|
31706
|
+
* Checks if exceptions were provided, e.g. `{ allow: ['~', '|'] }`.
|
31707
|
+
* @param {ASTNode} node The node to check.
|
31708
|
+
* @returns {boolean} Whether or not the node has a bitwise operator.
|
31709
|
+
*/
|
31710
|
+
function allowedOperator(node) {
|
31711
|
+
return allowed.indexOf(node.operator) !== -1;
|
31712
|
+
}
|
31713
|
+
|
31074
31714
|
/**
|
31075
31715
|
* Report if the given node contains a bitwise operator.
|
31076
|
-
* @param
|
31716
|
+
* @param {ASTNode} node The node to check.
|
31077
31717
|
* @returns {void}
|
31078
31718
|
*/
|
31079
31719
|
function checkNodeForBitwiseOperator(node) {
|
31080
|
-
if (hasBitwiseOperator(node)) {
|
31720
|
+
if (hasBitwiseOperator(node) && !allowedOperator(node)) {
|
31081
31721
|
report(node);
|
31082
31722
|
}
|
31083
31723
|
}
|
@@ -31090,9 +31730,23 @@ module.exports = function(context) {
|
|
31090
31730
|
|
31091
31731
|
};
|
31092
31732
|
|
31093
|
-
module.exports.schema = [
|
31733
|
+
module.exports.schema = [
|
31734
|
+
{
|
31735
|
+
"type": "object",
|
31736
|
+
"properties": {
|
31737
|
+
"allow": {
|
31738
|
+
"type": "array",
|
31739
|
+
"items": {
|
31740
|
+
"enum": BITWISE_OPERATORS
|
31741
|
+
},
|
31742
|
+
"uniqueItems": true
|
31743
|
+
}
|
31744
|
+
},
|
31745
|
+
"additionalProperties": false
|
31746
|
+
}
|
31747
|
+
];
|
31094
31748
|
|
31095
|
-
},{}],
|
31749
|
+
},{}],218:[function(require,module,exports){
|
31096
31750
|
/**
|
31097
31751
|
* @fileoverview Rule to flag use of arguments.callee and arguments.caller.
|
31098
31752
|
* @author Nicholas C. Zakas
|
@@ -31123,7 +31777,7 @@ module.exports = function(context) {
|
|
31123
31777
|
|
31124
31778
|
module.exports.schema = [];
|
31125
31779
|
|
31126
|
-
},{}],
|
31780
|
+
},{}],219:[function(require,module,exports){
|
31127
31781
|
/**
|
31128
31782
|
* @fileoverview Rule to flag use of an lexical declarations inside a case clause
|
31129
31783
|
* @author Erik Arvidsson
|
@@ -31172,7 +31826,7 @@ module.exports = function(context) {
|
|
31172
31826
|
|
31173
31827
|
module.exports.schema = [];
|
31174
31828
|
|
31175
|
-
},{}],
|
31829
|
+
},{}],220:[function(require,module,exports){
|
31176
31830
|
/**
|
31177
31831
|
* @fileoverview Rule to flag variable leak in CatchClauses in IE 8 and earlier
|
31178
31832
|
* @author Ian Christian Myers
|
@@ -31232,7 +31886,7 @@ module.exports = function(context) {
|
|
31232
31886
|
|
31233
31887
|
module.exports.schema = [];
|
31234
31888
|
|
31235
|
-
},{"../ast-utils":152}],
|
31889
|
+
},{"../ast-utils":152}],221:[function(require,module,exports){
|
31236
31890
|
/**
|
31237
31891
|
* @fileoverview A rule to disallow modifying variables of class declarations
|
31238
31892
|
* @author Toru Nagashima
|
@@ -31258,7 +31912,7 @@ module.exports = function(context) {
|
|
31258
31912
|
astUtils.getModifyingReferences(variable.references).forEach(function(reference) {
|
31259
31913
|
context.report(
|
31260
31914
|
reference.identifier,
|
31261
|
-
"
|
31915
|
+
"'{{name}}' is a class.",
|
31262
31916
|
{name: reference.identifier.name});
|
31263
31917
|
|
31264
31918
|
});
|
@@ -31282,7 +31936,7 @@ module.exports = function(context) {
|
|
31282
31936
|
|
31283
31937
|
module.exports.schema = [];
|
31284
31938
|
|
31285
|
-
},{"../ast-utils":152}],
|
31939
|
+
},{"../ast-utils":152}],222:[function(require,module,exports){
|
31286
31940
|
/**
|
31287
31941
|
* @fileoverview Rule to flag assignment in a conditional statement's test expression
|
31288
31942
|
* @author Stephen Murray <spmurrayzzz>
|
@@ -31417,7 +32071,7 @@ module.exports.schema = [
|
|
31417
32071
|
}
|
31418
32072
|
];
|
31419
32073
|
|
31420
|
-
},{}],
|
32074
|
+
},{}],223:[function(require,module,exports){
|
31421
32075
|
/**
|
31422
32076
|
* @fileoverview A rule to warn against using arrow functions when they could be
|
31423
32077
|
* confused with comparisions
|
@@ -31484,7 +32138,7 @@ module.exports = function(context) {
|
|
31484
32138
|
|
31485
32139
|
module.exports.schema = [];
|
31486
32140
|
|
31487
|
-
},{}],
|
32141
|
+
},{}],224:[function(require,module,exports){
|
31488
32142
|
/**
|
31489
32143
|
* @fileoverview Rule to flag use of console object
|
31490
32144
|
* @author Nicholas C. Zakas
|
@@ -31513,7 +32167,7 @@ module.exports = function(context) {
|
|
31513
32167
|
|
31514
32168
|
module.exports.schema = [];
|
31515
32169
|
|
31516
|
-
},{}],
|
32170
|
+
},{}],225:[function(require,module,exports){
|
31517
32171
|
/**
|
31518
32172
|
* @fileoverview A rule to disallow modifying variables that are declared using `const`
|
31519
32173
|
* @author Toru Nagashima
|
@@ -31539,7 +32193,7 @@ module.exports = function(context) {
|
|
31539
32193
|
astUtils.getModifyingReferences(variable.references).forEach(function(reference) {
|
31540
32194
|
context.report(
|
31541
32195
|
reference.identifier,
|
31542
|
-
"
|
32196
|
+
"'{{name}}' is constant.",
|
31543
32197
|
{name: reference.identifier.name});
|
31544
32198
|
});
|
31545
32199
|
}
|
@@ -31556,7 +32210,7 @@ module.exports = function(context) {
|
|
31556
32210
|
|
31557
32211
|
module.exports.schema = [];
|
31558
32212
|
|
31559
|
-
},{"../ast-utils":152}],
|
32213
|
+
},{"../ast-utils":152}],226:[function(require,module,exports){
|
31560
32214
|
/**
|
31561
32215
|
* @fileoverview Rule to flag use constant conditions
|
31562
32216
|
* @author Christian Schulz <http://rndm.de>
|
@@ -31631,7 +32285,7 @@ module.exports = function(context) {
|
|
31631
32285
|
|
31632
32286
|
module.exports.schema = [];
|
31633
32287
|
|
31634
|
-
},{}],
|
32288
|
+
},{}],227:[function(require,module,exports){
|
31635
32289
|
/**
|
31636
32290
|
* @fileoverview Rule to flag use of continue statement
|
31637
32291
|
* @author Borislav Zhivkov
|
@@ -31656,7 +32310,7 @@ module.exports = function(context) {
|
|
31656
32310
|
|
31657
32311
|
module.exports.schema = [];
|
31658
32312
|
|
31659
|
-
},{}],
|
32313
|
+
},{}],228:[function(require,module,exports){
|
31660
32314
|
/**
|
31661
32315
|
* @fileoverview Rule to forbid control charactes from regular expressions.
|
31662
32316
|
* @author Nicholas C. Zakas
|
@@ -31715,7 +32369,7 @@ module.exports = function(context) {
|
|
31715
32369
|
|
31716
32370
|
module.exports.schema = [];
|
31717
32371
|
|
31718
|
-
},{}],
|
32372
|
+
},{}],229:[function(require,module,exports){
|
31719
32373
|
/**
|
31720
32374
|
* @fileoverview Rule to flag use of a debugger statement
|
31721
32375
|
* @author Nicholas C. Zakas
|
@@ -31739,7 +32393,7 @@ module.exports = function(context) {
|
|
31739
32393
|
|
31740
32394
|
module.exports.schema = [];
|
31741
32395
|
|
31742
|
-
},{}],
|
32396
|
+
},{}],230:[function(require,module,exports){
|
31743
32397
|
/**
|
31744
32398
|
* @fileoverview Rule to flag when deleting variables
|
31745
32399
|
* @author Ilya Volodin
|
@@ -31766,7 +32420,7 @@ module.exports = function(context) {
|
|
31766
32420
|
|
31767
32421
|
module.exports.schema = [];
|
31768
32422
|
|
31769
|
-
},{}],
|
32423
|
+
},{}],231:[function(require,module,exports){
|
31770
32424
|
/**
|
31771
32425
|
* @fileoverview Rule to check for ambiguous div operator in regexes
|
31772
32426
|
* @author Matt DuVall <http://www.mattduvall.com>
|
@@ -31795,7 +32449,7 @@ module.exports = function(context) {
|
|
31795
32449
|
|
31796
32450
|
module.exports.schema = [];
|
31797
32451
|
|
31798
|
-
},{}],
|
32452
|
+
},{}],232:[function(require,module,exports){
|
31799
32453
|
/**
|
31800
32454
|
* @fileoverview Rule to flag duplicate arguments
|
31801
32455
|
* @author Jamund Ferguson
|
@@ -31870,7 +32524,7 @@ module.exports = function(context) {
|
|
31870
32524
|
|
31871
32525
|
module.exports.schema = [];
|
31872
32526
|
|
31873
|
-
},{}],
|
32527
|
+
},{}],233:[function(require,module,exports){
|
31874
32528
|
/**
|
31875
32529
|
* @fileoverview A rule to disallow duplicate name in class members.
|
31876
32530
|
* @author Toru Nagashima
|
@@ -31946,7 +32600,7 @@ module.exports = function(context) {
|
|
31946
32600
|
}
|
31947
32601
|
|
31948
32602
|
if (isDuplicate) {
|
31949
|
-
context.report(node, "Duplicate name
|
32603
|
+
context.report(node, "Duplicate name '{{name}}'.", {name: name});
|
31950
32604
|
}
|
31951
32605
|
}
|
31952
32606
|
};
|
@@ -31954,7 +32608,7 @@ module.exports = function(context) {
|
|
31954
32608
|
|
31955
32609
|
module.exports.schema = [];
|
31956
32610
|
|
31957
|
-
},{}],
|
32611
|
+
},{}],234:[function(require,module,exports){
|
31958
32612
|
/**
|
31959
32613
|
* @fileoverview Rule to flag use of duplicate keys in an object.
|
31960
32614
|
* @author Ian Christian Myers
|
@@ -32004,7 +32658,7 @@ module.exports = function(context) {
|
|
32004
32658
|
|
32005
32659
|
module.exports.schema = [];
|
32006
32660
|
|
32007
|
-
},{}],
|
32661
|
+
},{}],235:[function(require,module,exports){
|
32008
32662
|
/**
|
32009
32663
|
* @fileoverview Rule to disallow a duplicate case label.
|
32010
32664
|
* @author Dieter Oberkofler
|
@@ -32039,7 +32693,7 @@ module.exports = function(context) {
|
|
32039
32693
|
|
32040
32694
|
module.exports.schema = [];
|
32041
32695
|
|
32042
|
-
},{}],
|
32696
|
+
},{}],236:[function(require,module,exports){
|
32043
32697
|
/**
|
32044
32698
|
* @fileoverview Rule to flag `else` after a `return` in `if`
|
32045
32699
|
* @author Ian Christian Myers
|
@@ -32185,7 +32839,7 @@ module.exports = function(context) {
|
|
32185
32839
|
|
32186
32840
|
module.exports.schema = [];
|
32187
32841
|
|
32188
|
-
},{}],
|
32842
|
+
},{}],237:[function(require,module,exports){
|
32189
32843
|
/**
|
32190
32844
|
* @fileoverview Rule to flag the use of empty character classes in regular expressions
|
32191
32845
|
* @author Ian Christian Myers
|
@@ -32232,7 +32886,7 @@ module.exports = function(context) {
|
|
32232
32886
|
|
32233
32887
|
module.exports.schema = [];
|
32234
32888
|
|
32235
|
-
},{}],
|
32889
|
+
},{}],238:[function(require,module,exports){
|
32236
32890
|
/**
|
32237
32891
|
* @fileoverview Rule to flag when label is not used for a loop or switch
|
32238
32892
|
* @author Ilya Volodin
|
@@ -32252,7 +32906,7 @@ module.exports = function(context) {
|
|
32252
32906
|
var type = node.body.type;
|
32253
32907
|
|
32254
32908
|
if (type !== "ForStatement" && type !== "WhileStatement" && type !== "DoWhileStatement" && type !== "SwitchStatement" && type !== "ForInStatement" && type !== "ForOfStatement") {
|
32255
|
-
context.report(node, "Unexpected label
|
32909
|
+
context.report(node, "Unexpected label '{{l}}'", {l: node.label.name});
|
32256
32910
|
}
|
32257
32911
|
}
|
32258
32912
|
};
|
@@ -32261,7 +32915,7 @@ module.exports = function(context) {
|
|
32261
32915
|
|
32262
32916
|
module.exports.schema = [];
|
32263
32917
|
|
32264
|
-
},{}],
|
32918
|
+
},{}],239:[function(require,module,exports){
|
32265
32919
|
/**
|
32266
32920
|
* @fileoverview Rule to disallow an empty pattern
|
32267
32921
|
* @author Alberto Rodríguez
|
@@ -32291,7 +32945,7 @@ module.exports = function(context) {
|
|
32291
32945
|
|
32292
32946
|
module.exports.schema = [];
|
32293
32947
|
|
32294
|
-
},{}],
|
32948
|
+
},{}],240:[function(require,module,exports){
|
32295
32949
|
/**
|
32296
32950
|
* @fileoverview Rule to flag use of an empty block statement
|
32297
32951
|
* @author Nicholas C. Zakas
|
@@ -32359,7 +33013,7 @@ module.exports.schema = [
|
|
32359
33013
|
}
|
32360
33014
|
];
|
32361
33015
|
|
32362
|
-
},{}],
|
33016
|
+
},{}],241:[function(require,module,exports){
|
32363
33017
|
/**
|
32364
33018
|
* @fileoverview Rule to flag comparisons to null without a type-checking
|
32365
33019
|
* operator.
|
@@ -32390,7 +33044,7 @@ module.exports = function(context) {
|
|
32390
33044
|
|
32391
33045
|
module.exports.schema = [];
|
32392
33046
|
|
32393
|
-
},{}],
|
33047
|
+
},{}],242:[function(require,module,exports){
|
32394
33048
|
/**
|
32395
33049
|
* @fileoverview Rule to flag use of eval() statement
|
32396
33050
|
* @author Nicholas C. Zakas
|
@@ -32683,7 +33337,7 @@ module.exports.schema = [
|
|
32683
33337
|
}
|
32684
33338
|
];
|
32685
33339
|
|
32686
|
-
},{"../ast-utils":152}],
|
33340
|
+
},{"../ast-utils":152}],243:[function(require,module,exports){
|
32687
33341
|
/**
|
32688
33342
|
* @fileoverview Rule to flag assignment of the exception parameter
|
32689
33343
|
* @author Stephen Murray <spmurrayzzz>
|
@@ -32722,7 +33376,7 @@ module.exports = function(context) {
|
|
32722
33376
|
|
32723
33377
|
module.exports.schema = [];
|
32724
33378
|
|
32725
|
-
},{"../ast-utils":152}],
|
33379
|
+
},{"../ast-utils":152}],244:[function(require,module,exports){
|
32726
33380
|
/**
|
32727
33381
|
* @fileoverview Rule to flag adding properties to native object's prototypes.
|
32728
33382
|
* @author David Nelson
|
@@ -32824,7 +33478,7 @@ module.exports.schema = [
|
|
32824
33478
|
}
|
32825
33479
|
];
|
32826
33480
|
|
32827
|
-
},{"globals":143}],
|
33481
|
+
},{"globals":143}],245:[function(require,module,exports){
|
32828
33482
|
/**
|
32829
33483
|
* @fileoverview Rule to flag unnecessary bind calls
|
32830
33484
|
* @author Bence Dányi <bence@danyi.me>
|
@@ -32887,8 +33541,10 @@ module.exports = function(context) {
|
|
32887
33541
|
var top = getTopScope(),
|
32888
33542
|
isArrowFunction = node.callee.type === "MemberExpression" && node.callee.object.type === "ArrowFunctionExpression";
|
32889
33543
|
|
32890
|
-
if (top.call === node
|
32891
|
-
|
33544
|
+
if (top.call === node) {
|
33545
|
+
if (top.found === 0 || isArrowFunction) {
|
33546
|
+
context.report(node, "The function binding is unnecessary.");
|
33547
|
+
}
|
32892
33548
|
scope.pop();
|
32893
33549
|
}
|
32894
33550
|
},
|
@@ -32910,7 +33566,7 @@ module.exports = function(context) {
|
|
32910
33566
|
|
32911
33567
|
module.exports.schema = [];
|
32912
33568
|
|
32913
|
-
},{}],
|
33569
|
+
},{}],246:[function(require,module,exports){
|
32914
33570
|
/**
|
32915
33571
|
* @fileoverview Rule to flag unnecessary double negation in Boolean contexts
|
32916
33572
|
* @author Brandon Mills
|
@@ -32983,7 +33639,7 @@ module.exports = function(context) {
|
|
32983
33639
|
|
32984
33640
|
module.exports.schema = [];
|
32985
33641
|
|
32986
|
-
},{}],
|
33642
|
+
},{}],247:[function(require,module,exports){
|
32987
33643
|
/**
|
32988
33644
|
* @fileoverview Disallow parenthesising higher precedence subexpressions.
|
32989
33645
|
* @author Michael Ficarra
|
@@ -33334,25 +33990,21 @@ module.exports = function(context) {
|
|
33334
33990
|
}
|
33335
33991
|
},
|
33336
33992
|
"ExpressionStatement": function(node) {
|
33337
|
-
var firstToken;
|
33993
|
+
var firstToken, secondToken, firstTokens;
|
33338
33994
|
if (hasExcessParens(node.expression)) {
|
33339
|
-
|
33340
|
-
|
33341
|
-
|
33342
|
-
|
33343
|
-
if (
|
33344
|
-
|
33345
|
-
|
33346
|
-
|
33347
|
-
|
33348
|
-
(
|
33349
|
-
firstToken.value !== "function" ||
|
33350
|
-
node.expression.type === "FunctionExpression"
|
33351
|
-
) &&
|
33352
|
-
// For such as `(class{}.foo.bar)`
|
33995
|
+
firstTokens = context.getFirstTokens(node.expression, 2);
|
33996
|
+
firstToken = firstTokens[0];
|
33997
|
+
secondToken = firstTokens[1];
|
33998
|
+
|
33999
|
+
if (
|
34000
|
+
!firstToken ||
|
34001
|
+
firstToken.value !== "{" &&
|
34002
|
+
firstToken.value !== "function" &&
|
34003
|
+
firstToken.value !== "class" &&
|
33353
34004
|
(
|
33354
|
-
firstToken.value !== "
|
33355
|
-
|
34005
|
+
firstToken.value !== "let" ||
|
34006
|
+
!secondToken ||
|
34007
|
+
secondToken.value !== "["
|
33356
34008
|
)
|
33357
34009
|
) {
|
33358
34010
|
report(node.expression);
|
@@ -33501,7 +34153,7 @@ module.exports.schema = [
|
|
33501
34153
|
}
|
33502
34154
|
];
|
33503
34155
|
|
33504
|
-
},{}],
|
34156
|
+
},{}],248:[function(require,module,exports){
|
33505
34157
|
/**
|
33506
34158
|
* @fileoverview Rule to flag use of unnecessary semicolons
|
33507
34159
|
* @author Nicholas C. Zakas
|
@@ -33586,7 +34238,7 @@ module.exports = function(context) {
|
|
33586
34238
|
|
33587
34239
|
module.exports.schema = [];
|
33588
34240
|
|
33589
|
-
},{}],
|
34241
|
+
},{}],249:[function(require,module,exports){
|
33590
34242
|
/**
|
33591
34243
|
* @fileoverview Rule to flag fall-through cases in switch statements.
|
33592
34244
|
* @author Matt DuVall <http://mattduvall.com/>
|
@@ -33651,7 +34303,7 @@ module.exports = function(context) {
|
|
33651
34303
|
// And reports the previous fallthrough node if that does not exist.
|
33652
34304
|
if (fallthroughCase && !hasFallthroughComment(node, context)) {
|
33653
34305
|
context.report({
|
33654
|
-
message: "Expected a
|
34306
|
+
message: "Expected a 'break' statement before '{{type}}'.",
|
33655
34307
|
data: {type: node.test ? "case" : "default"},
|
33656
34308
|
node: node
|
33657
34309
|
});
|
@@ -33675,7 +34327,7 @@ module.exports = function(context) {
|
|
33675
34327
|
|
33676
34328
|
module.exports.schema = [];
|
33677
34329
|
|
33678
|
-
},{"../util":
|
34330
|
+
},{"../util":369}],250:[function(require,module,exports){
|
33679
34331
|
/**
|
33680
34332
|
* @fileoverview Rule to flag use of a leading/trailing decimal point in a numeric literal
|
33681
34333
|
* @author James Allardice
|
@@ -33707,7 +34359,7 @@ module.exports = function(context) {
|
|
33707
34359
|
|
33708
34360
|
module.exports.schema = [];
|
33709
34361
|
|
33710
|
-
},{}],
|
34362
|
+
},{}],251:[function(require,module,exports){
|
33711
34363
|
/**
|
33712
34364
|
* @fileoverview Rule to flag use of function declaration identifiers as variables.
|
33713
34365
|
* @author Ian Christian Myers
|
@@ -33765,7 +34417,7 @@ module.exports = function(context) {
|
|
33765
34417
|
|
33766
34418
|
module.exports.schema = [];
|
33767
34419
|
|
33768
|
-
},{"../ast-utils":152}],
|
34420
|
+
},{"../ast-utils":152}],252:[function(require,module,exports){
|
33769
34421
|
/**
|
33770
34422
|
* @fileoverview A rule to disallow the type conversions with shorter notations.
|
33771
34423
|
* @author Toru Nagashima
|
@@ -33918,7 +34570,7 @@ module.exports = function(context) {
|
|
33918
34570
|
if (options.boolean && isDoubleLogicalNegating(node)) {
|
33919
34571
|
context.report(
|
33920
34572
|
node,
|
33921
|
-
"use
|
34573
|
+
"use 'Boolean({{code}})' instead.",
|
33922
34574
|
{code: context.getSource(node.argument.argument)});
|
33923
34575
|
}
|
33924
34576
|
|
@@ -33926,7 +34578,7 @@ module.exports = function(context) {
|
|
33926
34578
|
if (options.boolean && isBinaryNegatingOfIndexOf(node)) {
|
33927
34579
|
context.report(
|
33928
34580
|
node,
|
33929
|
-
"use
|
34581
|
+
"use '{{code}} !== -1' instead.",
|
33930
34582
|
{code: context.getSource(node.argument)});
|
33931
34583
|
}
|
33932
34584
|
|
@@ -33934,7 +34586,7 @@ module.exports = function(context) {
|
|
33934
34586
|
if (options.number && node.operator === "+" && !isNumeric(node.argument)) {
|
33935
34587
|
context.report(
|
33936
34588
|
node,
|
33937
|
-
"use
|
34589
|
+
"use 'Number({{code}})' instead.",
|
33938
34590
|
{code: context.getSource(node.argument)});
|
33939
34591
|
}
|
33940
34592
|
},
|
@@ -33946,7 +34598,7 @@ module.exports = function(context) {
|
|
33946
34598
|
if (nonNumericOperand) {
|
33947
34599
|
context.report(
|
33948
34600
|
node,
|
33949
|
-
"use
|
34601
|
+
"use 'Number({{code}})' instead.",
|
33950
34602
|
{code: context.getSource(nonNumericOperand)});
|
33951
34603
|
}
|
33952
34604
|
|
@@ -33954,7 +34606,7 @@ module.exports = function(context) {
|
|
33954
34606
|
if (options.string && isConcatWithEmptyString(node)) {
|
33955
34607
|
context.report(
|
33956
34608
|
node,
|
33957
|
-
"use
|
34609
|
+
"use 'String({{code}})' instead.",
|
33958
34610
|
{code: context.getSource(getOtherOperand(node, ""))});
|
33959
34611
|
}
|
33960
34612
|
},
|
@@ -33964,7 +34616,7 @@ module.exports = function(context) {
|
|
33964
34616
|
if (options.string && isAppendEmptyString(node)) {
|
33965
34617
|
context.report(
|
33966
34618
|
node,
|
33967
|
-
"use
|
34619
|
+
"use '{{code}} = String({{code}})' instead.",
|
33968
34620
|
{code: context.getSource(getOtherOperand(node, ""))});
|
33969
34621
|
}
|
33970
34622
|
}
|
@@ -33989,7 +34641,7 @@ module.exports.schema = [
|
|
33989
34641
|
}
|
33990
34642
|
];
|
33991
34643
|
|
33992
|
-
},{}],
|
34644
|
+
},{}],253:[function(require,module,exports){
|
33993
34645
|
/**
|
33994
34646
|
* @fileoverview Rule to check for implicit global variables and functions.
|
33995
34647
|
* @author Joshua Peek
|
@@ -34037,7 +34689,7 @@ module.exports = function(context) {
|
|
34037
34689
|
|
34038
34690
|
module.exports.schema = [];
|
34039
34691
|
|
34040
|
-
},{}],
|
34692
|
+
},{}],254:[function(require,module,exports){
|
34041
34693
|
/**
|
34042
34694
|
* @fileoverview Rule to flag use of implied eval via setTimeout and setInterval
|
34043
34695
|
* @author James Allardice
|
@@ -34182,7 +34834,7 @@ module.exports = function(context) {
|
|
34182
34834
|
|
34183
34835
|
module.exports.schema = [];
|
34184
34836
|
|
34185
|
-
},{}],
|
34837
|
+
},{}],255:[function(require,module,exports){
|
34186
34838
|
/**
|
34187
34839
|
* @fileoverview Enforces or disallows inline comments.
|
34188
34840
|
* @author Greg Cochard
|
@@ -34238,7 +34890,7 @@ module.exports = function(context) {
|
|
34238
34890
|
|
34239
34891
|
module.exports.schema = [];
|
34240
34892
|
|
34241
|
-
},{"../ast-utils":152}],
|
34893
|
+
},{"../ast-utils":152}],256:[function(require,module,exports){
|
34242
34894
|
/**
|
34243
34895
|
* @fileoverview Rule to enforce declarations in program or function body root.
|
34244
34896
|
* @author Brandon Mills
|
@@ -34318,7 +34970,7 @@ module.exports.schema = [
|
|
34318
34970
|
}
|
34319
34971
|
];
|
34320
34972
|
|
34321
|
-
},{}],
|
34973
|
+
},{}],257:[function(require,module,exports){
|
34322
34974
|
/**
|
34323
34975
|
* @fileoverview Validate strings passed to the RegExp constructor
|
34324
34976
|
* @author Michael Ficarra
|
@@ -34385,7 +35037,7 @@ module.exports = function(context) {
|
|
34385
35037
|
|
34386
35038
|
module.exports.schema = [];
|
34387
35039
|
|
34388
|
-
},{"espree":"espree"}],
|
35040
|
+
},{"espree":"espree"}],258:[function(require,module,exports){
|
34389
35041
|
/**
|
34390
35042
|
* @fileoverview A rule to disallow `this` keywords outside of classes or class-like objects.
|
34391
35043
|
* @author Toru Nagashima
|
@@ -34487,7 +35139,7 @@ module.exports = function(context) {
|
|
34487
35139
|
"ThisExpression": function(node) {
|
34488
35140
|
var current = stack.getCurrent();
|
34489
35141
|
if (current && !current.valid) {
|
34490
|
-
context.report(node, "Unexpected
|
35142
|
+
context.report(node, "Unexpected 'this'.");
|
34491
35143
|
}
|
34492
35144
|
}
|
34493
35145
|
};
|
@@ -34495,7 +35147,7 @@ module.exports = function(context) {
|
|
34495
35147
|
|
34496
35148
|
module.exports.schema = [];
|
34497
35149
|
|
34498
|
-
},{"../ast-utils":152}],
|
35150
|
+
},{"../ast-utils":152}],259:[function(require,module,exports){
|
34499
35151
|
/**
|
34500
35152
|
* @fileoverview Rule to disalow whitespace that is not a tab or space, whitespace inside strings and comments are allowed
|
34501
35153
|
* @author Jonathan Kingston
|
@@ -34632,7 +35284,7 @@ module.exports = function(context) {
|
|
34632
35284
|
|
34633
35285
|
module.exports.schema = [];
|
34634
35286
|
|
34635
|
-
},{}],
|
35287
|
+
},{}],260:[function(require,module,exports){
|
34636
35288
|
/**
|
34637
35289
|
* @fileoverview Rule to flag usage of __iterator__ property
|
34638
35290
|
* @author Ian Christian Myers
|
@@ -34662,7 +35314,7 @@ module.exports = function(context) {
|
|
34662
35314
|
|
34663
35315
|
module.exports.schema = [];
|
34664
35316
|
|
34665
|
-
},{}],
|
35317
|
+
},{}],261:[function(require,module,exports){
|
34666
35318
|
/**
|
34667
35319
|
* @fileoverview Rule to flag labels that are the same as an identifier
|
34668
35320
|
* @author Ian Christian Myers
|
@@ -34721,7 +35373,7 @@ module.exports = function(context) {
|
|
34721
35373
|
|
34722
35374
|
module.exports.schema = [];
|
34723
35375
|
|
34724
|
-
},{"../ast-utils":152}],
|
35376
|
+
},{"../ast-utils":152}],262:[function(require,module,exports){
|
34725
35377
|
/**
|
34726
35378
|
* @fileoverview Disallow Labeled Statements
|
34727
35379
|
* @author Nicholas C. Zakas
|
@@ -34767,7 +35419,7 @@ module.exports = function(context) {
|
|
34767
35419
|
|
34768
35420
|
module.exports.schema = [];
|
34769
35421
|
|
34770
|
-
},{}],
|
35422
|
+
},{}],263:[function(require,module,exports){
|
34771
35423
|
/**
|
34772
35424
|
* @fileoverview Rule to flag blocks with no reason to exist
|
34773
35425
|
* @author Brandon Mills
|
@@ -34871,7 +35523,7 @@ module.exports = function(context) {
|
|
34871
35523
|
|
34872
35524
|
module.exports.schema = [];
|
34873
35525
|
|
34874
|
-
},{}],
|
35526
|
+
},{}],264:[function(require,module,exports){
|
34875
35527
|
/**
|
34876
35528
|
* @fileoverview Rule to disallow if as the only statmenet in an else block
|
34877
35529
|
* @author Brandon Mills
|
@@ -34903,7 +35555,7 @@ module.exports = function(context) {
|
|
34903
35555
|
|
34904
35556
|
module.exports.schema = [];
|
34905
35557
|
|
34906
|
-
},{}],
|
35558
|
+
},{}],265:[function(require,module,exports){
|
34907
35559
|
/**
|
34908
35560
|
* @fileoverview Rule to flag creation of function inside a loop
|
34909
35561
|
* @author Ilya Volodin
|
@@ -35022,7 +35674,7 @@ module.exports = function(context) {
|
|
35022
35674
|
|
35023
35675
|
module.exports.schema = [];
|
35024
35676
|
|
35025
|
-
},{}],
|
35677
|
+
},{}],266:[function(require,module,exports){
|
35026
35678
|
/**
|
35027
35679
|
* @fileoverview Rule to flag statements that use magic numbers (adapted from https://github.com/danielstjules/buddy.js)
|
35028
35680
|
* @author Vincent Lemeunier
|
@@ -35062,9 +35714,10 @@ module.exports.schema = [];
|
|
35062
35714
|
|
35063
35715
|
module.exports = function(context) {
|
35064
35716
|
var config = context.options[0] || {},
|
35065
|
-
ignore = config.ignore || [],
|
35066
35717
|
detectObjects = !!config.detectObjects,
|
35067
|
-
enforceConst = !!config.enforceConst
|
35718
|
+
enforceConst = !!config.enforceConst,
|
35719
|
+
ignore = config.ignore || [],
|
35720
|
+
ignoreArrayIndexes = !!config.ignoreArrayIndexes;
|
35068
35721
|
|
35069
35722
|
/**
|
35070
35723
|
* Returns whether the node is number literal
|
@@ -35084,6 +35737,28 @@ module.exports = function(context) {
|
|
35084
35737
|
return ignore.indexOf(num) !== -1;
|
35085
35738
|
}
|
35086
35739
|
|
35740
|
+
/**
|
35741
|
+
* Returns whether the number should be ignored when used as a radix within parseInt() or Number.parseInt()
|
35742
|
+
* @param {ASTNode} parent - the non-"UnaryExpression" parent
|
35743
|
+
* @param {ASTNode} node - the node literal being evaluated
|
35744
|
+
* @returns {boolean} true if the number should be ignored
|
35745
|
+
*/
|
35746
|
+
function shouldIgnoreParseInt(parent, node) {
|
35747
|
+
return parent.type === "CallExpression" && node === parent.arguments[1] &&
|
35748
|
+
(parent.callee.name === "parseInt" ||
|
35749
|
+
parent.callee.type === "MemberExpression" &&
|
35750
|
+
parent.callee.object.name === "Number" &&
|
35751
|
+
parent.callee.property.name === "parseInt");
|
35752
|
+
}
|
35753
|
+
|
35754
|
+
/**
|
35755
|
+
* Returns whether the number should be ignored when used as an array index with enabled 'ignoreArrayIndexes' option.
|
35756
|
+
* @param {ASTNode} parent - the non-"UnaryExpression" parent.
|
35757
|
+
* @returns {boolean} true if the number should be ignored
|
35758
|
+
*/
|
35759
|
+
function shouldIgnoreArrayIndexes(parent) {
|
35760
|
+
return parent.type === "MemberExpression" && ignoreArrayIndexes;
|
35761
|
+
}
|
35087
35762
|
|
35088
35763
|
return {
|
35089
35764
|
"Literal": function(node) {
|
@@ -35096,6 +35771,7 @@ module.exports = function(context) {
|
|
35096
35771
|
return;
|
35097
35772
|
}
|
35098
35773
|
|
35774
|
+
// For negative magic numbers: update the value and parent node
|
35099
35775
|
if (parent.type === "UnaryExpression" && parent.operator === "-") {
|
35100
35776
|
node = parent;
|
35101
35777
|
parent = node.parent;
|
@@ -35103,17 +35779,9 @@ module.exports = function(context) {
|
|
35103
35779
|
raw = "-" + raw;
|
35104
35780
|
}
|
35105
35781
|
|
35106
|
-
if (shouldIgnoreNumber(value)
|
35107
|
-
|
35108
|
-
|
35109
|
-
|
35110
|
-
// don't warn on parseInt() or Number.parseInt() radix
|
35111
|
-
if (parent.type === "CallExpression" && node === parent.arguments[1] &&
|
35112
|
-
(parent.callee.name === "parseInt" ||
|
35113
|
-
parent.callee.type === "MemberExpression" &&
|
35114
|
-
parent.callee.object.name === "Number" &&
|
35115
|
-
parent.callee.property.name === "parseInt")
|
35116
|
-
) {
|
35782
|
+
if (shouldIgnoreNumber(value) ||
|
35783
|
+
shouldIgnoreParseInt(parent, node) ||
|
35784
|
+
shouldIgnoreArrayIndexes(parent)) {
|
35117
35785
|
return;
|
35118
35786
|
}
|
35119
35787
|
|
@@ -35149,12 +35817,15 @@ module.exports.schema = [{
|
|
35149
35817
|
"type": "number"
|
35150
35818
|
},
|
35151
35819
|
"uniqueItems": true
|
35820
|
+
},
|
35821
|
+
"ignoreArrayIndexes": {
|
35822
|
+
"type": "boolean"
|
35152
35823
|
}
|
35153
35824
|
},
|
35154
35825
|
"additionalProperties": false
|
35155
35826
|
}];
|
35156
35827
|
|
35157
|
-
},{}],
|
35828
|
+
},{}],267:[function(require,module,exports){
|
35158
35829
|
/**
|
35159
35830
|
* @fileoverview Rule to enforce grouped require statements for Node.JS
|
35160
35831
|
* @author Raphael Pigulla
|
@@ -35168,6 +35839,17 @@ module.exports.schema = [{
|
|
35168
35839
|
|
35169
35840
|
module.exports = function(context) {
|
35170
35841
|
|
35842
|
+
var grouping = false,
|
35843
|
+
allowCall = false,
|
35844
|
+
options = context.options[0];
|
35845
|
+
|
35846
|
+
if (typeof options === "object") {
|
35847
|
+
grouping = options.grouping;
|
35848
|
+
allowCall = options.allowCall;
|
35849
|
+
} else {
|
35850
|
+
grouping = !!options;
|
35851
|
+
}
|
35852
|
+
|
35171
35853
|
/**
|
35172
35854
|
* Returns the list of built-in modules.
|
35173
35855
|
*
|
@@ -35213,6 +35895,12 @@ module.exports = function(context) {
|
|
35213
35895
|
) {
|
35214
35896
|
// "var x = require('util');"
|
35215
35897
|
return DECL_REQUIRE;
|
35898
|
+
} else if (allowCall &&
|
35899
|
+
initExpression.type === "CallExpression" &&
|
35900
|
+
initExpression.callee.type === "CallExpression"
|
35901
|
+
) {
|
35902
|
+
// "var x = require('diagnose')('sub-module');"
|
35903
|
+
return getDeclarationType(initExpression.callee);
|
35216
35904
|
} else if (initExpression.type === "MemberExpression") {
|
35217
35905
|
// "var x = require('glob').Glob;"
|
35218
35906
|
return getDeclarationType(initExpression.object);
|
@@ -35297,13 +35985,6 @@ module.exports = function(context) {
|
|
35297
35985
|
return {
|
35298
35986
|
|
35299
35987
|
"VariableDeclaration": function(node) {
|
35300
|
-
var grouping = false;
|
35301
|
-
|
35302
|
-
if (typeof context.options[0] === "object") {
|
35303
|
-
grouping = context.options[0].grouping;
|
35304
|
-
} else {
|
35305
|
-
grouping = !!context.options[0];
|
35306
|
-
}
|
35307
35988
|
|
35308
35989
|
if (isMixed(node.declarations)) {
|
35309
35990
|
context.report(
|
@@ -35332,6 +36013,9 @@ module.exports.schema = [
|
|
35332
36013
|
"properties": {
|
35333
36014
|
"grouping": {
|
35334
36015
|
"type": "boolean"
|
36016
|
+
},
|
36017
|
+
"allowCall": {
|
36018
|
+
"type": "boolean"
|
35335
36019
|
}
|
35336
36020
|
},
|
35337
36021
|
"additionalProperties": false
|
@@ -35340,7 +36024,7 @@ module.exports.schema = [
|
|
35340
36024
|
}
|
35341
36025
|
];
|
35342
36026
|
|
35343
|
-
},{}],
|
36027
|
+
},{}],268:[function(require,module,exports){
|
35344
36028
|
/**
|
35345
36029
|
* @fileoverview Disallow mixed spaces and tabs for indentation
|
35346
36030
|
* @author Jary Niebur
|
@@ -35476,7 +36160,7 @@ module.exports.schema = [
|
|
35476
36160
|
}
|
35477
36161
|
];
|
35478
36162
|
|
35479
|
-
},{}],
|
36163
|
+
},{}],269:[function(require,module,exports){
|
35480
36164
|
/**
|
35481
36165
|
* @fileoverview Disallow use of multiple spaces.
|
35482
36166
|
* @author Nicholas C. Zakas
|
@@ -35617,7 +36301,7 @@ module.exports.schema = [
|
|
35617
36301
|
}
|
35618
36302
|
];
|
35619
36303
|
|
35620
|
-
},{}],
|
36304
|
+
},{}],270:[function(require,module,exports){
|
35621
36305
|
/**
|
35622
36306
|
* @fileoverview Rule to flag when using multiline strings
|
35623
36307
|
* @author Ilya Volodin
|
@@ -35662,7 +36346,7 @@ module.exports = function(context) {
|
|
35662
36346
|
|
35663
36347
|
module.exports.schema = [];
|
35664
36348
|
|
35665
|
-
},{}],
|
36349
|
+
},{}],271:[function(require,module,exports){
|
35666
36350
|
/**
|
35667
36351
|
* @fileoverview Disallows multiple blank lines.
|
35668
36352
|
* implementation adapted from the no-trailing-spaces rule.
|
@@ -35788,7 +36472,7 @@ module.exports.schema = [
|
|
35788
36472
|
}
|
35789
36473
|
];
|
35790
36474
|
|
35791
|
-
},{}],
|
36475
|
+
},{}],272:[function(require,module,exports){
|
35792
36476
|
/**
|
35793
36477
|
* @fileoverview Rule to flag when re-assigning native objects
|
35794
36478
|
* @author Ilya Volodin
|
@@ -35861,7 +36545,7 @@ module.exports.schema = [
|
|
35861
36545
|
}
|
35862
36546
|
];
|
35863
36547
|
|
35864
|
-
},{}],
|
36548
|
+
},{}],273:[function(require,module,exports){
|
35865
36549
|
/**
|
35866
36550
|
* @fileoverview Rule to disallow a negated condition
|
35867
36551
|
* @author Alberto Rodríguez
|
@@ -35937,7 +36621,7 @@ module.exports = function(context) {
|
|
35937
36621
|
|
35938
36622
|
module.exports.schema = [];
|
35939
36623
|
|
35940
|
-
},{}],
|
36624
|
+
},{}],274:[function(require,module,exports){
|
35941
36625
|
/**
|
35942
36626
|
* @fileoverview A rule to disallow negated left operands of the `in` operator
|
35943
36627
|
* @author Michael Ficarra
|
@@ -35955,7 +36639,7 @@ module.exports = function(context) {
|
|
35955
36639
|
|
35956
36640
|
"BinaryExpression": function(node) {
|
35957
36641
|
if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") {
|
35958
|
-
context.report(node, "The
|
36642
|
+
context.report(node, "The 'in' expression's left operand is negated");
|
35959
36643
|
}
|
35960
36644
|
}
|
35961
36645
|
};
|
@@ -35964,7 +36648,7 @@ module.exports = function(context) {
|
|
35964
36648
|
|
35965
36649
|
module.exports.schema = [];
|
35966
36650
|
|
35967
|
-
},{}],
|
36651
|
+
},{}],275:[function(require,module,exports){
|
35968
36652
|
/**
|
35969
36653
|
* @fileoverview Rule to flag nested ternary expressions
|
35970
36654
|
* @author Ian Christian Myers
|
@@ -35990,7 +36674,7 @@ module.exports = function(context) {
|
|
35990
36674
|
|
35991
36675
|
module.exports.schema = [];
|
35992
36676
|
|
35993
|
-
},{}],
|
36677
|
+
},{}],276:[function(require,module,exports){
|
35994
36678
|
/**
|
35995
36679
|
* @fileoverview Rule to flag when using new Function
|
35996
36680
|
* @author Ilya Volodin
|
@@ -36009,7 +36693,7 @@ module.exports = function(context) {
|
|
36009
36693
|
//--------------------------------------------------------------------------
|
36010
36694
|
|
36011
36695
|
/**
|
36012
|
-
* Checks if the callee
|
36696
|
+
* Checks if the callee is the Function constructor, and if so, reports an issue.
|
36013
36697
|
* @param {ASTNode} node The node to check and report on
|
36014
36698
|
* @returns {void}
|
36015
36699
|
* @private
|
@@ -36029,7 +36713,7 @@ module.exports = function(context) {
|
|
36029
36713
|
|
36030
36714
|
module.exports.schema = [];
|
36031
36715
|
|
36032
|
-
},{}],
|
36716
|
+
},{}],277:[function(require,module,exports){
|
36033
36717
|
/**
|
36034
36718
|
* @fileoverview A rule to disallow calls to the Object constructor
|
36035
36719
|
* @author Matt DuVall <http://www.mattduvall.com/>
|
@@ -36056,7 +36740,7 @@ module.exports = function(context) {
|
|
36056
36740
|
|
36057
36741
|
module.exports.schema = [];
|
36058
36742
|
|
36059
|
-
},{}],
|
36743
|
+
},{}],278:[function(require,module,exports){
|
36060
36744
|
/**
|
36061
36745
|
* @fileoverview Rule to disallow use of new operator with the `require` function
|
36062
36746
|
* @author Wil Moore III
|
@@ -36083,7 +36767,42 @@ module.exports = function(context) {
|
|
36083
36767
|
|
36084
36768
|
module.exports.schema = [];
|
36085
36769
|
|
36086
|
-
},{}],
|
36770
|
+
},{}],279:[function(require,module,exports){
|
36771
|
+
/**
|
36772
|
+
* @fileoverview Rule to disallow use of the new operator with the `Symbol` object
|
36773
|
+
* @author Alberto Rodríguez
|
36774
|
+
* @copyright 2016 Alberto Rodríguez. All rights reserved.
|
36775
|
+
* See LICENSE file in root directory for full license.
|
36776
|
+
*/
|
36777
|
+
|
36778
|
+
"use strict";
|
36779
|
+
|
36780
|
+
//------------------------------------------------------------------------------
|
36781
|
+
// Rule Definition
|
36782
|
+
//------------------------------------------------------------------------------
|
36783
|
+
|
36784
|
+
module.exports = function(context) {
|
36785
|
+
|
36786
|
+
return {
|
36787
|
+
"Program:exit": function() {
|
36788
|
+
var globalScope = context.getScope();
|
36789
|
+
var variable = globalScope.set.get("Symbol");
|
36790
|
+
if (variable && variable.defs.length === 0) {
|
36791
|
+
variable.references.forEach(function(ref) {
|
36792
|
+
var node = ref.identifier;
|
36793
|
+
if (node.parent && node.parent.type === "NewExpression") {
|
36794
|
+
context.report(node, "`Symbol` cannot be called as a constructor.");
|
36795
|
+
}
|
36796
|
+
});
|
36797
|
+
}
|
36798
|
+
}
|
36799
|
+
};
|
36800
|
+
|
36801
|
+
};
|
36802
|
+
|
36803
|
+
module.exports.schema = [];
|
36804
|
+
|
36805
|
+
},{}],280:[function(require,module,exports){
|
36087
36806
|
/**
|
36088
36807
|
* @fileoverview Rule to flag when using constructor for wrapper objects
|
36089
36808
|
* @author Ilya Volodin
|
@@ -36111,7 +36830,7 @@ module.exports = function(context) {
|
|
36111
36830
|
|
36112
36831
|
module.exports.schema = [];
|
36113
36832
|
|
36114
|
-
},{}],
|
36833
|
+
},{}],281:[function(require,module,exports){
|
36115
36834
|
/**
|
36116
36835
|
* @fileoverview Rule to flag statements with function invocation preceded by
|
36117
36836
|
* "new" and not part of assignment
|
@@ -36140,7 +36859,7 @@ module.exports = function(context) {
|
|
36140
36859
|
|
36141
36860
|
module.exports.schema = [];
|
36142
36861
|
|
36143
|
-
},{}],
|
36862
|
+
},{}],282:[function(require,module,exports){
|
36144
36863
|
/**
|
36145
36864
|
* @fileoverview Rule to flag use of an object property of the global object (Math and JSON) as a function
|
36146
36865
|
* @author James Allardice
|
@@ -36170,7 +36889,7 @@ module.exports = function(context) {
|
|
36170
36889
|
|
36171
36890
|
module.exports.schema = [];
|
36172
36891
|
|
36173
|
-
},{}],
|
36892
|
+
},{}],283:[function(require,module,exports){
|
36174
36893
|
/**
|
36175
36894
|
* @fileoverview Rule to flag octal escape sequences in string literals.
|
36176
36895
|
* @author Ian Christian Myers
|
@@ -36211,7 +36930,7 @@ module.exports = function(context) {
|
|
36211
36930
|
|
36212
36931
|
module.exports.schema = [];
|
36213
36932
|
|
36214
|
-
},{}],
|
36933
|
+
},{}],284:[function(require,module,exports){
|
36215
36934
|
/**
|
36216
36935
|
* @fileoverview Rule to flag when initializing octal literal
|
36217
36936
|
* @author Ilya Volodin
|
@@ -36238,7 +36957,7 @@ module.exports = function(context) {
|
|
36238
36957
|
|
36239
36958
|
module.exports.schema = [];
|
36240
36959
|
|
36241
|
-
},{}],
|
36960
|
+
},{}],285:[function(require,module,exports){
|
36242
36961
|
/**
|
36243
36962
|
* @fileoverview Disallow reassignment of function parameters.
|
36244
36963
|
* @author Nat Burns
|
@@ -36376,7 +37095,7 @@ module.exports.schema = [
|
|
36376
37095
|
}
|
36377
37096
|
];
|
36378
37097
|
|
36379
|
-
},{}],
|
37098
|
+
},{}],286:[function(require,module,exports){
|
36380
37099
|
/**
|
36381
37100
|
* @fileoverview Disallow string concatenation when using __dirname and __filename
|
36382
37101
|
* @author Nicholas C. Zakas
|
@@ -36417,7 +37136,7 @@ module.exports = function(context) {
|
|
36417
37136
|
|
36418
37137
|
module.exports.schema = [];
|
36419
37138
|
|
36420
|
-
},{}],
|
37139
|
+
},{}],287:[function(require,module,exports){
|
36421
37140
|
/**
|
36422
37141
|
* @fileoverview Rule to flag use of unary increment and decrement operators.
|
36423
37142
|
* @author Ian Christian Myers
|
@@ -36464,7 +37183,7 @@ module.exports.schema = [
|
|
36464
37183
|
}
|
36465
37184
|
];
|
36466
37185
|
|
36467
|
-
},{}],
|
37186
|
+
},{}],288:[function(require,module,exports){
|
36468
37187
|
/**
|
36469
37188
|
* @fileoverview Disallow the use of process.env()
|
36470
37189
|
* @author Vignesh Anand
|
@@ -36496,7 +37215,7 @@ module.exports = function(context) {
|
|
36496
37215
|
|
36497
37216
|
module.exports.schema = [];
|
36498
37217
|
|
36499
|
-
},{}],
|
37218
|
+
},{}],289:[function(require,module,exports){
|
36500
37219
|
/**
|
36501
37220
|
* @fileoverview Disallow the use of process.exit()
|
36502
37221
|
* @author Nicholas C. Zakas
|
@@ -36531,7 +37250,7 @@ module.exports = function(context) {
|
|
36531
37250
|
|
36532
37251
|
module.exports.schema = [];
|
36533
37252
|
|
36534
|
-
},{}],
|
37253
|
+
},{}],290:[function(require,module,exports){
|
36535
37254
|
/**
|
36536
37255
|
* @fileoverview Rule to flag usage of __proto__ property
|
36537
37256
|
* @author Ilya Volodin
|
@@ -36561,7 +37280,7 @@ module.exports = function(context) {
|
|
36561
37280
|
|
36562
37281
|
module.exports.schema = [];
|
36563
37282
|
|
36564
|
-
},{}],
|
37283
|
+
},{}],291:[function(require,module,exports){
|
36565
37284
|
/**
|
36566
37285
|
* @fileoverview Rule to flag when the same variable is declared more then once.
|
36567
37286
|
* @author Ilya Volodin
|
@@ -36597,7 +37316,7 @@ module.exports = function(context) {
|
|
36597
37316
|
for (var i = (hasBuiltin ? 0 : 1), l = variable.identifiers.length; i < l; i++) {
|
36598
37317
|
context.report(
|
36599
37318
|
variable.identifiers[i],
|
36600
|
-
"
|
37319
|
+
"'{{a}}' is already defined",
|
36601
37320
|
{a: variable.name});
|
36602
37321
|
}
|
36603
37322
|
}
|
@@ -36658,7 +37377,7 @@ module.exports.schema = [
|
|
36658
37377
|
}
|
36659
37378
|
];
|
36660
37379
|
|
36661
|
-
},{}],
|
37380
|
+
},{}],292:[function(require,module,exports){
|
36662
37381
|
/**
|
36663
37382
|
* @fileoverview Rule to count multiple spaces in regular expressions
|
36664
37383
|
* @author Matt DuVall <http://www.mattduvall.com/>
|
@@ -36695,7 +37414,7 @@ module.exports = function(context) {
|
|
36695
37414
|
|
36696
37415
|
module.exports.schema = [];
|
36697
37416
|
|
36698
|
-
},{}],
|
37417
|
+
},{}],293:[function(require,module,exports){
|
36699
37418
|
/**
|
36700
37419
|
* @fileoverview Restrict usage of specified node imports.
|
36701
37420
|
* @author Guy Ellis
|
@@ -36740,7 +37459,7 @@ module.exports.schema = {
|
|
36740
37459
|
"uniqueItems": true
|
36741
37460
|
};
|
36742
37461
|
|
36743
|
-
},{}],
|
37462
|
+
},{}],294:[function(require,module,exports){
|
36744
37463
|
/**
|
36745
37464
|
* @fileoverview Restrict usage of specified node modules.
|
36746
37465
|
* @author Christian Schulz
|
@@ -36822,7 +37541,7 @@ module.exports.schema = {
|
|
36822
37541
|
"uniqueItems": true
|
36823
37542
|
};
|
36824
37543
|
|
36825
|
-
},{}],
|
37544
|
+
},{}],295:[function(require,module,exports){
|
36826
37545
|
/**
|
36827
37546
|
* @fileoverview Rule to flag use of certain node types
|
36828
37547
|
* @author Burak Yigit Kaya
|
@@ -36843,7 +37562,7 @@ module.exports = function(context) {
|
|
36843
37562
|
* @returns {void}
|
36844
37563
|
*/
|
36845
37564
|
function warn(node) {
|
36846
|
-
context.report(node, "Using
|
37565
|
+
context.report(node, "Using '{{type}}' is not allowed.", node);
|
36847
37566
|
}
|
36848
37567
|
|
36849
37568
|
return context.options.reduce(function(result, nodeType) {
|
@@ -36867,7 +37586,7 @@ module.exports.schema = {
|
|
36867
37586
|
"minItems": 0
|
36868
37587
|
};
|
36869
37588
|
|
36870
|
-
},{"espree":"espree"}],
|
37589
|
+
},{"espree":"espree"}],296:[function(require,module,exports){
|
36871
37590
|
/**
|
36872
37591
|
* @fileoverview Rule to flag when return statement contains assignment
|
36873
37592
|
* @author Ilya Volodin
|
@@ -36907,10 +37626,29 @@ function isEnclosedInParens(node, context) {
|
|
36907
37626
|
module.exports = function(context) {
|
36908
37627
|
var always = (context.options[0] || "except-parens") !== "except-parens";
|
36909
37628
|
|
37629
|
+
/**
|
37630
|
+
* Check whether return statement contains assignment
|
37631
|
+
* @param {ASTNode} nodeToCheck node to check
|
37632
|
+
* @param {ASTNode} nodeToReport node to report
|
37633
|
+
* @param {string} message message to report
|
37634
|
+
* @returns {void}
|
37635
|
+
* @private
|
37636
|
+
*/
|
37637
|
+
function checkForAssignInReturn(nodeToCheck, nodeToReport, message) {
|
37638
|
+
if (isAssignment(nodeToCheck) && (always || !isEnclosedInParens(nodeToCheck, context))) {
|
37639
|
+
context.report(nodeToReport, message);
|
37640
|
+
}
|
37641
|
+
}
|
37642
|
+
|
36910
37643
|
return {
|
36911
37644
|
"ReturnStatement": function(node) {
|
36912
|
-
|
36913
|
-
|
37645
|
+
var message = "Return statement should not contain assignment.";
|
37646
|
+
checkForAssignInReturn(node.argument, node, message);
|
37647
|
+
},
|
37648
|
+
"ArrowFunctionExpression": function(node) {
|
37649
|
+
if (node.body.type !== "BlockStatement") {
|
37650
|
+
var message = "Arrow function should not return assignment.";
|
37651
|
+
checkForAssignInReturn(node.body, node, message);
|
36914
37652
|
}
|
36915
37653
|
}
|
36916
37654
|
};
|
@@ -36922,7 +37660,7 @@ module.exports.schema = [
|
|
36922
37660
|
}
|
36923
37661
|
];
|
36924
37662
|
|
36925
|
-
},{}],
|
37663
|
+
},{}],297:[function(require,module,exports){
|
36926
37664
|
/**
|
36927
37665
|
* @fileoverview Rule to flag when using javascript: urls
|
36928
37666
|
* @author Ilya Volodin
|
@@ -36958,7 +37696,7 @@ module.exports = function(context) {
|
|
36958
37696
|
|
36959
37697
|
module.exports.schema = [];
|
36960
37698
|
|
36961
|
-
},{}],
|
37699
|
+
},{}],298:[function(require,module,exports){
|
36962
37700
|
/**
|
36963
37701
|
* @fileoverview Rule to flag comparison where left part is the same as the right
|
36964
37702
|
* part.
|
@@ -36989,7 +37727,7 @@ module.exports = function(context) {
|
|
36989
37727
|
|
36990
37728
|
module.exports.schema = [];
|
36991
37729
|
|
36992
|
-
},{}],
|
37730
|
+
},{}],299:[function(require,module,exports){
|
36993
37731
|
/**
|
36994
37732
|
* @fileoverview Rule to flag use of comma operator
|
36995
37733
|
* @author Brandon Mills
|
@@ -37086,7 +37824,7 @@ module.exports = function(context) {
|
|
37086
37824
|
|
37087
37825
|
module.exports.schema = [];
|
37088
37826
|
|
37089
|
-
},{}],
|
37827
|
+
},{}],300:[function(require,module,exports){
|
37090
37828
|
/**
|
37091
37829
|
* @fileoverview Disallow shadowing of NaN, undefined, and Infinity (ES5 section 15.1.1)
|
37092
37830
|
* @author Michael Ficarra
|
@@ -37110,7 +37848,7 @@ module.exports = function(context) {
|
|
37110
37848
|
*/
|
37111
37849
|
function checkForViolation(id) {
|
37112
37850
|
if (RESTRICTED.indexOf(id.name) > -1) {
|
37113
|
-
context.report(id, "Shadowing of global property
|
37851
|
+
context.report(id, "Shadowing of global property '" + id.name + "'.");
|
37114
37852
|
}
|
37115
37853
|
}
|
37116
37854
|
|
@@ -37145,7 +37883,7 @@ module.exports = function(context) {
|
|
37145
37883
|
|
37146
37884
|
module.exports.schema = [];
|
37147
37885
|
|
37148
|
-
},{}],
|
37886
|
+
},{}],301:[function(require,module,exports){
|
37149
37887
|
/**
|
37150
37888
|
* @fileoverview Rule to flag on declaring variables already declared in the outer scope
|
37151
37889
|
* @author Ilya Volodin
|
@@ -37280,7 +38018,7 @@ module.exports = function(context) {
|
|
37280
38018
|
) {
|
37281
38019
|
context.report({
|
37282
38020
|
node: variable.identifiers[0],
|
37283
|
-
message: "
|
38021
|
+
message: "'{{name}}' is already declared in the upper scope.",
|
37284
38022
|
data: variable
|
37285
38023
|
});
|
37286
38024
|
}
|
@@ -37320,7 +38058,7 @@ module.exports.schema = [
|
|
37320
38058
|
}
|
37321
38059
|
];
|
37322
38060
|
|
37323
|
-
},{"../ast-utils":152}],
|
38061
|
+
},{"../ast-utils":152}],302:[function(require,module,exports){
|
37324
38062
|
/**
|
37325
38063
|
* @fileoverview Rule to check that spaced function application
|
37326
38064
|
* @author Matt DuVall <http://www.mattduvall.com>
|
@@ -37382,7 +38120,7 @@ module.exports = function(context) {
|
|
37382
38120
|
|
37383
38121
|
module.exports.schema = [];
|
37384
38122
|
|
37385
|
-
},{}],
|
38123
|
+
},{}],303:[function(require,module,exports){
|
37386
38124
|
/**
|
37387
38125
|
* @fileoverview Disallow sparse arrays
|
37388
38126
|
* @author Nicholas C. Zakas
|
@@ -37417,7 +38155,7 @@ module.exports = function(context) {
|
|
37417
38155
|
|
37418
38156
|
module.exports.schema = [];
|
37419
38157
|
|
37420
|
-
},{}],
|
38158
|
+
},{}],304:[function(require,module,exports){
|
37421
38159
|
/**
|
37422
38160
|
* @fileoverview Rule to check for properties whose identifier ends with the string Sync
|
37423
38161
|
* @author Matt DuVall<http://mattduvall.com/>
|
@@ -37449,7 +38187,7 @@ module.exports = function(context) {
|
|
37449
38187
|
|
37450
38188
|
module.exports.schema = [];
|
37451
38189
|
|
37452
|
-
},{}],
|
38190
|
+
},{}],305:[function(require,module,exports){
|
37453
38191
|
/**
|
37454
38192
|
* @fileoverview Rule to flag use of ternary operators.
|
37455
38193
|
* @author Ian Christian Myers
|
@@ -37475,7 +38213,7 @@ module.exports = function(context) {
|
|
37475
38213
|
|
37476
38214
|
module.exports.schema = [];
|
37477
38215
|
|
37478
|
-
},{}],
|
38216
|
+
},{}],306:[function(require,module,exports){
|
37479
38217
|
/**
|
37480
38218
|
* @fileoverview A rule to disallow using `this`/`super` before `super()`.
|
37481
38219
|
* @author Toru Nagashima
|
@@ -37622,7 +38360,7 @@ module.exports = function(context) {
|
|
37622
38360
|
"ThisExpression": function(node) {
|
37623
38361
|
if (isBeforeCallOfSuper()) {
|
37624
38362
|
context.report({
|
37625
|
-
message: "
|
38363
|
+
message: "'this' is not allowed before 'super()'.",
|
37626
38364
|
node: node
|
37627
38365
|
});
|
37628
38366
|
}
|
@@ -37636,7 +38374,7 @@ module.exports = function(context) {
|
|
37636
38374
|
"Super": function(node) {
|
37637
38375
|
if (!astUtils.isCallee(node) && isBeforeCallOfSuper()) {
|
37638
38376
|
context.report({
|
37639
|
-
message: "
|
38377
|
+
message: "'super' is not allowed before 'super()'.",
|
37640
38378
|
node: node
|
37641
38379
|
});
|
37642
38380
|
}
|
@@ -37668,7 +38406,7 @@ module.exports = function(context) {
|
|
37668
38406
|
|
37669
38407
|
module.exports.schema = [];
|
37670
38408
|
|
37671
|
-
},{"../ast-utils":152}],
|
38409
|
+
},{"../ast-utils":152}],307:[function(require,module,exports){
|
37672
38410
|
/**
|
37673
38411
|
* @fileoverview Rule to restrict what can be thrown as an exception.
|
37674
38412
|
* @author Dieter Oberkofler
|
@@ -37740,7 +38478,7 @@ module.exports = function(context) {
|
|
37740
38478
|
|
37741
38479
|
module.exports.schema = [];
|
37742
38480
|
|
37743
|
-
},{}],
|
38481
|
+
},{}],308:[function(require,module,exports){
|
37744
38482
|
/**
|
37745
38483
|
* @fileoverview Disallow trailing spaces at the end of lines.
|
37746
38484
|
* @author Nodeca Team <https://github.com/nodeca>
|
@@ -37848,7 +38586,7 @@ module.exports.schema = [
|
|
37848
38586
|
}
|
37849
38587
|
];
|
37850
38588
|
|
37851
|
-
},{}],
|
38589
|
+
},{}],309:[function(require,module,exports){
|
37852
38590
|
/**
|
37853
38591
|
* @fileoverview Rule to flag when initializing to undefined
|
37854
38592
|
* @author Ilya Volodin
|
@@ -37880,7 +38618,7 @@ module.exports = function(context) {
|
|
37880
38618
|
|
37881
38619
|
module.exports.schema = [];
|
37882
38620
|
|
37883
|
-
},{}],
|
38621
|
+
},{}],310:[function(require,module,exports){
|
37884
38622
|
/**
|
37885
38623
|
* @fileoverview Rule to flag references to undeclared variables.
|
37886
38624
|
* @author Mark Macdonald
|
@@ -37924,7 +38662,7 @@ module.exports = function(context) {
|
|
37924
38662
|
|
37925
38663
|
context.report({
|
37926
38664
|
node: identifier,
|
37927
|
-
message: "
|
38665
|
+
message: "'{{name}}' is not defined.",
|
37928
38666
|
data: identifier
|
37929
38667
|
});
|
37930
38668
|
});
|
@@ -37944,7 +38682,7 @@ module.exports.schema = [
|
|
37944
38682
|
}
|
37945
38683
|
];
|
37946
38684
|
|
37947
|
-
},{}],
|
38685
|
+
},{}],311:[function(require,module,exports){
|
37948
38686
|
/**
|
37949
38687
|
* @fileoverview Rule to flag references to the undefined variable.
|
37950
38688
|
* @author Michael Ficarra
|
@@ -37973,7 +38711,7 @@ module.exports = function(context) {
|
|
37973
38711
|
|
37974
38712
|
module.exports.schema = [];
|
37975
38713
|
|
37976
|
-
},{}],
|
38714
|
+
},{}],312:[function(require,module,exports){
|
37977
38715
|
/**
|
37978
38716
|
* @fileoverview Rule to flag trailing underscores in variable declarations.
|
37979
38717
|
* @author Matt DuVall <http://www.mattduvall.com>
|
@@ -38051,7 +38789,7 @@ module.exports = function(context) {
|
|
38051
38789
|
var identifier = node.id.name;
|
38052
38790
|
|
38053
38791
|
if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier) && !isAllowed(identifier)) {
|
38054
|
-
context.report(node, "Unexpected dangling
|
38792
|
+
context.report(node, "Unexpected dangling '_' in '" + identifier + "'.");
|
38055
38793
|
}
|
38056
38794
|
}
|
38057
38795
|
}
|
@@ -38067,7 +38805,7 @@ module.exports = function(context) {
|
|
38067
38805
|
|
38068
38806
|
if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier) &&
|
38069
38807
|
!isSpecialCaseIdentifierInVariableExpression(identifier) && !isAllowed(identifier)) {
|
38070
|
-
context.report(node, "Unexpected dangling
|
38808
|
+
context.report(node, "Unexpected dangling '_' in '" + identifier + "'.");
|
38071
38809
|
}
|
38072
38810
|
}
|
38073
38811
|
|
@@ -38084,7 +38822,7 @@ module.exports = function(context) {
|
|
38084
38822
|
if (typeof identifier !== "undefined" && hasTrailingUnderscore(identifier) &&
|
38085
38823
|
!(isMemberOfThis && allowAfterThis) &&
|
38086
38824
|
!isSpecialCaseIdentifierForMemberExpression(identifier) && !isAllowed(identifier)) {
|
38087
|
-
context.report(node, "Unexpected dangling
|
38825
|
+
context.report(node, "Unexpected dangling '_' in '" + identifier + "'.");
|
38088
38826
|
}
|
38089
38827
|
}
|
38090
38828
|
|
@@ -38118,7 +38856,7 @@ module.exports.schema = [
|
|
38118
38856
|
}
|
38119
38857
|
];
|
38120
38858
|
|
38121
|
-
},{}],
|
38859
|
+
},{}],313:[function(require,module,exports){
|
38122
38860
|
/**
|
38123
38861
|
* @fileoverview Rule to spot scenarios where a newline looks like it is ending a statement, but is not.
|
38124
38862
|
* @author Glen Mailer
|
@@ -38135,18 +38873,20 @@ module.exports = function(context) {
|
|
38135
38873
|
var PROPERTY_MESSAGE = "Unexpected newline between object and [ of property access.";
|
38136
38874
|
|
38137
38875
|
/**
|
38138
|
-
* Check to see if
|
38876
|
+
* Check to see if there is a newline between the node and the following open bracket
|
38139
38877
|
* line's expression
|
38140
38878
|
* @param {ASTNode} node The node to check.
|
38141
38879
|
* @param {string} msg The error message to use.
|
38142
38880
|
* @returns {void}
|
38143
38881
|
* @private
|
38144
38882
|
*/
|
38145
|
-
function
|
38146
|
-
var
|
38147
|
-
|
38148
|
-
|
38149
|
-
|
38883
|
+
function checkForBreakAfter(node, msg) {
|
38884
|
+
var paren = context.getTokenAfter(node);
|
38885
|
+
while (paren.value === ")") {
|
38886
|
+
paren = context.getTokenAfter(paren);
|
38887
|
+
}
|
38888
|
+
|
38889
|
+
if (paren.loc.start.line !== node.loc.end.line) {
|
38150
38890
|
context.report(node, paren.loc.start, msg, { char: paren.value });
|
38151
38891
|
}
|
38152
38892
|
}
|
@@ -38161,16 +38901,14 @@ module.exports = function(context) {
|
|
38161
38901
|
if (!node.computed) {
|
38162
38902
|
return;
|
38163
38903
|
}
|
38164
|
-
|
38165
|
-
checkForBreakBefore(node.property, PROPERTY_MESSAGE);
|
38904
|
+
checkForBreakAfter(node.object, PROPERTY_MESSAGE);
|
38166
38905
|
},
|
38167
38906
|
|
38168
38907
|
"CallExpression": function(node) {
|
38169
38908
|
if (node.arguments.length === 0) {
|
38170
38909
|
return;
|
38171
38910
|
}
|
38172
|
-
|
38173
|
-
checkForBreakBefore(node.arguments[0], FUNCTION_MESSAGE);
|
38911
|
+
checkForBreakAfter(node.callee, FUNCTION_MESSAGE);
|
38174
38912
|
}
|
38175
38913
|
};
|
38176
38914
|
|
@@ -38178,7 +38916,7 @@ module.exports = function(context) {
|
|
38178
38916
|
|
38179
38917
|
module.exports.schema = [];
|
38180
38918
|
|
38181
|
-
},{}],
|
38919
|
+
},{}],314:[function(require,module,exports){
|
38182
38920
|
/**
|
38183
38921
|
* @fileoverview Rule to disallow use of unmodified expressions in loop conditions
|
38184
38922
|
* @author Toru Nagashima
|
@@ -38424,7 +39162,7 @@ module.exports = function(context) {
|
|
38424
39162
|
|
38425
39163
|
context.report({
|
38426
39164
|
node: node,
|
38427
|
-
message: "
|
39165
|
+
message: "'{{name}}' is not modified in this loop.",
|
38428
39166
|
data: node
|
38429
39167
|
});
|
38430
39168
|
}
|
@@ -38517,7 +39255,7 @@ module.exports = function(context) {
|
|
38517
39255
|
|
38518
39256
|
module.exports.schema = [];
|
38519
39257
|
|
38520
|
-
},{"../ast-utils":152,"../util/estraverse":
|
39258
|
+
},{"../ast-utils":152,"../util/estraverse":371,"es6-map":23}],315:[function(require,module,exports){
|
38521
39259
|
/**
|
38522
39260
|
* @fileoverview Rule to flag no-unneeded-ternary
|
38523
39261
|
* @author Gyandeep Singh
|
@@ -38581,7 +39319,7 @@ module.exports.schema = [
|
|
38581
39319
|
}
|
38582
39320
|
];
|
38583
39321
|
|
38584
|
-
},{}],
|
39322
|
+
},{}],316:[function(require,module,exports){
|
38585
39323
|
/**
|
38586
39324
|
* @fileoverview Checks for unreachable code due to return, throws, break, and continue.
|
38587
39325
|
* @author Joel Feenstra
|
@@ -38673,7 +39411,7 @@ module.exports = function(context) {
|
|
38673
39411
|
|
38674
39412
|
module.exports.schema = [];
|
38675
39413
|
|
38676
|
-
},{}],
|
39414
|
+
},{}],317:[function(require,module,exports){
|
38677
39415
|
/**
|
38678
39416
|
* @fileoverview Flag expressions in statement position that do not side effect
|
38679
39417
|
* @author Michael Ficarra
|
@@ -38781,7 +39519,7 @@ module.exports.schema = [
|
|
38781
39519
|
}
|
38782
39520
|
];
|
38783
39521
|
|
38784
|
-
},{}],
|
39522
|
+
},{}],318:[function(require,module,exports){
|
38785
39523
|
/**
|
38786
39524
|
* @fileoverview Rule to flag declared but unused variables
|
38787
39525
|
* @author Ilya Volodin
|
@@ -38801,7 +39539,7 @@ var escape = require("escape-string-regexp");
|
|
38801
39539
|
|
38802
39540
|
module.exports = function(context) {
|
38803
39541
|
|
38804
|
-
var MESSAGE = "
|
39542
|
+
var MESSAGE = "'{{name}}' is defined but never used";
|
38805
39543
|
|
38806
39544
|
var config = {
|
38807
39545
|
vars: "all",
|
@@ -39088,7 +39826,7 @@ module.exports.schema = [
|
|
39088
39826
|
}
|
39089
39827
|
];
|
39090
39828
|
|
39091
|
-
},{"escape-string-regexp":76}],
|
39829
|
+
},{"escape-string-regexp":76}],319:[function(require,module,exports){
|
39092
39830
|
/**
|
39093
39831
|
* @fileoverview Rule to flag use of variables before they are defined
|
39094
39832
|
* @author Ilya Volodin
|
@@ -39258,7 +39996,7 @@ module.exports = function(context) {
|
|
39258
39996
|
// Reports.
|
39259
39997
|
context.report({
|
39260
39998
|
node: reference.identifier,
|
39261
|
-
message: "
|
39999
|
+
message: "'{{name}}' was used before it was defined",
|
39262
40000
|
data: reference.identifier
|
39263
40001
|
});
|
39264
40002
|
});
|
@@ -39325,7 +40063,7 @@ module.exports.schema = [
|
|
39325
40063
|
}
|
39326
40064
|
];
|
39327
40065
|
|
39328
|
-
},{}],
|
40066
|
+
},{}],320:[function(require,module,exports){
|
39329
40067
|
/**
|
39330
40068
|
* @fileoverview A rule to disallow unnecessary `.call()` and `.apply()`.
|
39331
40069
|
* @author Toru Nagashima
|
@@ -39414,7 +40152,7 @@ module.exports = function(context) {
|
|
39414
40152
|
if (isValidThisArg(expectedThis, thisArg, context)) {
|
39415
40153
|
context.report(
|
39416
40154
|
node,
|
39417
|
-
"unnecessary
|
40155
|
+
"unnecessary '.{{name}}()'.",
|
39418
40156
|
{name: node.callee.property.name});
|
39419
40157
|
}
|
39420
40158
|
}
|
@@ -39423,7 +40161,7 @@ module.exports = function(context) {
|
|
39423
40161
|
|
39424
40162
|
module.exports.schema = [];
|
39425
40163
|
|
39426
|
-
},{"../ast-utils":152}],
|
40164
|
+
},{"../ast-utils":152}],321:[function(require,module,exports){
|
39427
40165
|
/**
|
39428
40166
|
* @fileoverview disallow unncessary concatenation of template strings
|
39429
40167
|
* @author Henry Zhu
|
@@ -39514,7 +40252,72 @@ module.exports = function(context) {
|
|
39514
40252
|
|
39515
40253
|
module.exports.schema = [];
|
39516
40254
|
|
39517
|
-
},{"../ast-utils":152}],
|
40255
|
+
},{"../ast-utils":152}],322:[function(require,module,exports){
|
40256
|
+
/**
|
40257
|
+
* @fileoverview Rule to flag the use of redundant constructors in classes.
|
40258
|
+
* @author Alberto Rodríguez
|
40259
|
+
* @copyright 2015 Alberto Rodríguez. All rights reserved.
|
40260
|
+
* See LICENSE file in root directory for full license.
|
40261
|
+
*/
|
40262
|
+
"use strict";
|
40263
|
+
|
40264
|
+
//------------------------------------------------------------------------------
|
40265
|
+
// Rule Definition
|
40266
|
+
//------------------------------------------------------------------------------
|
40267
|
+
|
40268
|
+
module.exports = function(context) {
|
40269
|
+
|
40270
|
+
/**
|
40271
|
+
* Checks whether the constructor body is a redundant super call.
|
40272
|
+
* @param {Array} body - constructor body content.
|
40273
|
+
* @param {Array} ctorParams - The params to check against super call.
|
40274
|
+
* @returns {boolean} true if the construtor body is redundant
|
40275
|
+
*/
|
40276
|
+
function isRedundantSuperCall(body, ctorParams) {
|
40277
|
+
if (body.length !== 1 ||
|
40278
|
+
body[0].type !== "ExpressionStatement" ||
|
40279
|
+
body[0].expression.callee.type !== "Super") {
|
40280
|
+
return false;
|
40281
|
+
}
|
40282
|
+
|
40283
|
+
|
40284
|
+
return body[0].expression.arguments.every(function(arg, index) {
|
40285
|
+
return (arg.type === "Identifier" && arg.name === ctorParams[index].name) ||
|
40286
|
+
(
|
40287
|
+
arg.type === "SpreadElement" &&
|
40288
|
+
ctorParams[index].type === "RestElement" &&
|
40289
|
+
arg.argument.name === ctorParams[index].argument.name
|
40290
|
+
);
|
40291
|
+
});
|
40292
|
+
}
|
40293
|
+
|
40294
|
+
/**
|
40295
|
+
* Checks whether a node is a redundant construtor
|
40296
|
+
* @param {ASTNode} node - node to check
|
40297
|
+
* @returns {void}
|
40298
|
+
*/
|
40299
|
+
function checkForConstructor(node) {
|
40300
|
+
if (node.kind !== "constructor") {
|
40301
|
+
return;
|
40302
|
+
}
|
40303
|
+
|
40304
|
+
var body = node.value.body.body;
|
40305
|
+
|
40306
|
+
if (!node.parent.parent.superClass && body.length === 0 ||
|
40307
|
+
node.parent.parent.superClass && isRedundantSuperCall(body, node.value.params)) {
|
40308
|
+
context.report(node, "Useless constructor.");
|
40309
|
+
}
|
40310
|
+
}
|
40311
|
+
|
40312
|
+
|
40313
|
+
return {
|
40314
|
+
"MethodDefinition": checkForConstructor
|
40315
|
+
};
|
40316
|
+
};
|
40317
|
+
|
40318
|
+
module.exports.schema = [];
|
40319
|
+
|
40320
|
+
},{}],323:[function(require,module,exports){
|
39518
40321
|
/**
|
39519
40322
|
* @fileoverview Rule to check for the usage of var.
|
39520
40323
|
* @author Jamund Ferguson
|
@@ -39542,7 +40345,7 @@ module.exports = function(context) {
|
|
39542
40345
|
|
39543
40346
|
module.exports.schema = [];
|
39544
40347
|
|
39545
|
-
},{}],
|
40348
|
+
},{}],324:[function(require,module,exports){
|
39546
40349
|
/**
|
39547
40350
|
* @fileoverview Rule to disallow use of void operator.
|
39548
40351
|
* @author Mike Sidorov
|
@@ -39572,7 +40375,7 @@ module.exports = function(context) {
|
|
39572
40375
|
|
39573
40376
|
module.exports.schema = [];
|
39574
40377
|
|
39575
|
-
},{}],
|
40378
|
+
},{}],325:[function(require,module,exports){
|
39576
40379
|
/**
|
39577
40380
|
* @fileoverview Rule that warns about used warning comments
|
39578
40381
|
* @author Alexander Schmidt <https://github.com/lxanders>
|
@@ -39654,7 +40457,7 @@ module.exports = function(context) {
|
|
39654
40457
|
var matches = commentContainsWarningTerm(node.value);
|
39655
40458
|
|
39656
40459
|
matches.forEach(function(matchedTerm) {
|
39657
|
-
context.report(node, "Unexpected
|
40460
|
+
context.report(node, "Unexpected '" + matchedTerm + "' comment.");
|
39658
40461
|
});
|
39659
40462
|
}
|
39660
40463
|
|
@@ -39683,7 +40486,52 @@ module.exports.schema = [
|
|
39683
40486
|
}
|
39684
40487
|
];
|
39685
40488
|
|
39686
|
-
},{"../ast-utils":152}],
|
40489
|
+
},{"../ast-utils":152}],326:[function(require,module,exports){
|
40490
|
+
/**
|
40491
|
+
* @fileoverview Rule to disallow whitespace before properties
|
40492
|
+
* @author Kai Cataldo
|
40493
|
+
* @copyright 2015 Kai Cataldo. All rights reserved.
|
40494
|
+
* See LICENSE file in root directory for full license.
|
40495
|
+
*/
|
40496
|
+
"use strict";
|
40497
|
+
|
40498
|
+
var astUtils = require("../ast-utils");
|
40499
|
+
|
40500
|
+
//------------------------------------------------------------------------------
|
40501
|
+
// Rule Definition
|
40502
|
+
//------------------------------------------------------------------------------
|
40503
|
+
|
40504
|
+
module.exports = function(context) {
|
40505
|
+
var sourceCode = context.getSourceCode();
|
40506
|
+
|
40507
|
+
//--------------------------------------------------------------------------
|
40508
|
+
// Public
|
40509
|
+
//--------------------------------------------------------------------------
|
40510
|
+
|
40511
|
+
return {
|
40512
|
+
MemberExpression: function(node) {
|
40513
|
+
var obj = node.object;
|
40514
|
+
var prop = node.property;
|
40515
|
+
|
40516
|
+
if (astUtils.isTokenOnSameLine(obj, prop)) {
|
40517
|
+
if (sourceCode.isSpaceBetweenTokens(obj, prop)) {
|
40518
|
+
context.report({
|
40519
|
+
node: node,
|
40520
|
+
message: "Unexpected whitespace before property '{{ propName }}'.",
|
40521
|
+
data: {
|
40522
|
+
propName: prop.name
|
40523
|
+
}
|
40524
|
+
});
|
40525
|
+
}
|
40526
|
+
}
|
40527
|
+
}
|
40528
|
+
};
|
40529
|
+
};
|
40530
|
+
|
40531
|
+
module.exports.schema = [];
|
40532
|
+
|
40533
|
+
|
40534
|
+
},{"../ast-utils":152}],327:[function(require,module,exports){
|
39687
40535
|
/**
|
39688
40536
|
* @fileoverview Rule to flag use of with statement
|
39689
40537
|
* @author Nicholas C. Zakas
|
@@ -39707,7 +40555,7 @@ module.exports = function(context) {
|
|
39707
40555
|
|
39708
40556
|
module.exports.schema = [];
|
39709
40557
|
|
39710
|
-
},{}],
|
40558
|
+
},{}],328:[function(require,module,exports){
|
39711
40559
|
/**
|
39712
40560
|
* @fileoverview Disallows or enforces spaces inside of object literals.
|
39713
40561
|
* @author Jamund Ferguson
|
@@ -39974,7 +40822,7 @@ module.exports.schema = [
|
|
39974
40822
|
}
|
39975
40823
|
];
|
39976
40824
|
|
39977
|
-
},{"../ast-utils":152}],
|
40825
|
+
},{"../ast-utils":152}],329:[function(require,module,exports){
|
39978
40826
|
/**
|
39979
40827
|
* @fileoverview Rule to enforce concise object methods and properties.
|
39980
40828
|
* @author Jamund Ferguson
|
@@ -40098,7 +40946,7 @@ module.exports.schema = {
|
|
40098
40946
|
]
|
40099
40947
|
};
|
40100
40948
|
|
40101
|
-
},{}],
|
40949
|
+
},{}],330:[function(require,module,exports){
|
40102
40950
|
/**
|
40103
40951
|
* @fileoverview A rule to control the use of single variable declarations.
|
40104
40952
|
* @author Ian Christian Myers
|
@@ -40415,7 +41263,7 @@ module.exports.schema = [
|
|
40415
41263
|
}
|
40416
41264
|
];
|
40417
41265
|
|
40418
|
-
},{}],
|
41266
|
+
},{}],331:[function(require,module,exports){
|
40419
41267
|
/**
|
40420
41268
|
* @fileoverview Rule to replace assignment expressions with operator assignment
|
40421
41269
|
* @author Brandon Mills
|
@@ -40535,7 +41383,7 @@ module.exports.schema = [
|
|
40535
41383
|
}
|
40536
41384
|
];
|
40537
41385
|
|
40538
|
-
},{}],
|
41386
|
+
},{}],332:[function(require,module,exports){
|
40539
41387
|
/**
|
40540
41388
|
* @fileoverview Operator linebreak - enforces operator linebreak style of two types: after and before
|
40541
41389
|
* @author Benoît Zugmeyer
|
@@ -40593,7 +41441,8 @@ module.exports = function(context) {
|
|
40593
41441
|
|
40594
41442
|
var rightToken = context.getTokenAfter(operatorToken);
|
40595
41443
|
var operator = operatorToken.value;
|
40596
|
-
var
|
41444
|
+
var operatorStyleOverride = styleOverrides[operator];
|
41445
|
+
var style = operatorStyleOverride || globalStyle;
|
40597
41446
|
|
40598
41447
|
// if single line
|
40599
41448
|
if (astUtils.isTokenOnSameLine(leftToken, operatorToken) &&
|
@@ -40601,7 +41450,7 @@ module.exports = function(context) {
|
|
40601
41450
|
|
40602
41451
|
return;
|
40603
41452
|
|
40604
|
-
} else if (!astUtils.isTokenOnSameLine(leftToken, operatorToken) &&
|
41453
|
+
} else if (operatorStyleOverride !== "ignore" && !astUtils.isTokenOnSameLine(leftToken, operatorToken) &&
|
40605
41454
|
!astUtils.isTokenOnSameLine(operatorToken, rightToken)) {
|
40606
41455
|
|
40607
41456
|
// lone operator
|
@@ -40675,7 +41524,7 @@ module.exports.schema = [
|
|
40675
41524
|
"properties": {
|
40676
41525
|
"anyOf": {
|
40677
41526
|
"type": "string",
|
40678
|
-
"enum": ["after", "before", "none"]
|
41527
|
+
"enum": ["after", "before", "none", "ignore"]
|
40679
41528
|
}
|
40680
41529
|
}
|
40681
41530
|
}
|
@@ -40684,7 +41533,7 @@ module.exports.schema = [
|
|
40684
41533
|
}
|
40685
41534
|
];
|
40686
41535
|
|
40687
|
-
},{"../ast-utils":152,"object-assign":151}],
|
41536
|
+
},{"../ast-utils":152,"object-assign":151}],333:[function(require,module,exports){
|
40688
41537
|
/**
|
40689
41538
|
* @fileoverview A rule to ensure blank lines within blocks.
|
40690
41539
|
* @author Mathias Schreck <https://github.com/lo1tuma>
|
@@ -40811,7 +41660,7 @@ module.exports.schema = [
|
|
40811
41660
|
}
|
40812
41661
|
];
|
40813
41662
|
|
40814
|
-
},{}],
|
41663
|
+
},{}],334:[function(require,module,exports){
|
40815
41664
|
/**
|
40816
41665
|
* @fileoverview A rule to suggest using arrow functions as callbacks.
|
40817
41666
|
* @author Toru Nagashima
|
@@ -41019,7 +41868,7 @@ module.exports = function(context) {
|
|
41019
41868
|
|
41020
41869
|
module.exports.schema = [];
|
41021
41870
|
|
41022
|
-
},{}],
|
41871
|
+
},{}],335:[function(require,module,exports){
|
41023
41872
|
/**
|
41024
41873
|
* @fileoverview A rule to suggest using of const declaration for variables that are never modified after declared.
|
41025
41874
|
* @author Toru Nagashima
|
@@ -41114,7 +41963,7 @@ module.exports = function(context) {
|
|
41114
41963
|
if (writer && references.every(isInScope(writer.from))) {
|
41115
41964
|
context.report({
|
41116
41965
|
node: identifier,
|
41117
|
-
message: "
|
41966
|
+
message: "'{{name}}' is never modified, use 'const' instead.",
|
41118
41967
|
data: identifier
|
41119
41968
|
});
|
41120
41969
|
}
|
@@ -41145,7 +41994,7 @@ module.exports = function(context) {
|
|
41145
41994
|
|
41146
41995
|
module.exports.schema = [];
|
41147
41996
|
|
41148
|
-
},{}],
|
41997
|
+
},{}],336:[function(require,module,exports){
|
41149
41998
|
/**
|
41150
41999
|
* @fileoverview Rule to suggest using "Reflect" api over Function/Object methods
|
41151
42000
|
* @author Keith Cirkel <http://keithcirkel.co.uk>
|
@@ -41247,7 +42096,7 @@ module.exports.schema = [
|
|
41247
42096
|
}
|
41248
42097
|
];
|
41249
42098
|
|
41250
|
-
},{}],
|
42099
|
+
},{}],337:[function(require,module,exports){
|
41251
42100
|
/**
|
41252
42101
|
* @fileoverview Rule to
|
41253
42102
|
* @author Toru Nagashima
|
@@ -41296,7 +42145,7 @@ module.exports = function(context) {
|
|
41296
42145
|
function report(reference) {
|
41297
42146
|
context.report({
|
41298
42147
|
node: reference.identifier,
|
41299
|
-
message: "Use the rest parameters instead of
|
42148
|
+
message: "Use the rest parameters instead of 'arguments'."
|
41300
42149
|
});
|
41301
42150
|
}
|
41302
42151
|
|
@@ -41320,7 +42169,7 @@ module.exports = function(context) {
|
|
41320
42169
|
|
41321
42170
|
module.exports.schema = [];
|
41322
42171
|
|
41323
|
-
},{}],
|
42172
|
+
},{}],338:[function(require,module,exports){
|
41324
42173
|
/**
|
41325
42174
|
* @fileoverview A rule to suggest using of the spread operator instead of `.apply()`.
|
41326
42175
|
* @author Toru Nagashima
|
@@ -41406,7 +42255,7 @@ module.exports = function(context) {
|
|
41406
42255
|
var thisArg = node.arguments[0];
|
41407
42256
|
|
41408
42257
|
if (isValidThisArg(expectedThis, thisArg, context)) {
|
41409
|
-
context.report(node, "use the spread operator instead of the
|
42258
|
+
context.report(node, "use the spread operator instead of the '.apply()'.");
|
41410
42259
|
}
|
41411
42260
|
}
|
41412
42261
|
};
|
@@ -41414,7 +42263,7 @@ module.exports = function(context) {
|
|
41414
42263
|
|
41415
42264
|
module.exports.schema = [];
|
41416
42265
|
|
41417
|
-
},{"../ast-utils":152}],
|
42266
|
+
},{"../ast-utils":152}],339:[function(require,module,exports){
|
41418
42267
|
/**
|
41419
42268
|
* @fileoverview A rule to suggest using template literals instead of string concatenation.
|
41420
42269
|
* @author Toru Nagashima
|
@@ -41512,7 +42361,7 @@ module.exports = function(context) {
|
|
41512
42361
|
|
41513
42362
|
module.exports.schema = [];
|
41514
42363
|
|
41515
|
-
},{"../ast-utils":152}],
|
42364
|
+
},{"../ast-utils":152}],340:[function(require,module,exports){
|
41516
42365
|
/**
|
41517
42366
|
* @fileoverview Rule to flag non-quoted property names in object literals.
|
41518
42367
|
* @author Mathias Bynens <http://mathiasbynens.be/>
|
@@ -41539,10 +42388,10 @@ module.exports = function(context) {
|
|
41539
42388
|
CHECK_UNNECESSARY = !context.options[1] || context.options[1].unnecessary !== false,
|
41540
42389
|
NUMBERS = context.options[1] && context.options[1].numbers,
|
41541
42390
|
|
41542
|
-
MESSAGE_UNNECESSARY = "Unnecessarily quoted property
|
41543
|
-
MESSAGE_UNQUOTED = "Unquoted property
|
41544
|
-
MESSAGE_NUMERIC = "Unquoted number literal
|
41545
|
-
MESSAGE_RESERVED = "Unquoted reserved word
|
42391
|
+
MESSAGE_UNNECESSARY = "Unnecessarily quoted property '{{property}}' found.",
|
42392
|
+
MESSAGE_UNQUOTED = "Unquoted property '{{property}}' found.",
|
42393
|
+
MESSAGE_NUMERIC = "Unquoted number literal '{{property}}' used as key.",
|
42394
|
+
MESSAGE_RESERVED = "Unquoted reserved word '{{property}}' used as key.";
|
41546
42395
|
|
41547
42396
|
|
41548
42397
|
/**
|
@@ -41658,13 +42507,13 @@ module.exports = function(context) {
|
|
41658
42507
|
}
|
41659
42508
|
} else if (KEYWORDS && checkQuotesRedundancy && key.type === "Identifier" && isKeyword(key.name)) {
|
41660
42509
|
necessaryQuotes = true;
|
41661
|
-
context.report(node, "Properties should be quoted as
|
42510
|
+
context.report(node, "Properties should be quoted as '{{property}}' is a reserved word.", {property: key.name});
|
41662
42511
|
} else {
|
41663
42512
|
lackOfQuotes = true;
|
41664
42513
|
}
|
41665
42514
|
|
41666
42515
|
if (quotes && lackOfQuotes) {
|
41667
|
-
context.report(node, "Inconsistently quoted property
|
42516
|
+
context.report(node, "Inconsistently quoted property '{{key}}' found.", {
|
41668
42517
|
key: key.name || key.value
|
41669
42518
|
});
|
41670
42519
|
}
|
@@ -41736,7 +42585,7 @@ module.exports.schema = {
|
|
41736
42585
|
]
|
41737
42586
|
};
|
41738
42587
|
|
41739
|
-
},{"../util/keywords":
|
42588
|
+
},{"../util/keywords":372,"espree":"espree"}],341:[function(require,module,exports){
|
41740
42589
|
/**
|
41741
42590
|
* @fileoverview A rule to choose between single and double quote marks
|
41742
42591
|
* @author Matt DuVall <http://www.mattduvall.com/>, Brandon Payton
|
@@ -41812,6 +42661,12 @@ var AVOID_ESCAPE = "avoid-escape",
|
|
41812
42661
|
//------------------------------------------------------------------------------
|
41813
42662
|
|
41814
42663
|
module.exports = function(context) {
|
42664
|
+
|
42665
|
+
var quoteOption = context.options[0],
|
42666
|
+
settings = QUOTE_SETTINGS[quoteOption || "double"],
|
42667
|
+
avoidEscape = context.options[1] === AVOID_ESCAPE,
|
42668
|
+
sourceCode = context.getSourceCode();
|
42669
|
+
|
41815
42670
|
/**
|
41816
42671
|
* Determines if a given node is part of JSX syntax.
|
41817
42672
|
* @param {ASTNode} node The node to check.
|
@@ -41900,13 +42755,12 @@ module.exports = function(context) {
|
|
41900
42755
|
"Literal": function(node) {
|
41901
42756
|
var val = node.value,
|
41902
42757
|
rawVal = node.raw,
|
41903
|
-
quoteOption = context.options[0],
|
41904
|
-
settings = QUOTE_SETTINGS[quoteOption || "double"],
|
41905
|
-
avoidEscape = context.options[1] === AVOID_ESCAPE,
|
41906
42758
|
isValid;
|
41907
42759
|
|
41908
42760
|
if (settings && typeof val === "string") {
|
41909
|
-
isValid = (quoteOption === "backtick" && isAllowedAsNonBacktick(node)) ||
|
42761
|
+
isValid = (quoteOption === "backtick" && isAllowedAsNonBacktick(node)) ||
|
42762
|
+
isJSXElement(node.parent) ||
|
42763
|
+
astUtils.isSurroundedBy(rawVal, settings.quote);
|
41910
42764
|
|
41911
42765
|
if (!isValid && avoidEscape) {
|
41912
42766
|
isValid = astUtils.isSurroundedBy(rawVal, settings.alternateQuote) && rawVal.indexOf(settings.quote) >= 0;
|
@@ -41922,6 +42776,26 @@ module.exports = function(context) {
|
|
41922
42776
|
});
|
41923
42777
|
}
|
41924
42778
|
}
|
42779
|
+
},
|
42780
|
+
|
42781
|
+
"TemplateLiteral": function(node) {
|
42782
|
+
|
42783
|
+
// If backticks are expected or it's a tagged template, then this shouldn't throw an errors
|
42784
|
+
if (quoteOption === "backtick" || node.parent.type === "TaggedTemplateExpression") {
|
42785
|
+
return;
|
42786
|
+
}
|
42787
|
+
|
42788
|
+
var shouldWarn = node.quasis.length === 1 && (node.quasis[0].value.cooked.indexOf("\n") === -1);
|
42789
|
+
|
42790
|
+
if (shouldWarn) {
|
42791
|
+
context.report({
|
42792
|
+
node: node,
|
42793
|
+
message: "Strings must use " + settings.description + ".",
|
42794
|
+
fix: function(fixer) {
|
42795
|
+
return fixer.replaceText(node, settings.convert(sourceCode.getText(node)));
|
42796
|
+
}
|
42797
|
+
});
|
42798
|
+
}
|
41925
42799
|
}
|
41926
42800
|
};
|
41927
42801
|
|
@@ -41936,7 +42810,7 @@ module.exports.schema = [
|
|
41936
42810
|
}
|
41937
42811
|
];
|
41938
42812
|
|
41939
|
-
},{"../ast-utils":152}],
|
42813
|
+
},{"../ast-utils":152}],342:[function(require,module,exports){
|
41940
42814
|
/**
|
41941
42815
|
* @fileoverview Rule to flag use of parseInt without a radix argument
|
41942
42816
|
* @author James Allardice
|
@@ -42015,7 +42889,7 @@ module.exports.schema = [
|
|
42015
42889
|
];
|
42016
42890
|
|
42017
42891
|
|
42018
|
-
},{}],
|
42892
|
+
},{}],343:[function(require,module,exports){
|
42019
42893
|
/**
|
42020
42894
|
* @fileoverview Rule to check for jsdoc presence.
|
42021
42895
|
* @author Gyandeep Singh
|
@@ -42114,7 +42988,7 @@ module.exports.schema = [
|
|
42114
42988
|
}
|
42115
42989
|
];
|
42116
42990
|
|
42117
|
-
},{"object-assign":151}],
|
42991
|
+
},{"object-assign":151}],344:[function(require,module,exports){
|
42118
42992
|
/**
|
42119
42993
|
* @fileoverview Rule to flag the generator functions that does not have yield.
|
42120
42994
|
* @author Toru Nagashima
|
@@ -42156,7 +43030,7 @@ module.exports = function(context) {
|
|
42156
43030
|
if (countYield === 0 && node.body.body.length > 0) {
|
42157
43031
|
context.report(
|
42158
43032
|
node,
|
42159
|
-
"This generator function does not have
|
43033
|
+
"This generator function does not have 'yield'.");
|
42160
43034
|
}
|
42161
43035
|
}
|
42162
43036
|
|
@@ -42178,7 +43052,7 @@ module.exports = function(context) {
|
|
42178
43052
|
|
42179
43053
|
module.exports.schema = [];
|
42180
43054
|
|
42181
|
-
},{}],
|
43055
|
+
},{}],345:[function(require,module,exports){
|
42182
43056
|
/**
|
42183
43057
|
* @fileoverview Validates spacing before and after semicolon
|
42184
43058
|
* @author Mathias Schreck
|
@@ -42383,7 +43257,7 @@ module.exports.schema = [
|
|
42383
43257
|
}
|
42384
43258
|
];
|
42385
43259
|
|
42386
|
-
},{"../ast-utils":152}],
|
43260
|
+
},{"../ast-utils":152}],346:[function(require,module,exports){
|
42387
43261
|
/**
|
42388
43262
|
* @fileoverview Rule to flag missing semicolons.
|
42389
43263
|
* @author Nicholas C. Zakas
|
@@ -42399,8 +43273,9 @@ module.exports.schema = [
|
|
42399
43273
|
module.exports = function(context) {
|
42400
43274
|
|
42401
43275
|
var OPT_OUT_PATTERN = /[\[\(\/\+\-]/; // One of [(/+-
|
42402
|
-
|
42403
|
-
var
|
43276
|
+
var options = context.options[1];
|
43277
|
+
var never = context.options[0] === "never",
|
43278
|
+
exceptOneLine = options && options.omitLastInOneLineBlock === true,
|
42404
43279
|
sourceCode = context.getSourceCode();
|
42405
43280
|
|
42406
43281
|
//--------------------------------------------------------------------------
|
@@ -42410,15 +43285,16 @@ module.exports = function(context) {
|
|
42410
43285
|
/**
|
42411
43286
|
* Reports a semicolon error with appropriate location and message.
|
42412
43287
|
* @param {ASTNode} node The node with an extra or missing semicolon.
|
43288
|
+
* @param {boolean} missing True if the semicolon is missing.
|
42413
43289
|
* @returns {void}
|
42414
43290
|
*/
|
42415
|
-
function report(node) {
|
43291
|
+
function report(node, missing) {
|
42416
43292
|
var message,
|
42417
43293
|
fix,
|
42418
43294
|
lastToken = sourceCode.getLastToken(node),
|
42419
43295
|
loc = lastToken.loc;
|
42420
43296
|
|
42421
|
-
if (
|
43297
|
+
if (!missing) {
|
42422
43298
|
message = "Missing semicolon.";
|
42423
43299
|
loc = loc.end;
|
42424
43300
|
fix = function(fixer) {
|
@@ -42478,6 +43354,22 @@ module.exports = function(context) {
|
|
42478
43354
|
return (lastTokenLine !== nextTokenLine && !isOptOutToken) || isDivider;
|
42479
43355
|
}
|
42480
43356
|
|
43357
|
+
/**
|
43358
|
+
* Checks a node to see if it's in a one-liner block statement.
|
43359
|
+
* @param {ASTNode} node The node to check.
|
43360
|
+
* @returns {boolean} whether the node is in a one-liner block statement.
|
43361
|
+
*/
|
43362
|
+
function isOneLinerBlock(node) {
|
43363
|
+
var nextToken = context.getTokenAfter(node);
|
43364
|
+
if (!nextToken || nextToken.value !== "}") {
|
43365
|
+
return false;
|
43366
|
+
}
|
43367
|
+
|
43368
|
+
var parent = node.parent;
|
43369
|
+
return parent && parent.type === "BlockStatement" &&
|
43370
|
+
parent.loc.start.line === parent.loc.end.line;
|
43371
|
+
}
|
43372
|
+
|
42481
43373
|
/**
|
42482
43374
|
* Checks a node to see if it's followed by a semicolon.
|
42483
43375
|
* @param {ASTNode} node The node to check.
|
@@ -42486,13 +43378,19 @@ module.exports = function(context) {
|
|
42486
43378
|
function checkForSemicolon(node) {
|
42487
43379
|
var lastToken = context.getLastToken(node);
|
42488
43380
|
|
42489
|
-
if (
|
42490
|
-
if (
|
42491
|
-
report(node);
|
43381
|
+
if (never) {
|
43382
|
+
if (isUnnecessarySemicolon(lastToken)) {
|
43383
|
+
report(node, true);
|
42492
43384
|
}
|
42493
43385
|
} else {
|
42494
|
-
if (
|
42495
|
-
|
43386
|
+
if (!isSemicolon(lastToken)) {
|
43387
|
+
if (!exceptOneLine || !isOneLinerBlock(node)) {
|
43388
|
+
report(node);
|
43389
|
+
}
|
43390
|
+
} else {
|
43391
|
+
if (exceptOneLine && isOneLinerBlock(node)) {
|
43392
|
+
report(node, true);
|
43393
|
+
}
|
42496
43394
|
}
|
42497
43395
|
}
|
42498
43396
|
}
|
@@ -42519,7 +43417,6 @@ module.exports = function(context) {
|
|
42519
43417
|
//--------------------------------------------------------------------------
|
42520
43418
|
|
42521
43419
|
return {
|
42522
|
-
|
42523
43420
|
"VariableDeclaration": checkForSemicolonForVariableDeclaration,
|
42524
43421
|
"ExpressionStatement": checkForSemicolon,
|
42525
43422
|
"ReturnStatement": checkForSemicolon,
|
@@ -42544,13 +43441,197 @@ module.exports = function(context) {
|
|
42544
43441
|
|
42545
43442
|
};
|
42546
43443
|
|
43444
|
+
module.exports.schema = {
|
43445
|
+
"anyOf": [
|
43446
|
+
{
|
43447
|
+
"type": "array",
|
43448
|
+
"items": [
|
43449
|
+
{
|
43450
|
+
"enum": ["never"]
|
43451
|
+
}
|
43452
|
+
],
|
43453
|
+
"minItems": 0,
|
43454
|
+
"maxItems": 1
|
43455
|
+
},
|
43456
|
+
{
|
43457
|
+
"type": "array",
|
43458
|
+
"items": [
|
43459
|
+
{
|
43460
|
+
"enum": ["always"]
|
43461
|
+
},
|
43462
|
+
{
|
43463
|
+
"type": "object",
|
43464
|
+
"properties": {
|
43465
|
+
"omitLastInOneLineBlock": {"type": "boolean"}
|
43466
|
+
},
|
43467
|
+
"additionalProperties": false
|
43468
|
+
}
|
43469
|
+
],
|
43470
|
+
"minItems": 0,
|
43471
|
+
"maxItems": 2
|
43472
|
+
}
|
43473
|
+
]
|
43474
|
+
};
|
43475
|
+
|
43476
|
+
},{}],347:[function(require,module,exports){
|
43477
|
+
/**
|
43478
|
+
* @fileoverview Rule to require sorting of import declarations
|
43479
|
+
* @author Christian Schuller
|
43480
|
+
* @copyright 2015 Christian Schuller. All rights reserved.
|
43481
|
+
* See LICENSE file in root directory for full license.
|
43482
|
+
*/
|
43483
|
+
|
43484
|
+
"use strict";
|
43485
|
+
|
43486
|
+
//------------------------------------------------------------------------------
|
43487
|
+
// Rule Definition
|
43488
|
+
//------------------------------------------------------------------------------
|
43489
|
+
|
43490
|
+
module.exports = function(context) {
|
43491
|
+
|
43492
|
+
var configuration = context.options[0] || {},
|
43493
|
+
ignoreCase = configuration.ignoreCase || false,
|
43494
|
+
ignoreMemberSort = configuration.ignoreMemberSort || false,
|
43495
|
+
memberSyntaxSortOrder = configuration.memberSyntaxSortOrder || ["none", "all", "multiple", "single"],
|
43496
|
+
previousDeclaration = null;
|
43497
|
+
|
43498
|
+
/**
|
43499
|
+
* Gets the used member syntax style.
|
43500
|
+
*
|
43501
|
+
* import "my-module.js" --> none
|
43502
|
+
* import * as myModule from "my-module.js" --> all
|
43503
|
+
* import {myMember} from "my-module.js" --> single
|
43504
|
+
* import {foo, bar} from "my-module.js" --> multiple
|
43505
|
+
*
|
43506
|
+
* @param {ASTNode} node - the ImportDeclaration node.
|
43507
|
+
* @returns {string} used member parameter style, ["all", "multiple", "single"]
|
43508
|
+
*/
|
43509
|
+
function usedMemberSyntax(node) {
|
43510
|
+
if (node.specifiers.length === 0) {
|
43511
|
+
return "none";
|
43512
|
+
} else if (node.specifiers[0].type === "ImportNamespaceSpecifier") {
|
43513
|
+
return "all";
|
43514
|
+
} else if (node.specifiers.length === 1) {
|
43515
|
+
return "single";
|
43516
|
+
} else {
|
43517
|
+
return "multiple";
|
43518
|
+
}
|
43519
|
+
}
|
43520
|
+
|
43521
|
+
/**
|
43522
|
+
* Gets the group by member parameter index for given declaration.
|
43523
|
+
* @param {ASTNode} node - the ImportDeclaration node.
|
43524
|
+
* @returns {number} the declaration group by member index.
|
43525
|
+
*/
|
43526
|
+
function getMemberParameterGroupIndex(node) {
|
43527
|
+
return memberSyntaxSortOrder.indexOf(usedMemberSyntax(node));
|
43528
|
+
}
|
43529
|
+
|
43530
|
+
/**
|
43531
|
+
* Gets the local name of the first imported module.
|
43532
|
+
* @param {ASTNode} node - the ImportDeclaration node.
|
43533
|
+
* @returns {?string} the local name of the first imported module.
|
43534
|
+
*/
|
43535
|
+
function getFirstLocalMemberName(node) {
|
43536
|
+
if (node.specifiers[0]) {
|
43537
|
+
return node.specifiers[0].local.name;
|
43538
|
+
} else {
|
43539
|
+
return null;
|
43540
|
+
}
|
43541
|
+
}
|
43542
|
+
|
43543
|
+
return {
|
43544
|
+
"ImportDeclaration": function(node) {
|
43545
|
+
if (previousDeclaration) {
|
43546
|
+
var currentLocalMemberName = getFirstLocalMemberName(node),
|
43547
|
+
currentMemberSyntaxGroupIndex = getMemberParameterGroupIndex(node),
|
43548
|
+
previousLocalMemberName = getFirstLocalMemberName(previousDeclaration),
|
43549
|
+
previousMemberSyntaxGroupIndex = getMemberParameterGroupIndex(previousDeclaration);
|
43550
|
+
|
43551
|
+
if (ignoreCase) {
|
43552
|
+
previousLocalMemberName = previousLocalMemberName.toLowerCase();
|
43553
|
+
currentLocalMemberName = currentLocalMemberName.toLowerCase();
|
43554
|
+
}
|
43555
|
+
|
43556
|
+
// When the current declaration uses a different member syntax,
|
43557
|
+
// then check if the ordering is correct.
|
43558
|
+
// Otherwise, make a default string compare (like rule sort-vars to be consistent) of the first used local member name.
|
43559
|
+
if (currentMemberSyntaxGroupIndex !== previousMemberSyntaxGroupIndex) {
|
43560
|
+
if (currentMemberSyntaxGroupIndex < previousMemberSyntaxGroupIndex) {
|
43561
|
+
context.report({
|
43562
|
+
node: node,
|
43563
|
+
message: "Expected '{{syntaxA}}' syntax before '{{syntaxB}}' syntax.",
|
43564
|
+
data: {
|
43565
|
+
syntaxA: memberSyntaxSortOrder[currentMemberSyntaxGroupIndex],
|
43566
|
+
syntaxB: memberSyntaxSortOrder[previousMemberSyntaxGroupIndex]
|
43567
|
+
}
|
43568
|
+
});
|
43569
|
+
}
|
43570
|
+
} else {
|
43571
|
+
if (currentLocalMemberName < previousLocalMemberName) {
|
43572
|
+
context.report({
|
43573
|
+
node: node,
|
43574
|
+
message: "Imports should be sorted alphabetically."
|
43575
|
+
});
|
43576
|
+
}
|
43577
|
+
}
|
43578
|
+
}
|
43579
|
+
|
43580
|
+
// Multiple members of an import declaration should also be sorted alphabetically.
|
43581
|
+
if (!ignoreMemberSort && node.specifiers.length > 1) {
|
43582
|
+
node.specifiers.reduce(function(previousSpecifier, currentSpecifier) {
|
43583
|
+
var currentSpecifierName = currentSpecifier.local.name,
|
43584
|
+
previousSpecifierName = previousSpecifier.local.name;
|
43585
|
+
|
43586
|
+
if (ignoreCase) {
|
43587
|
+
currentSpecifierName = currentSpecifierName.toLowerCase();
|
43588
|
+
previousSpecifierName = previousSpecifierName.toLowerCase();
|
43589
|
+
}
|
43590
|
+
|
43591
|
+
if (currentSpecifierName < previousSpecifierName) {
|
43592
|
+
context.report({
|
43593
|
+
node: currentSpecifier,
|
43594
|
+
message: "Member '{{memberName}}' of the import declaration should be sorted alphabetically.",
|
43595
|
+
data: {
|
43596
|
+
memberName: currentSpecifier.local.name
|
43597
|
+
}
|
43598
|
+
});
|
43599
|
+
}
|
43600
|
+
|
43601
|
+
return currentSpecifier;
|
43602
|
+
}, node.specifiers[0]);
|
43603
|
+
}
|
43604
|
+
|
43605
|
+
previousDeclaration = node;
|
43606
|
+
}
|
43607
|
+
};
|
43608
|
+
};
|
43609
|
+
|
42547
43610
|
module.exports.schema = [
|
42548
43611
|
{
|
42549
|
-
"
|
43612
|
+
"type": "object",
|
43613
|
+
"properties": {
|
43614
|
+
"ignoreCase": {
|
43615
|
+
"type": "boolean"
|
43616
|
+
},
|
43617
|
+
"memberSyntaxSortOrder": {
|
43618
|
+
"type": "array",
|
43619
|
+
"items": {
|
43620
|
+
"enum": ["none", "all", "multiple", "single"]
|
43621
|
+
},
|
43622
|
+
"uniqueItems": true,
|
43623
|
+
"minItems": 4,
|
43624
|
+
"maxItems": 4
|
43625
|
+
},
|
43626
|
+
"ignoreMemberSort": {
|
43627
|
+
"type": "boolean"
|
43628
|
+
}
|
43629
|
+
},
|
43630
|
+
"additionalProperties": false
|
42550
43631
|
}
|
42551
43632
|
];
|
42552
43633
|
|
42553
|
-
},{}],
|
43634
|
+
},{}],348:[function(require,module,exports){
|
42554
43635
|
/**
|
42555
43636
|
* @fileoverview Rule to require sorting of variables within a single Variable Declaration block
|
42556
43637
|
* @author Ilya Volodin
|
@@ -42605,7 +43686,7 @@ module.exports.schema = [
|
|
42605
43686
|
}
|
42606
43687
|
];
|
42607
43688
|
|
42608
|
-
},{}],
|
43689
|
+
},{}],349:[function(require,module,exports){
|
42609
43690
|
/**
|
42610
43691
|
* @fileoverview Rule to enforce the number of spaces after certain keywords
|
42611
43692
|
* @author Nick Fisher
|
@@ -42642,7 +43723,7 @@ module.exports = function(context) {
|
|
42642
43723
|
context.report({
|
42643
43724
|
node: node,
|
42644
43725
|
loc: left.loc.end,
|
42645
|
-
message: "Keyword
|
43726
|
+
message: "Keyword '{{value}}' must {{not}}be followed by whitespace.",
|
42646
43727
|
data: {
|
42647
43728
|
value: value,
|
42648
43729
|
not: requiresSpace ? "" : "not "
|
@@ -42705,7 +43786,7 @@ module.exports.schema = [
|
|
42705
43786
|
}
|
42706
43787
|
];
|
42707
43788
|
|
42708
|
-
},{}],
|
43789
|
+
},{}],350:[function(require,module,exports){
|
42709
43790
|
/**
|
42710
43791
|
* @fileoverview A rule to ensure whitespace before blocks.
|
42711
43792
|
* @author Mathias Schreck <https://github.com/lo1tuma>
|
@@ -42724,24 +43805,28 @@ module.exports = function(context) {
|
|
42724
43805
|
var config = context.options[0],
|
42725
43806
|
sourceCode = context.getSourceCode(),
|
42726
43807
|
checkFunctions = true,
|
42727
|
-
checkKeywords = true
|
43808
|
+
checkKeywords = true,
|
43809
|
+
checkClasses = true;
|
42728
43810
|
|
42729
43811
|
if (typeof config === "object") {
|
42730
43812
|
checkFunctions = config.functions !== "never";
|
42731
43813
|
checkKeywords = config.keywords !== "never";
|
43814
|
+
checkClasses = config.classes !== "never";
|
42732
43815
|
} else if (config === "never") {
|
42733
43816
|
checkFunctions = false;
|
42734
43817
|
checkKeywords = false;
|
43818
|
+
checkClasses = false;
|
42735
43819
|
}
|
42736
43820
|
|
42737
43821
|
/**
|
42738
|
-
* Checks whether or not a given token is an arrow operator (=>)
|
43822
|
+
* Checks whether or not a given token is an arrow operator (=>) or a keyword
|
43823
|
+
* in order to avoid to conflict with `arrow-spacing` and `keyword-spacing`.
|
42739
43824
|
*
|
42740
43825
|
* @param {Token} token - A token to check.
|
42741
43826
|
* @returns {boolean} `true` if the token is an arrow operator.
|
42742
43827
|
*/
|
42743
|
-
function
|
42744
|
-
return token.type === "Punctuator" && token.value === "=>";
|
43828
|
+
function isConflicted(token) {
|
43829
|
+
return (token.type === "Punctuator" && token.value === "=>") || token.type === "Keyword";
|
42745
43830
|
}
|
42746
43831
|
|
42747
43832
|
/**
|
@@ -42755,11 +43840,13 @@ module.exports = function(context) {
|
|
42755
43840
|
parent,
|
42756
43841
|
requireSpace;
|
42757
43842
|
|
42758
|
-
if (precedingToken && !
|
43843
|
+
if (precedingToken && !isConflicted(precedingToken) && astUtils.isTokenOnSameLine(precedingToken, node)) {
|
42759
43844
|
hasSpace = sourceCode.isSpaceBetweenTokens(precedingToken, node);
|
42760
43845
|
parent = context.getAncestors().pop();
|
42761
43846
|
if (parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration") {
|
42762
43847
|
requireSpace = checkFunctions;
|
43848
|
+
} else if (node.type === "ClassBody") {
|
43849
|
+
requireSpace = checkClasses;
|
42763
43850
|
} else {
|
42764
43851
|
requireSpace = checkKeywords;
|
42765
43852
|
}
|
@@ -42830,6 +43917,9 @@ module.exports.schema = [
|
|
42830
43917
|
},
|
42831
43918
|
"functions": {
|
42832
43919
|
"enum": ["always", "never"]
|
43920
|
+
},
|
43921
|
+
"classes": {
|
43922
|
+
"enum": ["always", "never"]
|
42833
43923
|
}
|
42834
43924
|
},
|
42835
43925
|
"additionalProperties": false
|
@@ -42838,7 +43928,7 @@ module.exports.schema = [
|
|
42838
43928
|
}
|
42839
43929
|
];
|
42840
43930
|
|
42841
|
-
},{"../ast-utils":152}],
|
43931
|
+
},{"../ast-utils":152}],351:[function(require,module,exports){
|
42842
43932
|
/**
|
42843
43933
|
* @fileoverview Rule to validate spacing before function paren.
|
42844
43934
|
* @author Mathias Schreck <https://github.com/lo1tuma>
|
@@ -42964,7 +44054,7 @@ module.exports.schema = [
|
|
42964
44054
|
}
|
42965
44055
|
];
|
42966
44056
|
|
42967
|
-
},{}],
|
44057
|
+
},{}],352:[function(require,module,exports){
|
42968
44058
|
/**
|
42969
44059
|
* @fileoverview Require or disallow spaces before keywords
|
42970
44060
|
* @author Marko Raatikka
|
@@ -42979,8 +44069,8 @@ var astUtils = require("../ast-utils");
|
|
42979
44069
|
// Rule Definition
|
42980
44070
|
//------------------------------------------------------------------------------
|
42981
44071
|
|
42982
|
-
var ERROR_MSG_SPACE_EXPECTED = "Missing space before keyword
|
42983
|
-
var ERROR_MSG_NO_SPACE_EXPECTED = "Unexpected space before keyword
|
44072
|
+
var ERROR_MSG_SPACE_EXPECTED = "Missing space before keyword '{{keyword}}'.";
|
44073
|
+
var ERROR_MSG_NO_SPACE_EXPECTED = "Unexpected space before keyword '{{keyword}}'.";
|
42984
44074
|
|
42985
44075
|
module.exports = function(context) {
|
42986
44076
|
|
@@ -43180,7 +44270,7 @@ module.exports.schema = [
|
|
43180
44270
|
}
|
43181
44271
|
];
|
43182
44272
|
|
43183
|
-
},{"../ast-utils":152}],
|
44273
|
+
},{"../ast-utils":152}],353:[function(require,module,exports){
|
43184
44274
|
/**
|
43185
44275
|
* @fileoverview Disallows or enforces spaces inside of parentheses.
|
43186
44276
|
* @author Jonathan Rajavuori
|
@@ -43421,7 +44511,7 @@ module.exports.schema = [
|
|
43421
44511
|
}
|
43422
44512
|
];
|
43423
44513
|
|
43424
|
-
},{"../ast-utils":152}],
|
44514
|
+
},{"../ast-utils":152}],354:[function(require,module,exports){
|
43425
44515
|
/**
|
43426
44516
|
* @fileoverview Require spaces around infix operators
|
43427
44517
|
* @author Michael Ficarra
|
@@ -43569,7 +44659,7 @@ module.exports.schema = [
|
|
43569
44659
|
}
|
43570
44660
|
];
|
43571
44661
|
|
43572
|
-
},{}],
|
44662
|
+
},{}],355:[function(require,module,exports){
|
43573
44663
|
/**
|
43574
44664
|
* @fileoverview Require spaces following return, throw, and case
|
43575
44665
|
* @author Michael Ficarra
|
@@ -43595,7 +44685,7 @@ module.exports = function(context) {
|
|
43595
44685
|
if (tokens[0].range[1] >= tokens[1].range[0]) {
|
43596
44686
|
context.report({
|
43597
44687
|
node: node,
|
43598
|
-
message: "Keyword
|
44688
|
+
message: "Keyword '" + value + "' must be followed by whitespace.",
|
43599
44689
|
fix: function(fixer) {
|
43600
44690
|
return fixer.insertTextAfterRange(tokens[0].range, " ");
|
43601
44691
|
}
|
@@ -43621,7 +44711,7 @@ module.exports = function(context) {
|
|
43621
44711
|
|
43622
44712
|
module.exports.schema = [];
|
43623
44713
|
|
43624
|
-
},{}],
|
44714
|
+
},{}],356:[function(require,module,exports){
|
43625
44715
|
/**
|
43626
44716
|
* @fileoverview This rule shoud require or disallow spaces before or after unary operations.
|
43627
44717
|
* @author Marcin Kumorek
|
@@ -43674,7 +44764,7 @@ module.exports = function(context) {
|
|
43674
44764
|
if (secondToken.range[0] === firstToken.range[1]) {
|
43675
44765
|
context.report({
|
43676
44766
|
node: node,
|
43677
|
-
message: "Unary word operator
|
44767
|
+
message: "Unary word operator '" + word + "' must be followed by whitespace.",
|
43678
44768
|
fix: function(fixer) {
|
43679
44769
|
return fixer.insertTextAfter(firstToken, " ");
|
43680
44770
|
}
|
@@ -43686,7 +44776,7 @@ module.exports = function(context) {
|
|
43686
44776
|
if (secondToken.range[0] > firstToken.range[1]) {
|
43687
44777
|
context.report({
|
43688
44778
|
node: node,
|
43689
|
-
message: "Unexpected space after unary word operator
|
44779
|
+
message: "Unexpected space after unary word operator '" + word + "'.",
|
43690
44780
|
fix: function(fixer) {
|
43691
44781
|
return fixer.removeRange([firstToken.range[1], secondToken.range[0]]);
|
43692
44782
|
}
|
@@ -43718,7 +44808,7 @@ module.exports = function(context) {
|
|
43718
44808
|
if (firstToken.range[1] === secondToken.range[0]) {
|
43719
44809
|
context.report({
|
43720
44810
|
node: node,
|
43721
|
-
message: "Unary operator
|
44811
|
+
message: "Unary operator '" + firstToken.value + "' must be followed by whitespace.",
|
43722
44812
|
fix: function(fixer) {
|
43723
44813
|
return fixer.insertTextAfter(firstToken, " ");
|
43724
44814
|
}
|
@@ -43728,7 +44818,7 @@ module.exports = function(context) {
|
|
43728
44818
|
if (firstToken.range[1] === secondToken.range[0]) {
|
43729
44819
|
context.report({
|
43730
44820
|
node: node,
|
43731
|
-
message: "Space is required before unary expressions
|
44821
|
+
message: "Space is required before unary expressions '" + secondToken.value + "'.",
|
43732
44822
|
fix: function(fixer) {
|
43733
44823
|
return fixer.insertTextBefore(secondToken, " ");
|
43734
44824
|
}
|
@@ -43740,7 +44830,7 @@ module.exports = function(context) {
|
|
43740
44830
|
if (secondToken.range[0] > firstToken.range[1]) {
|
43741
44831
|
context.report({
|
43742
44832
|
node: node,
|
43743
|
-
message: "Unexpected space after unary operator
|
44833
|
+
message: "Unexpected space after unary operator '" + firstToken.value + "'.",
|
43744
44834
|
fix: function(fixer) {
|
43745
44835
|
return fixer.removeRange([firstToken.range[1], secondToken.range[0]]);
|
43746
44836
|
}
|
@@ -43750,7 +44840,7 @@ module.exports = function(context) {
|
|
43750
44840
|
if (secondToken.range[0] > firstToken.range[1]) {
|
43751
44841
|
context.report({
|
43752
44842
|
node: node,
|
43753
|
-
message: "Unexpected space before unary operator
|
44843
|
+
message: "Unexpected space before unary operator '" + secondToken.value + "'.",
|
43754
44844
|
fix: function(fixer) {
|
43755
44845
|
return fixer.removeRange([firstToken.range[1], secondToken.range[0]]);
|
43756
44846
|
}
|
@@ -43797,7 +44887,7 @@ module.exports.schema = [
|
|
43797
44887
|
}
|
43798
44888
|
];
|
43799
44889
|
|
43800
|
-
},{}],
|
44890
|
+
},{}],357:[function(require,module,exports){
|
43801
44891
|
/**
|
43802
44892
|
* @fileoverview Source code for spaced-comments rule
|
43803
44893
|
* @author Gyandeep Singh
|
@@ -43963,16 +45053,16 @@ module.exports = function(context) {
|
|
43963
45053
|
if (requireSpace) {
|
43964
45054
|
if (!rule.regex.test(node.value)) {
|
43965
45055
|
if (rule.hasExceptions) {
|
43966
|
-
context.report(node, "Expected exception block, space or tab after
|
45056
|
+
context.report(node, "Expected exception block, space or tab after '" + commentIdentifier + "' in comment.");
|
43967
45057
|
} else {
|
43968
|
-
context.report(node, "Expected space or tab after
|
45058
|
+
context.report(node, "Expected space or tab after '" + commentIdentifier + "' in comment.");
|
43969
45059
|
}
|
43970
45060
|
}
|
43971
45061
|
} else {
|
43972
45062
|
var matched = rule.regex.exec(node.value);
|
43973
45063
|
if (matched) {
|
43974
45064
|
if (!matched[1]) {
|
43975
|
-
context.report(node, "Unexpected space or tab after
|
45065
|
+
context.report(node, "Unexpected space or tab after '" + commentIdentifier + "' in comment.");
|
43976
45066
|
} else {
|
43977
45067
|
context.report(node, "Unexpected space or tab after marker (" + matched[1] + ") in comment.");
|
43978
45068
|
}
|
@@ -44048,7 +45138,7 @@ module.exports.schema = [
|
|
44048
45138
|
}
|
44049
45139
|
];
|
44050
45140
|
|
44051
|
-
},{"escape-string-regexp":76}],
|
45141
|
+
},{"escape-string-regexp":76}],358:[function(require,module,exports){
|
44052
45142
|
/**
|
44053
45143
|
* @fileoverview Rule to control usage of strict mode directives.
|
44054
45144
|
* @author Brandon Mills
|
@@ -44064,13 +45154,13 @@ module.exports.schema = [
|
|
44064
45154
|
//------------------------------------------------------------------------------
|
44065
45155
|
|
44066
45156
|
var messages = {
|
44067
|
-
function: "Use the function form of
|
44068
|
-
global: "Use the global form of
|
44069
|
-
multiple: "Multiple
|
45157
|
+
function: "Use the function form of 'use strict'.",
|
45158
|
+
global: "Use the global form of 'use strict'.",
|
45159
|
+
multiple: "Multiple 'use strict' directives.",
|
44070
45160
|
never: "Strict mode is not permitted.",
|
44071
|
-
unnecessary: "Unnecessary
|
44072
|
-
unnecessaryInModules: "
|
44073
|
-
unnecessaryInClasses: "
|
45161
|
+
unnecessary: "Unnecessary 'use strict' directive.",
|
45162
|
+
unnecessaryInModules: "'use strict' is unnecessary inside of modules.",
|
45163
|
+
unnecessaryInClasses: "'use strict' is unnecessary inside of classes."
|
44074
45164
|
};
|
44075
45165
|
|
44076
45166
|
/**
|
@@ -44280,7 +45370,7 @@ module.exports.schema = [
|
|
44280
45370
|
}
|
44281
45371
|
];
|
44282
45372
|
|
44283
|
-
},{}],
|
45373
|
+
},{}],359:[function(require,module,exports){
|
44284
45374
|
/**
|
44285
45375
|
* @fileoverview Rule to flag comparisons to the value NaN
|
44286
45376
|
* @author James Allardice
|
@@ -44308,7 +45398,7 @@ module.exports = function(context) {
|
|
44308
45398
|
|
44309
45399
|
module.exports.schema = [];
|
44310
45400
|
|
44311
|
-
},{}],
|
45401
|
+
},{}],360:[function(require,module,exports){
|
44312
45402
|
/**
|
44313
45403
|
* @fileoverview Validates JSDoc comments are syntactically correct
|
44314
45404
|
* @author Nicholas C. Zakas
|
@@ -44403,6 +45493,7 @@ module.exports = function(context) {
|
|
44403
45493
|
functionData = fns.pop(),
|
44404
45494
|
hasReturns = false,
|
44405
45495
|
hasConstructor = false,
|
45496
|
+
isInterface = false,
|
44406
45497
|
isOverride = false,
|
44407
45498
|
params = Object.create(null),
|
44408
45499
|
jsdoc;
|
@@ -44429,7 +45520,7 @@ module.exports = function(context) {
|
|
44429
45520
|
|
44430
45521
|
jsdoc.tags.forEach(function(tag) {
|
44431
45522
|
|
44432
|
-
switch (tag.title) {
|
45523
|
+
switch (tag.title.toLowerCase()) {
|
44433
45524
|
|
44434
45525
|
case "param":
|
44435
45526
|
case "arg":
|
@@ -44477,6 +45568,10 @@ module.exports = function(context) {
|
|
44477
45568
|
isOverride = true;
|
44478
45569
|
break;
|
44479
45570
|
|
45571
|
+
case "interface":
|
45572
|
+
isInterface = true;
|
45573
|
+
break;
|
45574
|
+
|
44480
45575
|
// no default
|
44481
45576
|
}
|
44482
45577
|
|
@@ -44488,7 +45583,7 @@ module.exports = function(context) {
|
|
44488
45583
|
});
|
44489
45584
|
|
44490
45585
|
// check for functions missing @returns
|
44491
|
-
if (!isOverride && !hasReturns && !hasConstructor && node.parent.kind !== "get" && !isTypeClass(node)) {
|
45586
|
+
if (!isOverride && !hasReturns && !hasConstructor && !isInterface && node.parent.kind !== "get" && !isTypeClass(node)) {
|
44492
45587
|
if (requireReturn || functionData.returnPresent) {
|
44493
45588
|
context.report(jsdocNode, "Missing JSDoc @" + (prefer.returns || "returns") + " for function.");
|
44494
45589
|
}
|
@@ -44579,7 +45674,7 @@ module.exports.schema = [
|
|
44579
45674
|
}
|
44580
45675
|
];
|
44581
45676
|
|
44582
|
-
},{"doctrine":14}],
|
45677
|
+
},{"doctrine":14}],361:[function(require,module,exports){
|
44583
45678
|
/**
|
44584
45679
|
* @fileoverview Ensures that the results of typeof are compared against a valid string
|
44585
45680
|
* @author Ian Christian Myers
|
@@ -44623,7 +45718,7 @@ module.exports = function(context) {
|
|
44623
45718
|
|
44624
45719
|
module.exports.schema = [];
|
44625
45720
|
|
44626
|
-
},{}],
|
45721
|
+
},{}],362:[function(require,module,exports){
|
44627
45722
|
/**
|
44628
45723
|
* @fileoverview Rule to enforce var declarations are only at the top of a function.
|
44629
45724
|
* @author Danny Fritz
|
@@ -44638,7 +45733,7 @@ module.exports.schema = [];
|
|
44638
45733
|
//------------------------------------------------------------------------------
|
44639
45734
|
|
44640
45735
|
module.exports = function(context) {
|
44641
|
-
var errorMessage = "All
|
45736
|
+
var errorMessage = "All 'var' declarations must be at the top of the function scope.";
|
44642
45737
|
|
44643
45738
|
//--------------------------------------------------------------------------
|
44644
45739
|
// Helpers
|
@@ -44742,7 +45837,7 @@ module.exports = function(context) {
|
|
44742
45837
|
|
44743
45838
|
module.exports.schema = [];
|
44744
45839
|
|
44745
|
-
},{}],
|
45840
|
+
},{}],363:[function(require,module,exports){
|
44746
45841
|
/**
|
44747
45842
|
* @fileoverview Rule to flag when IIFE is not wrapped in parens
|
44748
45843
|
* @author Ilya Volodin
|
@@ -44798,7 +45893,7 @@ module.exports.schema = [
|
|
44798
45893
|
}
|
44799
45894
|
];
|
44800
45895
|
|
44801
|
-
},{}],
|
45896
|
+
},{}],364:[function(require,module,exports){
|
44802
45897
|
/**
|
44803
45898
|
* @fileoverview Rule to flag when regex literals are not wrapped in parens
|
44804
45899
|
* @author Matt DuVall <http://www.mattduvall.com>
|
@@ -44838,7 +45933,7 @@ module.exports = function(context) {
|
|
44838
45933
|
|
44839
45934
|
module.exports.schema = [];
|
44840
45935
|
|
44841
|
-
},{}],
|
45936
|
+
},{}],365:[function(require,module,exports){
|
44842
45937
|
/**
|
44843
45938
|
* @fileoverview Rule to check the spacing around the * in yield* expressions.
|
44844
45939
|
* @author Bryan Smith
|
@@ -44941,7 +46036,7 @@ module.exports.schema = [
|
|
44941
46036
|
}
|
44942
46037
|
];
|
44943
46038
|
|
44944
|
-
},{}],
|
46039
|
+
},{}],366:[function(require,module,exports){
|
44945
46040
|
/**
|
44946
46041
|
* @fileoverview Rule to require or disallow yoda comparisons
|
44947
46042
|
* @author Nicholas C. Zakas
|
@@ -45185,7 +46280,7 @@ module.exports.schema = [
|
|
45185
46280
|
}
|
45186
46281
|
];
|
45187
46282
|
|
45188
|
-
},{}],
|
46283
|
+
},{}],367:[function(require,module,exports){
|
45189
46284
|
(function (process){
|
45190
46285
|
/**
|
45191
46286
|
* @fileoverview Tracks performance of individual rules.
|
@@ -45327,7 +46422,7 @@ module.exports = (function() {
|
|
45327
46422
|
}());
|
45328
46423
|
|
45329
46424
|
}).call(this,require('_process'))
|
45330
|
-
},{"_process":8}],
|
46425
|
+
},{"_process":8}],368:[function(require,module,exports){
|
45331
46426
|
/**
|
45332
46427
|
* @fileoverview Object to handle access and retrieval of tokens.
|
45333
46428
|
* @author Brandon Mills
|
@@ -45530,7 +46625,7 @@ module.exports = function(tokens) {
|
|
45530
46625
|
return api;
|
45531
46626
|
};
|
45532
46627
|
|
45533
|
-
},{}],
|
46628
|
+
},{}],369:[function(require,module,exports){
|
45534
46629
|
/**
|
45535
46630
|
* @fileoverview Common utilities.
|
45536
46631
|
*/
|
@@ -45592,7 +46687,7 @@ module.exports = {
|
|
45592
46687
|
getLast: getLast
|
45593
46688
|
};
|
45594
46689
|
|
45595
|
-
},{}],
|
46690
|
+
},{}],370:[function(require,module,exports){
|
45596
46691
|
/**
|
45597
46692
|
* @fileoverview The event generator for comments.
|
45598
46693
|
* @author Toru Nagashima
|
@@ -45710,7 +46805,7 @@ CommentEventGenerator.prototype = {
|
|
45710
46805
|
|
45711
46806
|
module.exports = CommentEventGenerator;
|
45712
46807
|
|
45713
|
-
},{}],
|
46808
|
+
},{}],371:[function(require,module,exports){
|
45714
46809
|
/**
|
45715
46810
|
* @fileoverview Patch for estraverse
|
45716
46811
|
* @author Toru Nagashima
|
@@ -45766,7 +46861,7 @@ installKeys(experimentalKeys);
|
|
45766
46861
|
|
45767
46862
|
module.exports = estraverse;
|
45768
46863
|
|
45769
|
-
},{"estraverse":136,"estraverse-fb/keys":135}],
|
46864
|
+
},{"estraverse":136,"estraverse-fb/keys":135}],372:[function(require,module,exports){
|
45770
46865
|
/**
|
45771
46866
|
* @fileoverview A shared list of ES3 keywords.
|
45772
46867
|
* @author Josh Perez
|
@@ -45836,7 +46931,7 @@ module.exports = [
|
|
45836
46931
|
"with"
|
45837
46932
|
];
|
45838
46933
|
|
45839
|
-
},{}],
|
46934
|
+
},{}],373:[function(require,module,exports){
|
45840
46935
|
/**
|
45841
46936
|
* @fileoverview The event generator for AST nodes.
|
45842
46937
|
* @author Toru Nagashima
|
@@ -45893,7 +46988,7 @@ NodeEventGenerator.prototype = {
|
|
45893
46988
|
|
45894
46989
|
module.exports = NodeEventGenerator;
|
45895
46990
|
|
45896
|
-
},{}],
|
46991
|
+
},{}],374:[function(require,module,exports){
|
45897
46992
|
/**
|
45898
46993
|
* @fileoverview An object that creates fix commands for rules.
|
45899
46994
|
* @author Nicholas C. Zakas
|
@@ -46042,7 +47137,7 @@ RuleFixer.prototype = {
|
|
46042
47137
|
|
46043
47138
|
module.exports = RuleFixer;
|
46044
47139
|
|
46045
|
-
},{}],
|
47140
|
+
},{}],375:[function(require,module,exports){
|
46046
47141
|
/**
|
46047
47142
|
* @fileoverview Abstraction of JavaScript source code.
|
46048
47143
|
* @author Nicholas C. Zakas
|
@@ -46261,29 +47356,28 @@ SourceCode.prototype = {
|
|
46261
47356
|
*/
|
46262
47357
|
getJSDocComment: function(node) {
|
46263
47358
|
|
46264
|
-
var parent = node.parent
|
46265
|
-
line = node.loc.start.line;
|
47359
|
+
var parent = node.parent;
|
46266
47360
|
|
46267
47361
|
switch (node.type) {
|
46268
47362
|
case "ClassDeclaration":
|
46269
47363
|
case "FunctionDeclaration":
|
46270
47364
|
if (looksLikeExport(parent)) {
|
46271
|
-
return findJSDocComment(parent.leadingComments, line);
|
47365
|
+
return findJSDocComment(parent.leadingComments, parent.loc.start.line);
|
46272
47366
|
}
|
46273
|
-
return findJSDocComment(node.leadingComments, line);
|
47367
|
+
return findJSDocComment(node.leadingComments, node.loc.start.line);
|
46274
47368
|
|
46275
47369
|
case "ClassExpression":
|
46276
|
-
return findJSDocComment(parent.parent.leadingComments, line);
|
47370
|
+
return findJSDocComment(parent.parent.leadingComments, parent.parent.loc.start.line);
|
46277
47371
|
|
46278
47372
|
case "ArrowFunctionExpression":
|
46279
47373
|
case "FunctionExpression":
|
46280
47374
|
|
46281
47375
|
if (parent.type !== "CallExpression" && parent.type !== "NewExpression") {
|
46282
|
-
while (parent && !parent.leadingComments && !/Function/.test(parent.type)) {
|
47376
|
+
while (parent && !parent.leadingComments && !/Function/.test(parent.type) && parent.type !== "MethodDefinition") {
|
46283
47377
|
parent = parent.parent;
|
46284
47378
|
}
|
46285
47379
|
|
46286
|
-
return parent && (parent.type !== "FunctionDeclaration") ? findJSDocComment(parent.leadingComments, line) : null;
|
47380
|
+
return parent && (parent.type !== "FunctionDeclaration") ? findJSDocComment(parent.leadingComments, parent.loc.start.line) : null;
|
46287
47381
|
}
|
46288
47382
|
|
46289
47383
|
// falls through
|
@@ -46337,5 +47431,5 @@ SourceCode.prototype = {
|
|
46337
47431
|
|
46338
47432
|
module.exports = SourceCode;
|
46339
47433
|
|
46340
|
-
},{"../token-store.js":
|
47434
|
+
},{"../token-store.js":368,"./estraverse":371,"object-assign":151}]},{},[162])(162)
|
46341
47435
|
});
|