Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-eslint

Package Overview
Dependencies
Maintainers
2
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-eslint - npm Package Compare versions

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 @@

3

package.json
{
"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 },
[]
);
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc