Socket
Socket
Sign inDemoInstall

eslint-plugin-flow-vars

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.3 to 0.2.0

29

define-flow-type.js
'use strict';
module.exports = function(context) {
var unresolvedRefs = Object.create(null);
var globalScope;
// do nearly the same thing that eslint does for config globals
// https://github.com/eslint/eslint/blob/v2.0.0/lib/eslint.js#L118-L194
function makeDefined(ident) {
if (unresolvedRefs[ident.name]) {
globalScope.__define(ident);
var variable = globalScope.set.get(ident.name);
variable.writeable = false;
unresolvedRefs[ident.name] = null;
for (var i = 0; i < globalScope.through.length; i++) {
var ref = globalScope.through[i];
if (ref.identifier.name === ident.name) {
// use "__define" since we don't have a reference to "escope.Variable"
globalScope.__define(ident);
var variable = globalScope.set.get(ident.name);
variable.writeable = false;
// "through" contains all references whose definition cannot be found
// so we need to update references and remove the ones that were added
globalScope.through.splice(i, 1);
ref.resolved = variable;
variable.references.push(ref);
break;
}
}

@@ -19,9 +29,2 @@ }

globalScope = context.getScope();
for (var i = 0; i < globalScope.through.length; i++) {
var ref = globalScope.through[i];
var name = ref.identifier.name;
if (!unresolvedRefs[name]) {
unresolvedRefs[name] = ref;
}
}
},

@@ -28,0 +31,0 @@ GenericTypeAnnotation: function(node) {

{
"name": "eslint-plugin-flow-vars",
"version": "0.1.3",
"version": "0.2.0",
"description": "Solves the problem of false positives with `no-undef` and `no-unused-vars` when using babel-eslint",

@@ -26,5 +26,5 @@ "keywords": [

"devDependencies": {
"babel-eslint": "^4.1.4",
"eslint": "^1.8.0"
"babel-eslint": "^5.0.0",
"eslint": "^2.0.0"
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc