From ccff4b9ee5a37c13f0973b52e8f90a8be8359fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Tue, 4 Aug 2020 22:39:02 +0200 Subject: Add new eslint rules (#2121) The largest changes here are: - enforcing single quotes for strings - enforcing trailing commas where possible In addition to those we have enabled several eslint plugins: - plugin:requirejs/recommended, to enforce some conventions in require statements - plugin:node/recommended, to enforce correct usage of various node.js APIs - plugin:unicorn/recommended, which contains a pretty mixed bag of useful rules This PR attempts to not change code behavior when possible. In cases where fixing existing code would change semantics, a linting exclusion has been placed in the code base to silence the error. You can find these by searching for `eslint-disable-next-line`. Co-authored-by: Austin Morton --- lib/compilers/pascal.js | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'lib/compilers/pascal.js') diff --git a/lib/compilers/pascal.js b/lib/compilers/pascal.js index 8f82fb824..424a6381f 100644 --- a/lib/compilers/pascal.js +++ b/lib/compilers/pascal.js @@ -21,14 +21,14 @@ // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -"use strict"; +'use strict'; const BaseCompiler = require('../base-compiler'), utils = require('../utils'), _ = require('underscore'), - fs = require("fs-extra"), - path = require("path"), - argumentParsers = require("./argument-parsers"); + fs = require('fs-extra'), + path = require('path'), + argumentParsers = require('./argument-parsers'); class FPCCompiler extends BaseCompiler { constructor(info, env) { @@ -66,7 +66,7 @@ class FPCCompiler extends BaseCompiler { let options = ['-g', '-al']; if (this.compiler.intelAsm && filters.intel && !filters.binary) { - options = options.concat(this.compiler.intelAsm.split(" ")); + options = options.concat(this.compiler.intelAsm.split(' ')); } filters.preProcessLines = _.bind(this.preProcessLines, this); @@ -79,20 +79,20 @@ class FPCCompiler extends BaseCompiler { } getExecutableFilename(dirPath) { - return path.join(dirPath, "prog"); + return path.join(dirPath, 'prog'); } static preProcessBinaryAsm(input) { - const relevantAsmStartsAt = input.indexOf(""; + result.asm = ''; } else { result.asm = FPCCompiler.preProcessBinaryAsm(objResult.stdout); } @@ -119,10 +119,10 @@ class FPCCompiler extends BaseCompiler { const unitName = path.basename(this.compileFilename, this.lang.extensions[0]); await fs.writeFile(filename, - "program prog; " + - "uses " + unitName + " in '" + this.compileFilename + "'; " + - "begin " + - "end."); + 'program prog; ' + + 'uses ' + unitName + " in '" + this.compileFilename + "'; " + + 'begin ' + + 'end.'); } async runCompiler(compiler, options, inputFilename, execOptions) { @@ -131,7 +131,7 @@ class FPCCompiler extends BaseCompiler { } const dirPath = path.dirname(inputFilename); - const projectFile = path.join(dirPath, "prog.dpr"); + const projectFile = path.join(dirPath, 'prog.dpr'); execOptions.customCwd = dirPath; await this.saveDummyProjectFile(projectFile); @@ -163,23 +163,23 @@ class FPCCompiler extends BaseCompiler { } getExtraAsmHint(asm) { - if (asm.startsWith("# [")) { - const bracketEndPos = asm.indexOf("]", 3); + if (asm.startsWith('# [')) { + const bracketEndPos = asm.indexOf(']', 3); let valueInBrackets = asm.substr(3, bracketEndPos - 3); - const colonPos = valueInBrackets.indexOf(":"); + const colonPos = valueInBrackets.indexOf(':'); if (colonPos !== -1) { valueInBrackets = valueInBrackets.substr(0, colonPos - 1); } if (!isNaN(valueInBrackets)) { - return " .loc 1 " + valueInBrackets + " 0"; + return ' .loc 1 ' + valueInBrackets + ' 0'; } else if (valueInBrackets.includes(this.compileFilename)) { - return " .file 1 \"\""; + return ' .file 1 ""'; } else { return false; } - } else if (asm.startsWith(".Le")) { - return " .cfi_endproc"; + } else if (asm.startsWith('.Le')) { + return ' .cfi_endproc'; } else { return false; } -- cgit v1.2.3