From 3eeb8c14a9abc8d778325775189c4d8a6ead1589 Mon Sep 17 00:00:00 2001 From: Andy Balaam Date: Fri, 24 Feb 2023 09:39:14 +0000 Subject: [PATCH] Lint the test directory --- .eslintrc-test.js | 22 ++++++++++++++++++++++ package.json | 9 ++++++--- test/tsconfig.json | 16 ++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 .eslintrc-test.js create mode 100644 test/tsconfig.json diff --git a/.eslintrc-test.js b/.eslintrc-test.js new file mode 100644 index 0000000..c072c64 --- /dev/null +++ b/.eslintrc-test.js @@ -0,0 +1,22 @@ +module.exports = { + plugins: ["matrix-org"], + extends: [".eslintrc.js"], + parserOptions: { + project: ["test/tsconfig.json"], + }, + overrides: [ + { + files: ["test/**/*.ts"], + extends: ["plugin:matrix-org/typescript"], + rules: { + // Things we do that break the ideal style + "prefer-promise-reject-errors": "off", + "quotes": "off", + + "@typescript-eslint/no-explicit-any": "off", + // We're okay with assertion errors when we ask for them + "@typescript-eslint/no-non-null-assertion": "off", + }, + }, + ], +}; diff --git a/package.json b/package.json index eb775eb..f3888ff 100644 --- a/package.json +++ b/package.json @@ -20,16 +20,19 @@ "asar-webapp": "asar p webapp webapp.asar", "start": "yarn run build:ts && yarn run build:res && electron .", "lint": "yarn lint:types && yarn lint:js", - "lint:js": "yarn lint:js:src && yarn lint:js:scripts && yarn lint:js:hak", + "lint:js": "yarn lint:js:src && yarn lint:js:test && yarn lint:js:scripts && yarn lint:js:hak", "lint:js:src": "eslint --max-warnings 0 src", + "lint:js:test": "eslint --max-warnings 0 --config .eslintrc-test.js test", "lint:js:scripts": "eslint --max-warnings 0 --config .eslintrc-scripts.js scripts", "lint:js:hak": "eslint --max-warnings 0 --config .eslintrc-hak.js hak", - "lint:js-fix": "yarn lint:js-fix:src && yarn lint:js-fix:scripts && yarn lint:js-fix:hak", + "lint:js-fix": "yarn lint:js-fix:src &&yarn lint:js-fix:test && yarn lint:js-fix:scripts && yarn lint:js-fix:hak", "lint:js-fix:src": "eslint --fix --max-warnings 0 src", + "lint:js-fix:test": "eslint --fix --max-warnings 0 --config .eslintrc-test.js test", "lint:js-fix:scripts": "eslint --fix --max-warnings 0 --config .eslintrc-scripts.js scripts", "lint:js-fix:hak": "eslint --fix --max-warnings 0 --config .eslintrc-hak.js hak", - "lint:types": "yarn lint:types:src && yarn lint:types:scripts && yarn lint:types:hak", + "lint:types": "yarn lint:types:src && yarn lint:types:test && yarn lint:types:scripts && yarn lint:types:hak", "lint:types:src": "tsc --noEmit", + "lint:types:test": "tsc --noEmit -p test/tsconfig.json", "lint:types:scripts": "tsc --noEmit -p scripts/tsconfig.json", "lint:types:hak": "tsc --noEmit -p hak/tsconfig.json", "build:native": "yarn run hak", diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 0000000..f032c77 --- /dev/null +++ b/test/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "resolveJsonModule": true, + "moduleResolution": "node", + "esModuleInterop": true, + "target": "es2017", + "module": "commonjs", + "sourceMap": false, + "strict": true, + "lib": ["es2019", "dom"] + }, + "include": ["./**/*.ts"], + "ts-node": { + "transpileOnly": true + } +}