Add linter fixes

This commit is contained in:
Christoph Diehl 2018-03-19 05:54:40 +01:00
parent 360f7abb1e
commit 43b69880b1
No known key found for this signature in database
GPG Key ID: 799CE5B68FEF404A
21 changed files with 141 additions and 156 deletions

View File

@ -1 +1 @@
module.exports = require('./lib/') module.exports = require('./lib/')

View File

@ -4,8 +4,8 @@ const random = require('./random')
const utils = require('./utils') const utils = require('./utils')
module.exports = { module.exports = {
logger, logger,
random, random,
make, make,
utils utils
} }

View File

@ -19,7 +19,6 @@ if (utils.platform.name.isWindows) {
} }
class logger { class logger {
static console (msg) { static console (msg) {
if (websocket) { if (websocket) {
websocket.send(msg) websocket.send(msg)
@ -31,7 +30,7 @@ class logger {
console.log(msg) console.log(msg)
} }
} else if (window.dump) { } else if (window.dump) {
dump(msg) dump(msg) // eslint-disable-line no-undef
} else if (window.console && window.console.log) { } else if (window.console && window.console.log) {
console.log(msg) console.log(msg)
} else { } else {
@ -85,4 +84,4 @@ class logger {
} }
} }
module.exports = logger module.exports = logger

View File

@ -3,13 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
class logging { class logging {
constructor () { static get logger () {
} // Or: const {logger} = require('./logging')
return require('./console')
static get logger () { }
// Or: const {logger} = require('./logging')
return require('./console')
}
} }
module.exports = logging module.exports = logging

View File

@ -6,17 +6,17 @@ const make = require('../make')
const random = require('../random') const random = require('../random')
class alignment extends make { class alignment extends make {
static horizontal () { static horizontal () {
return random.item(['left', 'right', 'justify', 'center']) return random.item(['left', 'right', 'justify', 'center'])
} }
static vertical () { static vertical () {
return random.item(['top', 'bottom', 'middle', 'baseline']) return random.item(['top', 'bottom', 'middle', 'baseline'])
} }
static any () { static any () {
return random.pick([this.horizontal, this.vertical]) return random.pick([this.horizontal, this.vertical])
} }
} }
module.exports = alignment module.exports = alignment

View File

@ -2,8 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const make = require('../make')
const random = require('../random') const random = require('../random')
const make = require('../make')
const utils = require('../utils')
class crypto extends make { class crypto extends make {
static get keyFormats () { static get keyFormats () {
@ -54,8 +55,8 @@ class crypto extends make {
] ]
} }
static randomCurve (){ static randomCurve () {
return random.item(this.curves) return random.item(this.curves)
} }
static get jwkUsages () { static get jwkUsages () {

View File

@ -83,7 +83,7 @@ class font extends make {
]) ])
} }
static font() { static font () {
let s = '' let s = ''
if (random.chance(4)) { if (random.chance(4)) {
s += random.pick(this.style) + ' ' s += random.pick(this.style) + ' '
@ -104,4 +104,4 @@ class font extends make {
} }
} }
module.exports = font module.exports = font

View File

@ -3,89 +3,89 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
class make { class make {
static get number () { static get number () {
return require('./numbers') return require('./numbers')
} }
static get alignment () { static get alignment () {
return require('./alignment') return require('./alignment')
} }
static get arrays () { static get arrays () {
return require('./arrays') return require('./arrays')
} }
static get colors () { static get colors () {
return require('./colors') return require('./colors')
} }
static get command () { static get command () {
return require('./command') return require('./command')
} }
static get crypto () { static get crypto () {
return require('./crypto') return require('./crypto')
} }
static get datetime () { static get datetime () {
return require('./datetime') return require('./datetime')
} }
static get files () { static get files () {
return require('./files') return require('./files')
} }
static get font () { static get font () {
return require('./fonts') return require('./fonts')
} }
static get html () { static get html () {
return require('./html') return require('./html')
} }
static get mime () { static get mime () {
return require('./mime') return require('./mime')
} }
static get network () { static get network () {
return require('./network') return require('./network')
} }
static get shaders () { static get shaders () {
return require('./shaders') return require('./shaders')
} }
static get style () { static get style () {
return require('./style') return require('./style')
} }
static get text () { static get text () {
return require('./text') return require('./text')
} }
static get time () { static get time () {
return require('./time') return require('./time')
} }
static get typed () { static get typed () {
return require('./typed') return require('./typed')
} }
static get types () { static get types () {
return require('./types') return require('./types')
} }
static get unit () { static get unit () {
return require('./units') return require('./units')
} }
static get uri () { static get uri () {
return require('./uri') return require('./uri')
} }
static get webgl () { static get webgl () {
return require('./webgl') return require('./webgl')
} }
} }
module.exports = make module.exports = make

View File

@ -60,7 +60,7 @@ class number extends make {
return Math.pow(2, random.number(random.number(65))) + random.number(3) - 1 return Math.pow(2, random.number(random.number(65))) + random.number(3) - 1
} }
static even(number) { static even (number) {
return number % 2 === 1 ? ++number : number return number % 2 === 1 ? ++number : number
} }

View File

