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

eslint-plugin-webgl-logic

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-webgl-logic - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

rules/noPromiseAll.js

4

flavio.json
{
"name": "eslint-plugin-webgl-logic",
"version": "1.3.0",
"version": "1.4.0",
"tag": {
"commit": "6642eef4eacbe85c03dcc6f9b39886ee18149380",
"commit": "6009f12c165b16b4512f6c24ea5dbc842ae9cb80",
"target": {

@@ -7,0 +7,0 @@ "branch": "master"

@@ -5,2 +5,4 @@ 'use strict';

var noMathRandom = require( './rules/noMathRandom.js' );
var noPromiseAll = require( './rules/noPromiseAll.js' );
var noPromiseRace = require( './rules/noPromiseRace.js' );
var noSetTimeout = require( './rules/noSetTimeout.js' );

@@ -10,15 +12,19 @@ var maxLinesPerFunction = require( './rules/maxLinesPerFunction.js' );

module.exports = {
rules: {
"noAsyncAwait": noAsyncAwait,
rules: {
"noAsyncAwait": noAsyncAwait,
"noMathRandom": noMathRandom,
"noPromiseAll": noPromiseAll,
"noPromiseRace": noPromiseRace,
"noSetTimeout": noSetTimeout,
"maxLinesPerFunction": maxLinesPerFunction
},
},
rulesConfig: {
"noAsyncAwait": 2,
"noAsyncAwait": 2,
"noMathRandom": 2,
"noPromiseAll": 2,
"noPromiseRace": 2,
"noSetTimeout": 2,
"maxLinesPerFunction": 1
}
}
};
{
"name": "eslint-plugin-webgl-logic",
"version": "1.3.0",
"version": "1.4.0",
"description": "Custom eslint rules for the webgl logic module",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -35,3 +35,3 @@ # eslint-plugin-webgl-logic

"webgl-logic/noAsyncAwait": 2,
"webgl-logic/noMathRandom": 2
"webgl-logic/noMathRandom": 2
}

@@ -38,0 +38,0 @@ }

"use strict";
var noAsyncAwait = require("../rules/noAsyncAwait.js");
var noMathRandom = require("../rules/noMathRandom.js");
var noSetTimeout = require("../rules/noSetTimeout.js");
var RuleTester = require("eslint").RuleTester;
var noAsyncAwait = require( "../rules/noAsyncAwait.js" );
var noMathRandom = require( "../rules/noMathRandom.js" );
var noPromiseAll = require( "../rules/noPromiseAll.js" );
var noPromiseRace = require( "../rules/noPromiseRace.js" );
var noSetTimeout = require( "../rules/noSetTimeout.js" );
var RuleTester = require( "eslint" ).RuleTester;
var ruleTester = new RuleTester();
ruleTester.run("noAsyncAwait", noAsyncAwait, {
ruleTester.run( "noAsyncAwait", noAsyncAwait, {
valid: [

@@ -19,3 +21,3 @@ "function name() { var monkey = 33; }"

parser: 'babel-eslint',
errors: [ { message: "Async/Await is forbidden" } ]
errors: [{ message: "Async/Await is forbidden" }]
},

@@ -25,3 +27,3 @@ {

parser: 'babel-eslint',
errors: [ { message: "Async/Await is forbidden" } ]
errors: [{ message: "Async/Await is forbidden" }]
},

@@ -31,8 +33,8 @@ {

parser: 'babel-eslint',
errors: [ { message: "Async/Await is forbidden" } ]
errors: [{ message: "Async/Await is forbidden" }]
}
]
});
} );
ruleTester.run("noMathRandom", noMathRandom, {
ruleTester.run( "noMathRandom", noMathRandom, {
valid: [

@@ -52,52 +54,91 @@ "function name() { Math.floor( 4.5 ); }",

code: "function name() { var num = Math.random(); }",
errors: [ { message: "Math.Random is forbidden" } ]
errors: [{ message: "Math.Random is forbidden" }]
},
{
code: "var funcptr = Math.random;",
errors: [ { message: "Math.Random is forbidden" } ]
errors: [{ message: "Math.Random is forbidden" }]
},
{
code: "function name() { var num = _.shuffle(); }",
errors: [ { message: "_.shuffle is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.shuffle is forbidden as it uses Math.Random" }]
},
{
code: "var funcptr = _.shuffle;",
errors: [ { message: "_.shuffle is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.shuffle is forbidden as it uses Math.Random" }]
},
{
code: "function name() { var num = lodash.shuffle(); }",
errors: [ { message: "_.shuffle is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.shuffle is forbidden as it uses Math.Random" }]
},
{
code: "var funcptr = lodash.shuffle;",
errors: [ { message: "_.shuffle is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.shuffle is forbidden as it uses Math.Random" }]
},
{
code: "function name() { var num = lodash.sample(); }",
errors: [ { message: "_.sample is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.sample is forbidden as it uses Math.Random" }]
},
{
code: "var funcptr = lodash.sample;",
errors: [ { message: "_.sample is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.sample is forbidden as it uses Math.Random" }]
},
{
code: "function name() { var num = lodash.sampleSize(); }",
errors: [ { message: "_.sampleSize is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.sampleSize is forbidden as it uses Math.Random" }]
},
{
code: "var funcptr = lodash.sampleSize;",
errors: [ { message: "_.sampleSize is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.sampleSize is forbidden as it uses Math.Random" }]
},
{
code: "function name() { var num = lodash.random(); }",
errors: [ { message: "_.random is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.random is forbidden as it uses Math.Random" }]
},
{
code: "var funcptr = lodash.random;",
errors: [ { message: "_.random is forbidden as it uses Math.Random" } ]
errors: [{ message: "_.random is forbidden as it uses Math.Random" }]
}
]
});
} );
ruleTester.run( "noPromiseAll", noPromiseAll, {
valid: [
"function prom() { return Promise.resolve(); }",
"function prom() { return Promise.reject(); }",
"Promise.someOtherProperty = {};",
"var val = new Promise( function( res, rej ) { return 0; } );"
],
invalid: [
{
code: "function name() { return Promise.all( [Promise.resolve()] ); }",
errors: [{ message: "Promise.all is forbidden" }]
},
{
code: "var funcptr = Promise.all;",
errors: [{ message: "Promise.all is forbidden" }]
}
]
} );
ruleTester.run( "noPromiseRace", noPromiseRace, {
valid: [
"function prom() { return Promise.resolve(); }",
"function prom() { return Promise.reject(); }",
"Promise.someOtherProperty = {};",
"var val = new Promise( function( res, rej ) { return 0; } );"
],
invalid: [
{
code: "function name() { return Promise.race( [Promise.resolve()] ); }",
errors: [{ message: "Promise.race is forbidden" }]
},
{
code: "var funcptr = Promise.race;",
errors: [{ message: "Promise.race is forbidden" }]
}
]
} );
function generateSetTimeoutInvalidTests( funcName ) {

@@ -107,27 +148,27 @@ return [

code: funcName + "()",
errors: [ { message: "global " + funcName + " method is forbidden" } ]
errors: [{ message: "global " + funcName + " method is forbidden" }]
},
{
code: funcName + "( function() {}, 500 );",
errors: [ { message: "global " + funcName + " method is forbidden" } ]
errors: [{ message: "global " + funcName + " method is forbidden" }]
},
{
code: "function name() { " + funcName + "( function() {}, 1000 ); }",
errors: [ { message: "global " + funcName + " method is forbidden" } ]
errors: [{ message: "global " + funcName + " method is forbidden" }]
},
{
code: "global." + funcName + "( function() {}, 500 );",
errors: [ { message: "global " + funcName + " method is forbidden" } ]
errors: [{ message: "global " + funcName + " method is forbidden" }]
},
{
code: "function name() { global." + funcName + "( function() {}, 1000 ); }",
errors: [ { message: "global " + funcName + " method is forbidden" } ]
errors: [{ message: "global " + funcName + " method is forbidden" }]
},
{
code: "window." + funcName + "( function() {}, 500 );",
errors: [ { message: "global " + funcName + " method is forbidden" } ]
errors: [{ message: "global " + funcName + " method is forbidden" }]
},
{
code: "function name() { window." + funcName + "( function() {}, 1000 ); }",
errors: [ { message: "global " + funcName + " method is forbidden" } ]
errors: [{ message: "global " + funcName + " method is forbidden" }]
}

@@ -144,3 +185,3 @@ ];

ruleTester.run("noSetTimeout", noSetTimeout, {
ruleTester.run( "noSetTimeout", noSetTimeout, {
valid: [

@@ -156,2 +197,2 @@ "setTimeout3()",

invalid: setTimeoutInvalidTests
});
} );
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