Merge pull request #30 from Pustur/add-eslint

Add eslint
This commit is contained in:
Alt 2022-10-12 20:29:03 +02:00 committed by GitHub
commit 7ff71ffbd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 1934 additions and 5 deletions

2
.eslintignore Normal file
View file

@ -0,0 +1,2 @@
node_modules/
dist/

10
.eslintrc Normal file
View file

@ -0,0 +1,10 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
]
}

1913
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@
"clean": "tsc --build --clean",
"format": "prettier -w .",
"format:report": "prettier -c .",
"lint": "eslint . --ext .ts",
"test:all": "tsc && nyc mocha --recursive test",
"test:single": "mocha",
"start": "ts-node npx/bitburner-filesync.ts"
@ -46,7 +47,10 @@
"@types/sinon": "^10.0.13",
"@types/sinon-chai": "^3.2.8",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"chai": "^4.3.6",
"eslint": "^8.25.0",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"prettier": "^2.7.1",

View file

@ -2,7 +2,7 @@ import convict from "convict";
import { existsSync } from "fs";
// Define a schema
export let config = convict({
export const config = convict({
allowedFiletypes: {
doc: "Filetypes that are synchronized to the game.",
format: "Array",

View file

@ -37,7 +37,7 @@ describe("messageGenerators", () => {
const msg = fileRemovalEventToMsg({ path: "sub/test.js" });
const result = (msg?.params as FileData).filename;
if (result && result.hasOwnProperty("filename")) expect(result).to.eq("/sub/test.js");
if (result && Object.prototype.hasOwnProperty.call(result, "filename")) expect(result).to.eq("/sub/test.js");
});
});
@ -46,7 +46,7 @@ describe("messageGenerators", () => {
const msg = fileRemovalEventToMsg({ path: "test.js" });
const result = (msg?.params as FileData).filename;
if (result && result.hasOwnProperty("filename")) expect(result).to.eq("test.js");
if (result && Object.prototype.hasOwnProperty.call(result, "filename")) expect(result).to.eq("test.js");
});
});
@ -55,7 +55,7 @@ describe("messageGenerators", () => {
const msg = fileRemovalEventToMsg({ path: "/sub/test.js" });
const result = (msg?.params as FileData).filename;
if (result && result.hasOwnProperty("filename")) expect(result).to.eq("/sub/test.js");
if (result && Object.prototype.hasOwnProperty.call(result, "filename")) expect(result).to.eq("/sub/test.js");
});
});
});

View file

@ -1,5 +1,5 @@
import chai from "chai";
import { createSandbox, stub } from "sinon";
import { createSandbox } from "sinon";
import sinonChai from "sinon-chai";
export async function mochaGlobalSetup() {