/
githubmirror
/
eslint-plugin
Обзор
Документация
Войти
/
githubmirror
/
eslint-plugin
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.1.6
tests/setupRuleTester.ts
37 строк
1016 B
Johan Sanneblad
Sentence case verification
24 сен 2025, 20:57
24 сен 2025, 20:57
eb18276
Код
Авторство
О чём код?
import { RuleTester } from "@typescript-eslint/rule-tester"; import parser from "@typescript-eslint/parser"; import type { RuleTesterConfig } from "@typescript-eslint/rule-tester"; declare global { // Extend NodeJS.Global with afterAll for type safety namespace NodeJS { interface Global { afterAll?: () => void; } } } // Patch for @typescript-eslint/rule-tester: define global afterAll if missing if (typeof (global as NodeJS.Global).afterAll !== "function") { (global as NodeJS.Global).afterAll = () => {}; } RuleTester.afterAll = () => {}; RuleTester.describe = (text, fn) => fn(); RuleTester.it = (text, fn) => fn(); // Set up RuleTester to use @typescript-eslint/parser globally export const typedRuleTesterConfig: RuleTesterConfig = { languageOptions: { parser, ecmaVersion: 2022, sourceType: "module", parserOptions: { project: "./tsconfig.json", tsconfigRootDir: process.cwd(), extraFileExtensions: [".json"], }, }, }; RuleTester.setDefaultConfig(typedRuleTesterConfig);