firescript-linter
Advanced tools
Comparing version 0.9.0 to 0.10.0
{ | ||
"name": "firescript-linter", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Linter for Firescript", | ||
@@ -5,0 +5,0 @@ "main": "app.js", |
@@ -5,2 +5,4 @@ const path = require('path') | ||
const fileExtensions = ['', '.fire'] | ||
class ImportDeclaration extends LinterNode { | ||
@@ -11,4 +13,8 @@ lint (ast) { | ||
if (ast.source.value.charAt(0) === '.') { | ||
const modulePath = path.resolve(path.dirname(this.session.filename), ast.source.value) | ||
if (!this.moduleExists(modulePath)) { | ||
const moduleFound = fileExtensions.some((ext) => { | ||
const modulePath = path.resolve(path.dirname(this.session.filename), `${ast.source.value}${ext}`) | ||
return this.moduleExists(modulePath) | ||
}) | ||
if (!moduleFound) { | ||
this.lintException(new ModuleNotFound(ast.source, ast.source.value)) | ||
@@ -34,3 +40,4 @@ } | ||
try { | ||
require.resolve(modulePath) | ||
const paths = this.getRequirePaths() | ||
require.resolve(modulePath, paths) | ||
return true | ||
@@ -45,4 +52,18 @@ } catch (err) { | ||
} | ||
getRequirePaths () { | ||
const paths = [] | ||
const pathsplit = this.session.filename.split('/') | ||
while (pathsplit.pop()) { | ||
const p = pathsplit.join('/') | ||
paths.push(`${p}/node_modules`) | ||
} | ||
paths.push(`${process.env.HOME}/.node_modules`) | ||
paths.push(`${process.env.HOME}/.node_libraries`) | ||
return paths | ||
} | ||
} | ||
module.exports.ImportDeclaration = ImportDeclaration |
@@ -24,2 +24,4 @@ const { LinterNode } = require('../LinterNode') | ||
} | ||
} else if (!ast.init) { | ||
this.debug('Rule: disallow empty let statements') | ||
} else { | ||
@@ -26,0 +28,0 @@ this.lintNode(ast.init) |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
65558
1941
6