/
githubmirror
/
eslint-plugin
Обзор
Документация
Войти
/
githubmirror
/
eslint-plugin
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.2.7
tests/noSampleCode.test.ts
33 строки
1 KB
Michael Naumov
test: add names to each test
16 апр 2026, 21:21
16 апр 2026, 21:21
86a5720
Код
Авторство
О чём код?
import { RuleTester } from "@typescript-eslint/rule-tester"; import noSampleCode from "../lib/rules/noSampleCode.js"; const ruleTester = new RuleTester(); ruleTester.run("no-sample-code", noSampleCode, { valid: [ { name: "custom registerInterval call is allowed", code: "this.registerInterval(window.setInterval(() => this.doSomething(), 1000));", }, { name: "custom registerDomEvent call is allowed", code: "this.registerDomEvent(this.containerEl, 'click', () => this.onClick());", }, ], invalid: [ { name: "sample setInterval call is forbidden", code: "this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000));", errors: [{ messageId: "removeSampleInterval" }], output: "", // The auto-fix should remove the entire line }, { name: "sample registerDomEvent call is forbidden", code: `this.registerDomEvent(document, 'click', (evt: MouseEvent) => { console.log('click', evt); });`, errors: [{ messageId: "removeSampleDomEvent" }], output: "", // The auto-fix should remove the entire block }, ], });