import { type Linter } from 'eslint'; import { type FixedLengthTuple, type ReadonlyRecord } from 'ts-type-forge'; type SpreadOptionsIfIsArray = T[1] extends readonly unknown[] ? readonly [Linter.StringSeverity, ...T[1]] : T; /** * @description Enforces a blank line between Playwright test blocks (e.g., test, test.step, test.beforeEach, etc.). * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/consistent-spacing-between-blocks.md * * ```md * | key | value | * | :---------- | :--------- | * | type | layout | * | deprecated | false | * | fixable | whitespace | * | recommended | true | * ``` */ declare namespace ConsistentSpacingBetweenBlocks { type RuleEntry = Linter.StringSeverity; } /** * @description Enforce assertion to be made in a test body * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/expect-expect.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace ExpectExpect { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "assertFunctionNames": { * "items": { * "type": "string" * }, * "type": "array" * }, * "assertFunctionPatterns": { * "items": { * "type": "string" * }, * "type": "array" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ assertFunctionNames?: readonly string[]; assertFunctionPatterns?: readonly string[]; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Enforces a maximum number assertion calls in a test body * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/max-expects.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace MaxExpects { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "max": { * "minimum": 1, * "type": "integer" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ max?: number; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Enforces a maximum depth to nested describe calls * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/max-nested-describe.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | true | * ``` */ declare namespace MaxNestedDescribe { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "max": { * "minimum": 0, * "type": "integer" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ max?: number; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Identify false positives when async Playwright APIs are not properly awaited. * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/missing-playwright-await.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | fixable | code | * | recommended | true | * ``` */ declare namespace MissingPlaywrightAwait { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "customMatchers": { * "items": { * "type": "string" * }, * "type": "array" * }, * "includePageLocatorMethods": { * "type": "boolean" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ customMatchers?: readonly string[]; includePageLocatorMethods?: boolean; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Disallow commented out tests * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-commented-out-tests.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoCommentedOutTests { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow calling `expect` conditionally * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-conditional-expect.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoConditionalExpect { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow conditional logic in tests * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-conditional-in-test.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoConditionalInTest { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow duplicate setup and teardown hooks * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-duplicate-hooks.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace NoDuplicateHooks { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow multiple `test.slow()` calls in the same test * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-duplicate-slow.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoDuplicateSlow { type RuleEntry = Linter.StringSeverity; } /** * @description The use of ElementHandle is discouraged, use Locator instead * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-element-handle.md * * ```md * | key | value | * | :------------- | :--------- | * | type | suggestion | * | deprecated | false | * | hasSuggestions | true | * | recommended | true | * ``` */ declare namespace NoElementHandle { type RuleEntry = Linter.StringSeverity; } /** * @description The use of `page.$eval` and `page.$$eval` are discouraged, use `locator.evaluate` or `locator.evaluateAll` instead * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-eval.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoEval { type RuleEntry = Linter.StringSeverity; } /** * @description Prevent usage of `.only()` focus test annotation * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-focused-test.md * * ```md * | key | value | * | :------------- | :------ | * | type | problem | * | deprecated | false | * | hasSuggestions | true | * | recommended | true | * ``` */ declare namespace NoFocusedTest { type RuleEntry = Linter.StringSeverity; } /** * @description Prevent usage of `{ force: true }` option. * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-force-option.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoForceOption { type RuleEntry = Linter.StringSeverity; } /** * @description Disallows the usage of getByTitle() * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-get-by-title.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace NoGetByTitle { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow setup and teardown hooks * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-hooks.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace NoHooks { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "allow": { * "contains": [ * "beforeAll", * "beforeEach", * "afterAll", * "afterEach" * ], * "type": "array" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ allow?: readonly unknown[]; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Disallow nested `test.step()` methods * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-nested-step.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoNestedStep { type RuleEntry = Linter.StringSeverity; } /** * @description Prevent usage of the networkidle option * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-networkidle.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoNetworkidle { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow usage of nth methods * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-nth-methods.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoNthMethods { type RuleEntry = Linter.StringSeverity; } /** * @description Prevent usage of page.pause() * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-page-pause.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoPagePause { type RuleEntry = Linter.StringSeverity; } /** * @description Disallows the usage of raw locators * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-raw-locators.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace NoRawLocators { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "allowed": { * "items": { * "type": "string" * }, * "type": "array" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ allowed?: readonly string[]; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Disallows the usage of specific locator methods * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-restricted-locators.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace NoRestrictedLocators { /** * ### schema * * ```json * [ * { * "items": { * "oneOf": [ * { * "type": "string" * }, * { * "additionalProperties": false, * "properties": { * "message": { * "type": "string" * }, * "type": { * "type": "string" * } * }, * "required": [ * "type" * ], * "type": "object" * } * ] * }, * "type": "array" * } * ] * ``` */ type Options = readonly (string | Readonly<{ message?: string; type: string; }>)[]; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Disallow specific matchers & modifiers * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-restricted-matchers.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace NoRestrictedMatchers { /** * ### schema * * ```json * [ * { * "additionalProperties": { * "type": [ * "string", * "null" * ] * }, * "type": "object" * } * ] * ``` */ type Options = ReadonlyRecord; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Disallows the usage of specific roles in getByRole() * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-restricted-roles.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace NoRestrictedRoles { /** * ### schema * * ```json * [ * { * "items": { * "oneOf": [ * { * "type": "string" * }, * { * "additionalProperties": false, * "properties": { * "message": { * "type": "string" * }, * "role": { * "type": "string" * } * }, * "required": [ * "role" * ], * "type": "object" * } * ] * }, * "type": "array" * } * ] * ``` */ type Options = readonly (string | Readonly<{ message?: string; role: string; }>)[]; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Prevent usage of the `.skip()` skip test annotation. * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-skipped-test.md * * ```md * | key | value | * | :------------- | :--------- | * | type | suggestion | * | deprecated | false | * | hasSuggestions | true | * | recommended | true | * ``` */ declare namespace NoSkippedTest { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "allowConditional": { * "default": false, * "type": "boolean" * }, * "disallowFixme": { * "default": false, * "type": "boolean" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ /** * @default false */ allowConditional?: boolean; /** * @default false */ disallowFixme?: boolean; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Prevent usage of the `.slow()` slow test annotation. * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-slowed-test.md * * ```md * | key | value | * | :------------- | :--------- | * | type | suggestion | * | deprecated | false | * | hasSuggestions | true | * | recommended | false | * ``` */ declare namespace NoSlowedTest { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "allowConditional": { * "default": false, * "type": "boolean" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ /** * @default false */ allowConditional?: boolean; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Disallow using `expect` outside of `test` blocks * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-standalone-expect.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace NoStandaloneExpect { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow assertions on a Locator that can never fail * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-unnecessary-assertions.md * * ```md * | key | value | * | :------------- | :------ | * | type | problem | * | deprecated | false | * | hasSuggestions | true | * | recommended | true | * ``` */ declare namespace NoUnnecessaryAssertions { type RuleEntry = Linter.StringSeverity; } /** * @description Prevent unsafe variable references in page.evaluate() and page.addInitScript() * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-unsafe-references.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | fixable | code | * | recommended | true | * ``` */ declare namespace NoUnsafeReferences { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow usage of page locators that are not used * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-unused-locators.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace NoUnusedLocators { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow unnecessary awaits for Playwright methods * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-useless-await.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | fixable | code | * | recommended | true | * ``` */ declare namespace NoUselessAwait { type RuleEntry = Linter.StringSeverity; } /** * @description Disallow usage of 'not' matchers when a more specific matcher exists * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-useless-not.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | fixable | code | * | recommended | true | * ``` */ declare namespace NoUselessNot { type RuleEntry = Linter.StringSeverity; } /** * @description Prevent usage of page.waitForNavigation() * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-navigation.md * * ```md * | key | value | * | :------------- | :--------- | * | type | suggestion | * | deprecated | false | * | hasSuggestions | true | * | recommended | true | * ``` */ declare namespace NoWaitForNavigation { type RuleEntry = Linter.StringSeverity; } /** * @description Prevent usage of page.waitForSelector() * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-selector.md * * ```md * | key | value | * | :------------- | :--------- | * | type | suggestion | * | deprecated | false | * | hasSuggestions | true | * | recommended | true | * ``` */ declare namespace NoWaitForSelector { type RuleEntry = Linter.StringSeverity; } /** * @description Prevent usage of page.waitForTimeout() * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-timeout.md * * ```md * | key | value | * | :------------- | :--------- | * | type | suggestion | * | deprecated | false | * | hasSuggestions | true | * | recommended | true | * ``` */ declare namespace NoWaitForTimeout { type RuleEntry = Linter.StringSeverity; } /** * @description Suggest using the built-in comparison matchers * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-comparison-matcher.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace PreferComparisonMatcher { type RuleEntry = Linter.StringSeverity; } /** * @description Suggest using the built-in equality matchers * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-equality-matcher.md * * ```md * | key | value | * | :------------- | :--------- | * | type | suggestion | * | deprecated | false | * | hasSuggestions | true | * | recommended | false | * ``` */ declare namespace PreferEqualityMatcher { type RuleEntry = Linter.StringSeverity; } /** * @description Prefer having hooks in a consistent order * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-hooks-in-order.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace PreferHooksInOrder { type RuleEntry = Linter.StringSeverity; } /** * @description Suggest having hooks before any test cases * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-hooks-on-top.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace PreferHooksOnTop { type RuleEntry = Linter.StringSeverity; } /** * @description Suggest locators over page methods * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-locator.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace PreferLocator { type RuleEntry = Linter.StringSeverity; } /** * @description Enforce lowercase test names * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-lowercase-title.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace PreferLowercaseTitle { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "allowedPrefixes": { * "additionalItems": false, * "items": { * "type": "string" * }, * "type": "array" * }, * "ignore": { * "additionalItems": false, * "items": { * "enum": [ * "test.describe", * "test" * ] * }, * "type": "array" * }, * "ignoreTopLevelDescribe": { * "default": false, * "type": "boolean" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ allowedPrefixes?: readonly string[]; ignore?: readonly ('test.describe' | 'test')[]; /** * @default false */ ignoreTopLevelDescribe?: boolean; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Prefer native locator functions * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-native-locators.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace PreferNativeLocators { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "testIdAttribute": { * "default": "data-testid", * "type": "string" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ /** * @default "data-testid" */ testIdAttribute?: string; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Suggest using `toStrictEqual()` * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-strict-equal.md * * ```md * | key | value | * | :------------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | hasSuggestions | true | * | recommended | false | * ``` */ declare namespace PreferStrictEqual { type RuleEntry = Linter.StringSeverity; } /** * @description Suggest using `toBe()` for primitive literals * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-be.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace PreferToBe { type RuleEntry = Linter.StringSeverity; } /** * @description Suggest using toContain() * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-contain.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace PreferToContain { type RuleEntry = Linter.StringSeverity; } /** * @description Suggest using `toHaveCount()` * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-have-count.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace PreferToHaveCount { type RuleEntry = Linter.StringSeverity; } /** * @description Suggest using `toHaveLength()` * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-have-length.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace PreferToHaveLength { type RuleEntry = Linter.StringSeverity; } /** * @description Prefer web first assertions * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/prefer-web-first-assertions.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | true | * ``` */ declare namespace PreferWebFirstAssertions { type RuleEntry = Linter.StringSeverity; } /** * @description Require setup and teardown code to be within a hook * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/require-hook.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace RequireHook { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "allowedFunctionCalls": { * "items": { * "type": "string" * }, * "type": "array" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ allowedFunctionCalls?: readonly string[]; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Require all assertions to use `expect.soft` * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/require-soft-assertions.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | false | * ``` */ declare namespace RequireSoftAssertions { type RuleEntry = Linter.StringSeverity; } /** * @description Require test blocks to have tags * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/require-tags.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace RequireTags { type RuleEntry = Linter.StringSeverity; } /** * @description Require a timeout option for `toPass()` * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/require-to-pass-timeout.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace RequireToPassTimeout { type RuleEntry = Linter.StringSeverity; } /** * @description Require a message for `toThrow()` * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/require-to-throw-message.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace RequireToThrowMessage { type RuleEntry = Linter.StringSeverity; } /** * @description Require test cases and hooks to be inside a `test.describe` block * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/require-top-level-describe.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | false | * ``` */ declare namespace RequireTopLevelDescribe { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "maxTopLevelDescribes": { * "minimum": 1, * "type": "number" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ maxTopLevelDescribes?: number; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Enforce valid `describe()` callback * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/valid-describe-callback.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace ValidDescribeCallback { type RuleEntry = Linter.StringSeverity; } /** * @description Enforce valid `expect()` usage * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/valid-expect.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace ValidExpect { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "maxArgs": { * "minimum": 1, * "type": "number" * }, * "minArgs": { * "minimum": 1, * "type": "number" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ maxArgs?: number; minArgs?: number; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Require promises that have expectations in their chain to be valid * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/valid-expect-in-promise.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | recommended | true | * ``` */ declare namespace ValidExpectInPromise { type RuleEntry = Linter.StringSeverity; } /** * @description Enforce valid tag format in Playwright test blocks and titles * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/valid-test-tags.md * * ```md * | key | value | * | :---------- | :------ | * | type | problem | * | deprecated | false | * | recommended | true | * ``` */ declare namespace ValidTestTags { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "properties": { * "allowedTags": { * "items": { * "oneOf": [ * { * "type": "string" * }, * { * "additionalProperties": false, * "properties": { * "source": { * "type": "string" * } * }, * "type": "object" * } * ] * }, * "type": "array" * }, * "disallowedTags": { * "items": { * "oneOf": [ * { * "type": "string" * }, * { * "additionalProperties": false, * "properties": { * "source": { * "type": "string" * } * }, * "type": "object" * } * ] * }, * "type": "array" * } * }, * "type": "object" * } * ] * ``` */ type Options = Readonly<{ allowedTags?: readonly (string | Readonly<{ source?: string; }>)[]; disallowedTags?: readonly (string | Readonly<{ source?: string; }>)[]; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } /** * @description Enforce valid titles * @link https://github.com/mskelton/eslint-plugin-playwright/tree/main/docs/rules/valid-title.md * * ```md * | key | value | * | :---------- | :--------- | * | type | suggestion | * | deprecated | false | * | fixable | code | * | recommended | true | * ``` */ declare namespace ValidTitle { /** * ### schema * * ```json * [ * { * "additionalProperties": false, * "type": "object", * "definitions": { * "PatternOrPatternArray": { * "oneOf": [ * { * "type": "string" * }, * { * "additionalItems": false, * "items": { * "type": "string" * }, * "maxItems": 2, * "minItems": 1, * "type": "array" * } * ] * }, * "MustMatchType": { * "oneOf": [ * { * "$ref": "#/definitions/PatternOrPatternArray" * }, * { * "type": "object", * "properties": { * "describe": { * "$ref": "#/definitions/PatternOrPatternArray" * }, * "test": { * "$ref": "#/definitions/PatternOrPatternArray" * }, * "step": { * "$ref": "#/definitions/PatternOrPatternArray" * } * }, * "additionalProperties": false * } * ] * } * }, * "properties": { * "disallowedWords": { * "items": { * "type": "string" * }, * "type": "array" * }, * "ignoreSpaces": { * "default": false, * "type": "boolean" * }, * "ignoreTypeOfDescribeName": { * "default": false, * "type": "boolean" * }, * "ignoreTypeOfStepName": { * "default": true, * "type": "boolean" * }, * "ignoreTypeOfTestName": { * "default": false, * "type": "boolean" * }, * "mustMatch": { * "$ref": "#/definitions/MustMatchType" * }, * "mustNotMatch": { * "$ref": "#/definitions/MustMatchType" * } * } * } * ] * ``` */ type MustMatchType = PatternOrPatternArray | Readonly<{ describe?: PatternOrPatternArray; test?: PatternOrPatternArray; step?: PatternOrPatternArray; }>; type PatternOrPatternArray = string | readonly [string] | FixedLengthTuple<2, string>; type Options = Readonly<{ disallowedWords?: readonly string[]; /** * @default false */ ignoreSpaces?: boolean; /** * @default false */ ignoreTypeOfDescribeName?: boolean; /** * @default true */ ignoreTypeOfStepName?: boolean; /** * @default false */ ignoreTypeOfTestName?: boolean; mustMatch?: MustMatchType; mustNotMatch?: MustMatchType; }>; type RuleEntry = 'off' | Linter.Severity | SpreadOptionsIfIsArray; } export type EslintPlaywrightRules = Readonly<{ 'playwright/consistent-spacing-between-blocks': ConsistentSpacingBetweenBlocks.RuleEntry; 'playwright/expect-expect': ExpectExpect.RuleEntry; 'playwright/max-expects': MaxExpects.RuleEntry; 'playwright/max-nested-describe': MaxNestedDescribe.RuleEntry; 'playwright/missing-playwright-await': MissingPlaywrightAwait.RuleEntry; 'playwright/no-commented-out-tests': NoCommentedOutTests.RuleEntry; 'playwright/no-conditional-expect': NoConditionalExpect.RuleEntry; 'playwright/no-conditional-in-test': NoConditionalInTest.RuleEntry; 'playwright/no-duplicate-hooks': NoDuplicateHooks.RuleEntry; 'playwright/no-duplicate-slow': NoDuplicateSlow.RuleEntry; 'playwright/no-element-handle': NoElementHandle.RuleEntry; 'playwright/no-eval': NoEval.RuleEntry; 'playwright/no-focused-test': NoFocusedTest.RuleEntry; 'playwright/no-force-option': NoForceOption.RuleEntry; 'playwright/no-get-by-title': NoGetByTitle.RuleEntry; 'playwright/no-hooks': NoHooks.RuleEntry; 'playwright/no-nested-step': NoNestedStep.RuleEntry; 'playwright/no-networkidle': NoNetworkidle.RuleEntry; 'playwright/no-nth-methods': NoNthMethods.RuleEntry; 'playwright/no-page-pause': NoPagePause.RuleEntry; 'playwright/no-raw-locators': NoRawLocators.RuleEntry; 'playwright/no-restricted-locators': NoRestrictedLocators.RuleEntry; 'playwright/no-restricted-matchers': NoRestrictedMatchers.RuleEntry; 'playwright/no-restricted-roles': NoRestrictedRoles.RuleEntry; 'playwright/no-skipped-test': NoSkippedTest.RuleEntry; 'playwright/no-slowed-test': NoSlowedTest.RuleEntry; 'playwright/no-standalone-expect': NoStandaloneExpect.RuleEntry; 'playwright/no-unnecessary-assertions': NoUnnecessaryAssertions.RuleEntry; 'playwright/no-unsafe-references': NoUnsafeReferences.RuleEntry; 'playwright/no-unused-locators': NoUnusedLocators.RuleEntry; 'playwright/no-useless-await': NoUselessAwait.RuleEntry; 'playwright/no-useless-not': NoUselessNot.RuleEntry; 'playwright/no-wait-for-navigation': NoWaitForNavigation.RuleEntry; 'playwright/no-wait-for-selector': NoWaitForSelector.RuleEntry; 'playwright/no-wait-for-timeout': NoWaitForTimeout.RuleEntry; 'playwright/prefer-comparison-matcher': PreferComparisonMatcher.RuleEntry; 'playwright/prefer-equality-matcher': PreferEqualityMatcher.RuleEntry; 'playwright/prefer-hooks-in-order': PreferHooksInOrder.RuleEntry; 'playwright/prefer-hooks-on-top': PreferHooksOnTop.RuleEntry; 'playwright/prefer-locator': PreferLocator.RuleEntry; 'playwright/prefer-lowercase-title': PreferLowercaseTitle.RuleEntry; 'playwright/prefer-native-locators': PreferNativeLocators.RuleEntry; 'playwright/prefer-strict-equal': PreferStrictEqual.RuleEntry; 'playwright/prefer-to-be': PreferToBe.RuleEntry; 'playwright/prefer-to-contain': PreferToContain.RuleEntry; 'playwright/prefer-to-have-count': PreferToHaveCount.RuleEntry; 'playwright/prefer-to-have-length': PreferToHaveLength.RuleEntry; 'playwright/prefer-web-first-assertions': PreferWebFirstAssertions.RuleEntry; 'playwright/require-hook': RequireHook.RuleEntry; 'playwright/require-soft-assertions': RequireSoftAssertions.RuleEntry; 'playwright/require-tags': RequireTags.RuleEntry; 'playwright/require-to-pass-timeout': RequireToPassTimeout.RuleEntry; 'playwright/require-to-throw-message': RequireToThrowMessage.RuleEntry; 'playwright/require-top-level-describe': RequireTopLevelDescribe.RuleEntry; 'playwright/valid-describe-callback': ValidDescribeCallback.RuleEntry; 'playwright/valid-expect': ValidExpect.RuleEntry; 'playwright/valid-expect-in-promise': ValidExpectInPromise.RuleEntry; 'playwright/valid-test-tags': ValidTestTags.RuleEntry; 'playwright/valid-title': ValidTitle.RuleEntry; }>; export type EslintPlaywrightRulesOption = Readonly<{ 'playwright/expect-expect': ExpectExpect.Options; 'playwright/max-expects': MaxExpects.Options; 'playwright/max-nested-describe': MaxNestedDescribe.Options; 'playwright/missing-playwright-await': MissingPlaywrightAwait.Options; 'playwright/no-hooks': NoHooks.Options; 'playwright/no-raw-locators': NoRawLocators.Options; 'playwright/no-restricted-locators': NoRestrictedLocators.Options; 'playwright/no-restricted-matchers': NoRestrictedMatchers.Options; 'playwright/no-restricted-roles': NoRestrictedRoles.Options; 'playwright/no-skipped-test': NoSkippedTest.Options; 'playwright/no-slowed-test': NoSlowedTest.Options; 'playwright/prefer-lowercase-title': PreferLowercaseTitle.Options; 'playwright/prefer-native-locators': PreferNativeLocators.Options; 'playwright/require-hook': RequireHook.Options; 'playwright/require-top-level-describe': RequireTopLevelDescribe.Options; 'playwright/valid-expect': ValidExpect.Options; 'playwright/valid-test-tags': ValidTestTags.Options; 'playwright/valid-title': ValidTitle.Options; }>; export {}; //# sourceMappingURL=eslint-playwright-rules.d.mts.map