Linting changes

This commit is contained in:
n1073645 2019-11-14 08:55:27 +00:00
parent c1878ca28b
commit 33464b3388
19 changed files with 42 additions and 41 deletions

View File

@ -47,6 +47,7 @@
"block-spacing": "error", "block-spacing": "error",
"array-bracket-spacing": "error", "array-bracket-spacing": "error",
"comma-spacing": "error", "comma-spacing": "error",
"spaced-comment": ["error", "always", { "exceptions": ["/"] } ],
"comma-style": "error", "comma-style": "error",
"computed-property-spacing": "error", "computed-property-spacing": "error",
"no-trailing-spaces": "warn", "no-trailing-spaces": "warn",

View File

@ -758,15 +758,15 @@ class Utils {
"%7E": "~", "%7E": "~",
"%21": "!", "%21": "!",
"%24": "$", "%24": "$",
//"%26": "&", // "%26": "&",
"%27": "'", "%27": "'",
"%28": "(", "%28": "(",
"%29": ")", "%29": ")",
"%2A": "*", "%2A": "*",
//"%2B": "+", // "%2B": "+",
"%2C": ",", "%2C": ",",
"%3B": ";", "%3B": ";",
//"%3D": "=", // "%3D": "=",
"%3A": ":", "%3A": ":",
"%40": "@", "%40": "@",
"%2F": "/", "%2F": "/",
@ -1335,14 +1335,14 @@ export function debounce(func, wait, id, scope, args) {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
if (!String.prototype.padStart) { if (!String.prototype.padStart) {
String.prototype.padStart = function padStart(targetLength, padString) { String.prototype.padStart = function padStart(targetLength, padString) {
targetLength = targetLength>>0; //floor if number or convert non-number to 0; targetLength = targetLength>>0; // floor if number or convert non-number to 0;
padString = String((typeof padString !== "undefined" ? padString : " ")); padString = String((typeof padString !== "undefined" ? padString : " "));
if (this.length > targetLength) { if (this.length > targetLength) {
return String(this); return String(this);
} else { } else {
targetLength = targetLength-this.length; targetLength = targetLength-this.length;
if (targetLength > padString.length) { if (targetLength > padString.length) {
padString += padString.repeat(targetLength/padString.length); //append to original to ensure we are longer than needed padString += padString.repeat(targetLength/padString.length); // append to original to ensure we are longer than needed
} }
return padString.slice(0, targetLength) + String(this); return padString.slice(0, targetLength) + String(this);
} }
@ -1354,14 +1354,14 @@ if (!String.prototype.padStart) {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd
if (!String.prototype.padEnd) { if (!String.prototype.padEnd) {
String.prototype.padEnd = function padEnd(targetLength, padString) { String.prototype.padEnd = function padEnd(targetLength, padString) {
targetLength = targetLength>>0; //floor if number or convert non-number to 0; targetLength = targetLength>>0; // floor if number or convert non-number to 0;
padString = String((typeof padString !== "undefined" ? padString : " ")); padString = String((typeof padString !== "undefined" ? padString : " "));
if (this.length > targetLength) { if (this.length > targetLength) {
return String(this); return String(this);
} else { } else {
targetLength = targetLength-this.length; targetLength = targetLength-this.length;
if (targetLength > padString.length) { if (targetLength > padString.length) {
padString += padString.repeat(targetLength/padString.length); //append to original to ensure we are longer than needed padString += padString.repeat(targetLength/padString.length); // append to original to ensure we are longer than needed
} }
return String(this) + padString.slice(0, targetLength); return String(this) + padString.slice(0, targetLength);
} }

View File

@ -9,7 +9,7 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
/*eslint no-console: ["off"] */ /* eslint no-console: ["off"] */
import path from "path"; import path from "path";
import fs from "fs"; import fs from "fs";

View File

@ -7,7 +7,7 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
/*eslint no-console: ["off"] */ /* eslint no-console: ["off"] */
import path from "path"; import path from "path";
import fs from "fs"; import fs from "fs";

View File

@ -6,7 +6,7 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
/*eslint no-console: ["off"] */ /* eslint no-console: ["off"] */
import prompt from "prompt"; import prompt from "prompt";
import colors from "colors"; import colors from "colors";
@ -208,7 +208,7 @@ ${result.highlight ? `
export default ${moduleName}; export default ${moduleName};
`; `;
//console.log(template); // console.log(template);
const filename = path.join(dir, `./${moduleName}.mjs`); const filename = path.join(dir, `./${moduleName}.mjs`);
if (fs.existsSync(filename)) { if (fs.existsSync(filename)) {

View File

@ -59,7 +59,7 @@ class FromMorseCode extends Operation {
const letterDelim = Utils.charRep(args[0]); const letterDelim = Utils.charRep(args[0]);
const wordDelim = Utils.charRep(args[1]); const wordDelim = Utils.charRep(args[1]);
input = input.replace(/-|||_||—|dash/ig, "<dash>"); //hyphen-minus|hyphen|minus-sign|undersore|en-dash|em-dash input = input.replace(/-|||_||—|dash/ig, "<dash>"); // hyphen-minus|hyphen|minus-sign|undersore|en-dash|em-dash
input = input.replace(/\.|·|dot/ig, "<dot>"); input = input.replace(/\.|·|dot/ig, "<dot>");
let words = input.split(wordDelim); let words = input.split(wordDelim);

View File

@ -117,7 +117,7 @@ class GroupIPAddresses extends Operation {
// Sort IPv6 network dictionaries and print // Sort IPv6 network dictionaries and print
for (networkStr in ipv6Networks) { for (networkStr in ipv6Networks) {
//ipv6Networks[networkStr] = ipv6Networks[networkStr].sort(); TODO // ipv6Networks[networkStr] = ipv6Networks[networkStr].sort(); TODO
output += networkStr + "/" + cidr + "\n"; output += networkStr + "/" + cidr + "\n";

View File

@ -391,7 +391,7 @@ class Lorenz extends Operation {
// Chi 2 one back lim - The active character of Chi 2 (2nd Chi wheel) in the previous position // Chi 2 one back lim - The active character of Chi 2 (2nd Chi wheel) in the previous position
lim = parseInt(chiSettings[2][x2bptr-1], 10); lim = parseInt(chiSettings[2][x2bptr-1], 10);
if (kt) { if (kt) {
//p5 back 2 // p5 back 2
if (lim===p5[2]) { if (lim===p5[2]) {
lim = 0; lim = 0;
} else { } else {
@ -413,7 +413,7 @@ class Lorenz extends Operation {
lim = 1; lim = 1;
if (x2b1lug===s1b1lug) lim=0; if (x2b1lug===s1b1lug) lim=0;
if (kt) { if (kt) {
//p5 back 2 // p5 back 2
if (lim===p5[2]) { if (lim===p5[2]) {
lim=0; lim=0;
} else { } else {

View File

@ -6,7 +6,7 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
/*eslint no-console: ["off"] */ /* eslint no-console: ["off"] */
import NodeDish from "./NodeDish.mjs"; import NodeDish from "./NodeDish.mjs";
import NodeRecipe from "./NodeRecipe.mjs"; import NodeRecipe from "./NodeRecipe.mjs";

View File

@ -7,7 +7,7 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
/*eslint no-global-assign: ["off"] */ /* eslint no-global-assign: ["off"] */
require = require("esm")(module); require = require("esm")(module);
module.exports = require("./index.mjs"); module.exports = require("./index.mjs");
module.exports.File = require("./File.mjs"); module.exports.File = require("./File.mjs");

View File

@ -9,7 +9,7 @@
* @license Apache-2.0 * @license Apache-2.0
*/ */
/*eslint no-console: 0 */ /* eslint no-console: 0 */
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";

View File

@ -11,7 +11,7 @@ const chef = require("./cjs.js");
const repl = require("repl"); const repl = require("repl");
/*eslint no-console: ["off"] */ /* eslint no-console: ["off"] */
console.log(` console.log(`
______ __ ________ ____ ______ __ ________ ____

View File

@ -604,7 +604,7 @@ class App {
else if (prev[1] > 0) prev[1]--; else if (prev[1] > 0) prev[1]--;
else prev[0]--; else prev[0]--;
//const compareURL = `https://github.com/gchq/CyberChef/compare/v${prev.join(".")}...v${PKG_VERSION}`; // const compareURL = `https://github.com/gchq/CyberChef/compare/v${prev.join(".")}...v${PKG_VERSION}`;
let compileInfo = `<a href='https://github.com/gchq/CyberChef/blob/master/CHANGELOG.md'>Last build: ${timeSinceCompile.substr(0, 1).toUpperCase() + timeSinceCompile.substr(1)} ago</a>`; let compileInfo = `<a href='https://github.com/gchq/CyberChef/blob/master/CHANGELOG.md'>Last build: ${timeSinceCompile.substr(0, 1).toUpperCase() + timeSinceCompile.substr(1)} ago</a>`;

View File

@ -446,7 +446,7 @@ class HighlighterWaiter {
} }
const cssClass = "hl1"; const cssClass = "hl1";
//if (colour) cssClass += "-"+colour; // if (colour) cssClass += "-"+colour;
// Remove HTML tags // Remove HTML tags
text = text text = text

View File

@ -29,20 +29,20 @@ class InputWaiter {
// Define keys that don't change the input so we don't have to autobake when they are pressed // Define keys that don't change the input so we don't have to autobake when they are pressed
this.badKeys = [ this.badKeys = [
16, //Shift 16, // Shift
17, //Ctrl 17, // Ctrl
18, //Alt 18, // Alt
19, //Pause 19, // Pause
20, //Caps 20, // Caps
27, //Esc 27, // Esc
33, 34, 35, 36, //PgUp, PgDn, End, Home 33, 34, 35, 36, // PgUp, PgDn, End, Home
37, 38, 39, 40, //Directional 37, 38, 39, 40, // Directional
44, //PrntScrn 44, // PrntScrn
91, 92, //Win 91, 92, // Win
93, //Context 93, // Context
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, //F1-12 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, // F1-12
144, //Num 144, // Num
145, //Scroll 145, // Scroll
]; ];
this.inputWorker = null; this.inputWorker = null;

View File

@ -125,7 +125,7 @@ TestRegister.addApiTests([
<a href="https://github.com">Click here</a> <a href="https://github.com">Click here</a>
<script src="script.js"></script> <script src="script.js"></script>
</body> </body>
</html>`.replace(/\n|\s{4}/g, ""); //remove newlines, tabs </html>`.replace(/\n|\s{4}/g, ""); // remove newlines, tabs
const dish = new Dish(html, Dish.HTML); const dish = new Dish(html, Dish.HTML);
dish.get(4); dish.get(4);

View File

@ -73,7 +73,7 @@ TestRegister.addTests([
}, },
{ {
name: "To Octal: Γειά σου", name: "To Octal: Γειά σου",
input: "Γειά σου", //[206,147,206,181,206,185,206,172,32,207,131,206,191,207,133], input: "Γειά σου", // [206,147,206,181,206,185,206,172,32,207,131,206,191,207,133],
expectedOutput: "316 223 316 265 316 271 316 254 40 317 203 316 277 317 205", expectedOutput: "316 223 316 265 316 271 316 254 40 317 203 316 277 317 205",
recipeConfig: [ recipeConfig: [
{ {

View File

@ -1099,7 +1099,7 @@ TestRegister.addTests([
} }
] ]
} }
/*{ // This takes a LONG time to run (over a minute usually). /* { // This takes a LONG time to run (over a minute usually).
name: "Scrypt: RFC test vector 4", name: "Scrypt: RFC test vector 4",
input: "pleaseletmein", input: "pleaseletmein",
expectedOutput: "2101cb9b6a511aaeaddbbe09cf70f881ec568d574a2ffd4dabe5ee9820adaa478e56fd8f4ba5d09ffa1c6d927c40f4c337304049e8a952fbcbf45c6fa77a41a4", expectedOutput: "2101cb9b6a511aaeaddbbe09cf70f881ec568d574a2ffd4dabe5ee9820adaa478e56fd8f4ba5d09ffa1c6d927c40f4c337304049e8a952fbcbf45c6fa77a41a4",
@ -1115,5 +1115,5 @@ TestRegister.addTests([
] ]
} }
] ]
},*/ }, */
]); ]);

View File

@ -248,7 +248,7 @@ TestRegister.addTests([
} }
] ]
}, },
/*{ This operation only works in a browser /* { This operation only works in a browser
name: "Optical Character Recognition", name: "Optical Character Recognition",
input: "iVBORw0KGgoAAAANSUhEUgAAAUAAAAC0CAIAAABqhmJGAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAASuSURBVHhe7dftVdswAIbRzsVAzMM0XabDUCOUxLYsWW4Jp+/pvf9w9GH76CHw4x2IJWAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAIJmAI9p8G/PbyY8rL2686g8t+vnqHTyfgIYfvz/26veTXn/UKX8+f0EU9bHrtu/6KfAN/AwEXAj7lFf2TBFw4nae8on+SgIvJ01n/KLzpDK+L3bT/Ap4O+HC+V12mTH+M3gzcLbIY/EO6HfxYp13k09nb6r3UqcdnjoCL3ll72J26h+35Oxy2XvZ0wOLaXq9v2+F1U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