babel-eslint
Advanced tools
Comparing version 3.1.5 to 3.1.6
35
index.js
@@ -57,2 +57,37 @@ var acornToEsprima = require("./acorn-to-esprima"); | ||
}; | ||
// monkeypatch escope/referencer | ||
var referencerLoc; | ||
try { | ||
var referencerLoc = Module._resolveFilename("./referencer", escopeMod); | ||
} catch (err) { | ||
throw new ReferenceError("couldn't resolve escope/referencer"); | ||
} | ||
var referencer = require(referencerLoc); | ||
// if there are decotators, then visit each | ||
function visitDecorators(node) { | ||
if (!node.decorators) { | ||
return; | ||
} | ||
for (var i = 0; i < node.decorators.length; i++) { | ||
if (node.decorators[i].expression) { | ||
this.visit(node.decorators[i]); | ||
} | ||
} | ||
} | ||
// monkeypatch referencer methods to visit decorators | ||
var visitClass = referencer.prototype.visitClass; | ||
referencer.prototype.visitClass = function (node) { | ||
// visit decorators that are in: Class Declaration | ||
visitDecorators.call(this, node); | ||
visitClass.call(this, node); | ||
} | ||
var visitProperty = referencer.prototype.visitProperty; | ||
referencer.prototype.visitProperty = function (node) { | ||
// visit decorators that are in: Visit Property / MethodDefinition | ||
visitDecorators.call(this, node); | ||
visitProperty.call(this, node); | ||
} | ||
} | ||
@@ -59,0 +94,0 @@ |
{ | ||
"name": "babel-eslint", | ||
"version": "3.1.5", | ||
"version": "3.1.6", | ||
"description": "", | ||
@@ -12,2 +12,3 @@ "main": "index.js", | ||
"babel-core": "^5.1.8", | ||
"eslint": "^0.21.2", | ||
"lodash.assign": "^3.0.0" | ||
@@ -14,0 +15,0 @@ }, |
@@ -58,3 +58,3 @@ /*eslint-env mocha*/ | ||
"export default Foo;", | ||
{ }, | ||
{}, | ||
[] | ||
@@ -167,2 +167,94 @@ ); | ||
}); | ||
describe("decorators #72", function () { | ||
it("class declaration", function () { | ||
verifyAndAssertMessages( | ||
[ | ||
"import classDeclaration from 'decorator';", | ||
"import decoratorParameter from 'decorator';", | ||
"@classDeclaration(decoratorParameter)", | ||
"@classDeclaration", | ||
"class TextareaAutosize {}" | ||
].join("\n"), | ||
{ "no-unused-vars": 1 }, | ||
[] | ||
); | ||
}); | ||
it("method definition", function () { | ||
verifyAndAssertMessages( | ||
[ | ||
"import classMethodDeclarationA from 'decorator';", | ||
"import decoratorParameter from 'decorator';", | ||
"class TextareaAutosize {", | ||
"@classMethodDeclarationA(decoratorParameter)", | ||
"@classMethodDeclarationA", | ||
"methodDeclaration(e) {", | ||
"e();", | ||
"}", | ||
"}" | ||
].join("\n"), | ||
{ "no-unused-vars": 1 }, | ||
[] | ||
); | ||
}); | ||
it("method definition get/set", function () { | ||
verifyAndAssertMessages( | ||
[ | ||
"import classMethodDeclarationA from 'decorator';", | ||
"import decoratorParameter from 'decorator';", | ||
"class TextareaAutosize {", | ||
"@classMethodDeclarationA(decoratorParameter)", | ||
"@classMethodDeclarationA", | ||
"get bar() { }", | ||
"@classMethodDeclarationA(decoratorParameter)", | ||
"@classMethodDeclarationA", | ||
"set bar() { }", | ||
"}" | ||
].join("\n"), | ||
{ "no-unused-vars": 1 }, | ||
[] | ||
); | ||
}); | ||
it("object property", function () { | ||
verifyAndAssertMessages( | ||
[ | ||
"import classMethodDeclarationA from 'decorator';", | ||
"import decoratorParameter from 'decorator';", | ||
"var obj = {", | ||
"@classMethodDeclarationA(decoratorParameter)", | ||
"@classMethodDeclarationA", | ||
"methodDeclaration(e) {", | ||
"e();", | ||
"}", | ||
"};", | ||
"obj;" | ||
].join("\n"), | ||
{ "no-unused-vars": 1 }, | ||
[] | ||
); | ||
}); | ||
it("object property get/set", function () { | ||
verifyAndAssertMessages( | ||
[ | ||
"import classMethodDeclarationA from 'decorator';", | ||
"import decoratorParameter from 'decorator';", | ||
"var obj = {", | ||
"@classMethodDeclarationA(decoratorParameter)", | ||
"@classMethodDeclarationA", | ||
"get bar() { },", | ||
"@classMethodDeclarationA(decoratorParameter)", | ||
"@classMethodDeclarationA", | ||
"set bar() { }", | ||
"};", | ||
"obj;" | ||
].join("\n"), | ||
{ "no-unused-vars": 1 }, | ||
[] | ||
); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
28842
817
0
3
3
+ Addedeslint@^0.21.2
+ Addedansi-regex@1.1.1(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcli-width@1.1.1(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedd@1.0.2(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addeddoctrine@0.6.4(transitive)
+ Addedes5-ext@0.10.64(transitive)
+ Addedes6-iterator@2.0.3(transitive)
+ Addedes6-map@0.1.5(transitive)
+ Addedes6-set@0.1.6(transitive)
+ Addedes6-symbol@3.1.4(transitive)
+ Addedes6-weak-map@2.0.3(transitive)
+ Addedescope@3.6.0(transitive)
+ Addedeslint@0.21.2(transitive)
+ Addedesniff@2.0.1(transitive)
+ Addedespree@2.2.5(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@2.0.04.3.05.3.0(transitive)
+ Addedestraverse-fb@1.3.2(transitive)
+ Addedesutils@1.1.6(transitive)
+ Addedevent-emitter@0.3.5(transitive)
+ Addedext@1.7.0(transitive)
+ Addedfast-levenshtein@1.0.7(transitive)
+ Addedfigures@1.7.0(transitive)
+ Addedinquirer@0.8.5(transitive)
+ Addedisarray@0.0.11.0.0(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedlevn@0.2.5(transitive)
+ Addedmute-stream@0.0.4(transitive)
+ Addednext-tick@1.1.0(transitive)
+ Addedobject-assign@2.1.1(transitive)
+ Addedoptionator@0.5.0(transitive)
+ Addedprelude-ls@1.1.2(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedreadline2@0.1.1(transitive)
+ Addedrx@2.5.3(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@2.0.1(transitive)
+ Addedstrip-json-comments@1.0.4(transitive)
+ Addedtext-table@0.2.0(transitive)
+ Addedtype@2.7.3(transitive)
+ Addedtype-check@0.3.2(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwordwrap@0.0.3(transitive)
+ Addedxml-escape@1.0.0(transitive)