New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-qml-js

Package Overview
Dependencies
Maintainers
6
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-qml-js - npm Package Compare versions

Comparing version 0.0.4 to 0.1.0

35

lib/index.js
'use strict';
function makePathRelative(p) {
var delimiter = p[0];
// Remove delimiters
p = p.slice(1, -1);
// Add ./ if necessary
if (p[0] !== '.') {
p = `./${p}`;
}
return `${delimiter}${p}${delimiter}`;
}
module.exports.processors = {
".js": {
preprocess: function(text, filename) {
// Ignore QML head lines and transform JS import in CommonJS require
text = text
.replace(/^\.import (['"])([^'"]+\.js)(['"]) as (.+)$/mg, 'var $4 = require($1./$2$3);')
.replace(/^\.(pragma|import).*$/mg, '\/* Ignored QML */');
preprocess: function(text) {
text = text.replace(/^\.import .+$/gm, function (line) {
var parts = line.split(' ');
// Importing QML modules implies having 5 elements
if (parts.length < 5) {
return `var ${parts[3]} = require(${makePathRelative(parts[1])});`;
}
return `var ${parts[4]} = {};`;
})
text = text.replace(/^\.pragma.*$/gm, '// Ignored QML');
return [text];
},
postprocess: function(messages, filename) {
postprocess: function(messages) {
// Do nothing

@@ -16,0 +37,0 @@ return messages[0];

2

package.json
{
"name": "eslint-plugin-qml-js",
"version": "0.0.4",
"version": "0.1.0",
"description": "Parse JS files in a QtQML project",

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

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