From 27ce009bc16430a43c756a2f1e55973d24bade8b Mon Sep 17 00:00:00 2001 From: lgandecki Date: Tue, 22 Aug 2023 10:09:41 +0200 Subject: [PATCH] feat: linter should error on new empty resolver tests --- scaffold/.eslintrc | 50 +++++++++++++++++++++++-------------------- scaffold/package.json | 1 + 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/scaffold/.eslintrc b/scaffold/.eslintrc index a92409c..b8b21c6 100644 --- a/scaffold/.eslintrc +++ b/scaffold/.eslintrc @@ -15,26 +15,17 @@ "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended" ], - "plugins": [ - "@typescript-eslint", - "import" - ], + "plugins": ["@typescript-eslint", "import"], "rules": { "import/no-extraneous-dependencies": [ "error", { - "devDependencies": [ - "**/*.test.ts", - "**/*.spec.ts" - ] + "devDependencies": ["**/*.test.ts", "**/*.spec.ts"] } ], "import/prefer-default-export": 0, "no-underscore-dangle": 0, - "no-cond-assign": [ - "error", - "except-parens" - ], + "no-cond-assign": ["error", "except-parens"], "import/no-cycle": 0, "@typescript-eslint/interface-name-prefix": 0, "@typescript-eslint/no-unused-vars": 1, @@ -42,9 +33,7 @@ "error", { "selector": "default", - "format": [ - "camelCase" - ] + "format": ["camelCase"] }, { "selector": "variable", @@ -54,19 +43,21 @@ "match": true } }, + { + "selector": "property", + "format": null, + "filter": { + "regex": ".*(typename)$", + "match": true + } + }, { "selector": "variable", - "format": [ - "camelCase", - "UPPER_CASE", - "PascalCase" - ] + "format": ["camelCase", "UPPER_CASE", "PascalCase"] }, { "selector": "typeLike", - "format": [ - "PascalCase" - ] + "format": ["PascalCase"] } ] }, @@ -76,6 +67,19 @@ "rules": { "@typescript-eslint/naming-convention": "off" } + }, + { + "files": ["src/**/*.spec.ts", "src/**/*.test.ts"], + "plugins": ["jest"], + "extends": ["plugin:jest/recommended"], + "rules": { + "jest/expect-expect": [ + "error", + { + "assertFunctionNames": ["expect", "td.verify"] + } + ] + } } ], "env": { diff --git a/scaffold/package.json b/scaffold/package.json index 151c88e..55e44e5 100644 --- a/scaffold/package.json +++ b/scaffold/package.json @@ -54,6 +54,7 @@ "eslint-config-prettier": "8.10.0", "eslint-import-resolver-typescript": "3.5.5", "eslint-plugin-import": "2.28.0", + "eslint-plugin-jest": "^27.2.3", "eslint-plugin-prettier": "5.0.0", "jest": "29.6.2", "lint-staged": "10.2.11",