@ -2,8 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const make = require('../make')
const random = require('../random') const random = require('../random')
const make = require('../make')
const utils = require('../utils')
class shaders extends make { class shaders extends make {
static get fragment1 () { static get fragment1 () {
@ -29,7 +30,7 @@ class shaders extends make {
] ]
} }
static get vertex1() { static get vertex1 () {
return [ return [
[ [
'attribute vec4 aVertex;', 'attribute vec4 aVertex;',
@ -63,7 +64,7 @@ class shaders extends make {
] ]
} }
static get fragment2() { static get fragment2 () {
return [ return [
[ [
'varying highp vec2 vTextureCoord;', 'varying highp vec2 vTextureCoord;',
@ -96,7 +97,7 @@ class shaders extends make {
] ]
} }
static get vertex2() { static get vertex2 () {
return [ return [
[ [
'attribute highp vec3 aVertexNormal;', 'attribute highp vec3 aVertexNormal;',

View File

@ -2,8 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const make = require('../make')
const random = require('../random') const random = require('../random')
const make = require('../make')
const utils = require('../utils')
class text extends make { class text extends make {
static lineEnd () { static lineEnd () {

View File

@ -28,28 +28,28 @@ class MersenneTwister {
} }
} }
export_state () { export_state () { // eslint-disable-line camelcase
return [this.mt, this.mti] return [this.mt, this.mti]
} }
import_state (s) { import_state (s) { // eslint-disable-line camelcase
this.mt = s[0] this.mt = s[0]
this.mti = s[1] this.mti = s[1]
} }
export_mta () { export_mta () { // eslint-disable-line camelcase
return this.mt return this.mt
} }
import_mta (_mta) { import_mta (_mta) { // eslint-disable-line camelcase
this.mt = _mta this.mt = _mta
} }
export_mti () { export_mti () { // eslint-disable-line camelcase
return this.mti return this.mti
} }
import_mti (_mti) { import_mti (_mti) { // eslint-disable-line camelcase
this.mti = _mti this.mti = _mti
} }
@ -58,8 +58,8 @@ class MersenneTwister {
if (this.mti >= this.N) { /* generate N words at one time */ if (this.mti >= this.N) { /* generate N words at one time */
for (kk = 0; kk < this.N - this.M; kk++) { for (kk = 0; kk < this.N - this.M; kk++) {
y = ((this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)) y = ((this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK))
this.mt[kk] = (this.mt[kk + this.M] ^ (y >>> 1) ^ this.MAG01[y & 0x1]) this.mt[kk] = (this.mt[kk + this.M] ^ (y >>> 1) ^ this.MAG01[y & 0x1])
} }
for (; kk < this.N - 1; kk++) { for (; kk < this.N - 1; kk++) {
y = ((this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK)) y = ((this.mt[kk] & this.UPPER_MASK) | (this.mt[kk + 1] & this.LOWER_MASK))

View File

@ -6,7 +6,6 @@ const MersenneTwister = require('./mersennetwister')
const {logger} = require('../logging') const {logger} = require('../logging')
class random { class random {
/** /**
* Must be called before any other methods can be called to initialize MersenneTwister. * Must be called before any other methods can be called to initialize MersenneTwister.
* @param {number|null|undefined} seed Value to initialize MersenneTwister. * @param {number|null|undefined} seed Value to initialize MersenneTwister.

View File

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const random = require('../random')
const utils = require('../utils') const utils = require('../utils')
class block extends utils { class block extends utils {

View File

@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const utils = require('../utils')
class common extends utils { class common extends utils {
static objToString (obj) { static objToString (obj) {

View File

@ -1,27 +1,27 @@
class utils { class utils {
static get common () { static get common () {
return require('./common') return require('./common')
} }
static get block () { static get block () {
return require('./block') return require('./block')
} }
static get mutate () { static get mutate () {
return require('./mutate') return require('./mutate')
} }
static Objects () { static Objects () {
return require('./objects') return require('./objects')
} }
static get platform () { static get platform () {
return require('./platform') return require('./platform')
} }
static get script () { static get script () {
return require('./script') return require('./script')
} }
} }
module.exports = utils module.exports = utils

View File

@ -61,4 +61,4 @@ class mutate extends utils {
} }
} }
module.exports = mutate module.exports = mutate

View File

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const random = require('../random')
const utils = require('../utils') const utils = require('../utils')
const {logger} = require('../logging') const {logger} = require('../logging')
@ -113,4 +114,4 @@ class Objects {
} }
} }
module.exports = Object module.exports = {Objects, o}

View File

@ -2,8 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const utils = require('../utils')
const random = require('../random') const random = require('../random')
const make = require('../make')
const utils = require('../utils')
const {o} = require('../objects')
class script extends utils { class script extends utils {
static methodHead (list, numOptional) { static methodHead (list, numOptional) {

View File

@ -2,13 +2,7 @@
"name": "octo", "name": "octo",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"keywords": [ "keywords": ["fuzzing", "browser", "javascript", "node", "library"],
"fuzzing",
"browsers",
"javascript",
"node",
"library"
],
"homepage": "https://github.com/mozillasecurity/octo", "homepage": "https://github.com/mozillasecurity/octo",
"repository": { "repository": {
"type": "git", "type": "git",
@ -32,17 +26,7 @@
"standard": { "standard": {
"ignore": [ "ignore": [
"tests/**", "tests/**",
"deploy/" "dist/"
],
"globals": [
"random",
"make",
"utils",
"logger",
"MersenneTwister",
"o",
"btoa",
"atob"
], ],
"envs": [ "envs": [
"browser" "browser"

View File

@ -1,14 +1,13 @@
const path = require('path') const path = require('path')
const webpack = require("webpack")
let config = { let config = {
entry: './lib/index.js', entry: './lib/index.js',
output: { output: {
filename: 'octo.js', filename: 'octo.js',
library: 'octo', library: 'octo',
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
libraryTarget: 'var' libraryTarget: 'var'
} }
} }
module.exports = config module.exports = config