From a7e0d06885ec22bb759c53d45f4ac38fd36980f7 Mon Sep 17 00:00:00 2001 From: vilchik-elena Date: Fri, 31 Jul 2020 10:24:36 +0200 Subject: [PATCH] Remove unused field and refactor duplication --- eslint-bridge/tests/RuleTesterTs.ts | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/eslint-bridge/tests/RuleTesterTs.ts b/eslint-bridge/tests/RuleTesterTs.ts index 1852feb5c5a..63c443c70e1 100644 --- a/eslint-bridge/tests/RuleTesterTs.ts +++ b/eslint-bridge/tests/RuleTesterTs.ts @@ -35,17 +35,6 @@ const placeHolderFilePath = path.resolve(`${__dirname}/fixtures/rule-tester-proj * It will also assert that no issues is raised when there are no type information. */ class RuleTesterTs extends RuleTester { - ruleTesterNoTsConfig = new RuleTester({ - parser, - parserOptions: { - ecmaVersion: 2018, - sourceType: 'module', - ecmaFeatures: { - jsx: true, - globalReturn: true, - }, - }, - }); constructor(public expectNoIssuesWithoutTypes = true) { super({ @@ -62,16 +51,14 @@ class RuleTesterTs extends RuleTester { invalid?: RuleTester.InvalidTestCase[]; }, ): void { - tests.valid.forEach(test => { + const setFilename = test => { if (!test.filename) { test.filename = placeHolderFilePath; } - }); - tests.invalid.forEach(test => { - if (!test.filename) { - test.filename = placeHolderFilePath; - } - }); + }; + + tests.valid.forEach(setFilename); + tests.invalid.forEach(setFilename); super.run(name, rule, tests); }