From 10797eb628ba18f4586cea96cabca2a7cb438e04 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomae Date: Sat, 29 Aug 2020 03:01:28 +0200 Subject: [PATCH] refactor: fix linting for ts directive In the recommended set, directives are forbidden. Allow them with comments and add a comment explaining the usage in the code --- .eslintrc.js | 4 ++++ src/render.test.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 38196d5..f5e5e69 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,5 +15,9 @@ module.exports = { }, rules: { "react/prop-types": 0, + "@typescript-eslint/ban-ts-comment": [ + 2, + { "ts-expect-error": "allow-with-description" }, + ], }, }; diff --git a/src/render.test.tsx b/src/render.test.tsx index 5f784b1..e420eae 100644 --- a/src/render.test.tsx +++ b/src/render.test.tsx @@ -16,7 +16,7 @@ describe("render", () => { }); it("throws an error if a lower-case component is used", () => { - // @ts-expect-error + // @ts-expect-error - lower-case element test does not exist expect(() => render(Test)).toThrowError( "No lower-case elements or class components supported, please make sure all your components start with an upper-case letter and are functions." );