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

firescript-linter

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firescript-linter - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

LICENSE

2

examples/lint.js

@@ -6,2 +6,2 @@ const testAST = require('./banana.json')

const result = linter.lint(testAST)
console.log(result)
console.log(JSON.stringify(result, null, ' '))
{
"name": "firescript-linter",
"version": "0.6.4",
"version": "0.6.5",
"description": "Linter for Firescript",
"main": "app.js",
"scripts": {
"test": "firetest run",
"test": "npm run test:unit && npm run test:integration",
"test:unit": "firetest run tests/unit/**/*.test.*",
"test:integration": "firetest run tests/integration/**/*.test.*",
"lint": "eslint src/**/*.js"

@@ -19,10 +20,10 @@ },

"devDependencies": {
"@noname-media/eslint-config-standard": "^1.1.2",
"@noname-media/eslint-config-standard": "^1.1.3",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-standard": "^4.0.1",
"firescript": "^0.14.8",
"firescript-parser": "^0.3.4",
"firescript-syntax-test": "0.0.2",
"firescript-test": "^0.10.5",
"eslint-plugin-standard": "^5.0.0",
"firescript": "^0.15.3",
"firescript-parser": "^0.5.1",
"firescript-syntax-test": "^0.1.0",
"firescript-test": "^0.10.9",
"git-hooks": "^1.1.10",

@@ -29,0 +30,0 @@ "inspect.js": "^1.12.4"

@@ -18,2 +18,3 @@ const colorfy = require('colorfy')

lintNode (ast, ...args) {
this.debug('Lint', ast.type, ast.line, ast.column)
const Node = require(`./nodes/${ast.type}.js`)[ast.type]

@@ -109,2 +110,3 @@ const node = new Node(this.session, this, ast.type, ...args)

lintException (exception) {
this.debug('Lint exception:', exception)
this.session.exceptions.push(exception)

@@ -111,0 +113,0 @@ }

@@ -51,2 +51,7 @@ const { LinterNode } = require('../LinterNode')

}
} else if (argument.type === 'CallExpression') {
// Argument is a variable0
if (!this.isScopeVar(argument.callee.name)) {
this.lintException(new VariableNotDeclared(argument, argument.callee.name))
}
} else {

@@ -53,0 +58,0 @@ this.debug('TODO: implement param typing for', argument.type)

@@ -5,3 +5,3 @@ const LinterNode = require('../LinterNode').LinterNode

lint (ast) {
// this.lintNode(ast.argument)
this.lintNode(ast.expressions)
this.debug('TODO: implement callee linting', this.type)

@@ -8,0 +8,0 @@ }

@@ -13,7 +13,9 @@ const { LinterNode } = require('../LinterNode')

}
this.lintNode(declaration)
} else if (declaration.id.type === 'ArrayPattern') {
this.lintNode(declaration)
} else {
this.debug(`Handle ${declaration.id.type} in VariableDeclarations`)
}
this.lintNode(declaration)
})

@@ -20,0 +22,0 @@ }

@@ -7,3 +7,3 @@ const { LinterNode } = require('../LinterNode')

lint (ast) {
if (ast.init.type === 'Identifier') {
if (ast.init && ast.init.type === 'Identifier') {
// Argument is a variable

@@ -13,8 +13,16 @@ if (!this.isScopeVar(ast.init.name)) {

}
}
// check variable typing
const scopeVar = this.getScopeVar(ast.id.name)
if (!this.validateNodeTyping(ast.init, scopeVar.type)) {
this.lintException(new VariableTypingError(ast.init, scopeVar))
// check variable typing
const scopeVar = this.getScopeVar(ast.id.name)
if (!this.validateNodeTyping(ast.init, scopeVar.type)) {
this.lintException(new VariableTypingError(ast.init, scopeVar))
}
} else if (ast.init && ast.init.type === 'Literal') {
// check value typing
const scopeVar = this.getScopeVar(ast.id.name)
if (!this.validateNodeTyping(ast.init, scopeVar.type)) {
this.lintException(new VariableTypingError(ast.init, scopeVar))
}
} else {
this.debug(`Handle ${ast.init.type} in VariableDeclarator`)
}

@@ -21,0 +29,0 @@

const LinterNode = require('../../src/LinterNode').LinterNode
const inspect = require('inspect.js')

@@ -3,0 +4,0 @@ class LinterNodeTest {

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