@immense/vue-pom-generator 1.0.90 → 1.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -10
- package/RELEASE_NOTES.md +95 -62
- package/class-generation/base-page.ts +141 -59
- package/class-generation/diagnostics.ts +559 -0
- package/class-generation/index.ts +247 -128
- package/class-generation/playwright-types.ts +7 -11
- package/class-generation/pointer.ts +65 -18
- package/dist/class-generation/base-page.d.ts +19 -4
- package/dist/class-generation/base-page.d.ts.map +1 -1
- package/dist/class-generation/diagnostics.d.ts +110 -0
- package/dist/class-generation/diagnostics.d.ts.map +1 -0
- package/dist/class-generation/index.d.ts +4 -0
- package/dist/class-generation/index.d.ts.map +1 -1
- package/dist/class-generation/playwright-types.d.ts +3 -39
- package/dist/class-generation/playwright-types.d.ts.map +1 -1
- package/dist/class-generation/pointer.d.ts +10 -1
- package/dist/class-generation/pointer.d.ts.map +1 -1
- package/dist/eslint/index.cjs +52 -9
- package/dist/eslint/index.cjs.map +1 -1
- package/dist/eslint/index.d.ts +16 -7
- package/dist/eslint/index.d.ts.map +1 -1
- package/dist/eslint/index.mjs +52 -9
- package/dist/eslint/index.mjs.map +1 -1
- package/dist/index.cjs +728 -324
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +728 -324
- package/dist/index.mjs.map +1 -1
- package/dist/manifest-generator.d.ts +10 -5
- package/dist/manifest-generator.d.ts.map +1 -1
- package/dist/method-generation.d.ts.map +1 -1
- package/dist/playwright/reporter.cjs +174 -0
- package/dist/playwright/reporter.cjs.map +1 -0
- package/dist/playwright/reporter.d.ts +13 -0
- package/dist/playwright/reporter.d.ts.map +1 -0
- package/dist/playwright/reporter.mjs +174 -0
- package/dist/playwright/reporter.mjs.map +1 -0
- package/dist/plugin/internal/build-plugin.d.ts +2 -0
- package/dist/plugin/internal/build-plugin.d.ts.map +1 -1
- package/dist/plugin/internal/dev-plugin.d.ts +2 -0
- package/dist/plugin/internal/dev-plugin.d.ts.map +1 -1
- package/dist/plugin/internal-plugins.d.ts.map +1 -1
- package/dist/route-navigation-codegen.d.ts +40 -0
- package/dist/route-navigation-codegen.d.ts.map +1 -0
- package/dist/router-bridge.d.ts +15 -0
- package/dist/router-bridge.d.ts.map +1 -1
- package/dist/router.cjs +41 -1
- package/dist/router.cjs.map +1 -1
- package/dist/router.mjs +41 -1
- package/dist/router.mjs.map +1 -1
- package/dist/tests/broad/helpers/fake-runtime.d.ts +27 -3
- package/dist/tests/broad/helpers/fake-runtime.d.ts.map +1 -1
- package/dist/tests/fixtures/generated-tsc/base-page.full.d.ts +16 -3
- package/dist/tests/fixtures/generated-tsc/base-page.full.d.ts.map +1 -1
- package/dist/tests/method-generation.test.d.ts +2 -0
- package/dist/tests/method-generation.test.d.ts.map +1 -0
- package/dist/tests/playwright-diagnostics.test.d.ts +2 -0
- package/dist/tests/playwright-diagnostics.test.d.ts.map +1 -0
- package/dist/tests/playwright-reporter.test.d.ts +2 -0
- package/dist/tests/playwright-reporter.test.d.ts.map +1 -0
- package/dist/transform.d.ts.map +1 -1
- package/dist/vite.config.d.ts.map +1 -1
- package/package.json +8 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../eslint/no-data-testid-in-specs.ts","../../eslint/no-page-fixture-in-specs.ts","../../eslint/no-raw-playwright-apis.ts","../../eslint/remove-existing-test-id-attributes.ts","../../eslint/index.ts"],"sourcesContent":["import type { Rule } from \"eslint\";\nimport type { CallExpression, Literal, MemberExpression, TemplateLiteral } from \"estree\";\n\nfunction includesDataTestId(value: Literal[\"value\"]): value is string {\n return typeof value === \"string\" && value.includes(\"data-testid\");\n}\n\nexport const noDataTestIdInSpecsRule: Rule.RuleModule = {\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow raw data-testid strings and getByTestId calls in Playwright specs.\",\n },\n messages: {\n noDataTestIdInSpecs: \"Avoid data-testid in spec files; use a generated POM or fixture accessor instead.\",\n noGetByTestIdInSpecs: \"Avoid getByTestId(...) in spec files; use a generated POM or fixture accessor instead.\",\n },\n schema: [],\n },\n create(context) {\n return {\n Literal(node: Literal) {\n if (includesDataTestId(node.value)) {\n context.report({ node, messageId: \"noDataTestIdInSpecs\" });\n }\n },\n TemplateLiteral(node: TemplateLiteral) {\n const staticText = node.quasis.map(quasi => quasi.value.cooked).join(\"\");\n if (includesDataTestId(staticText)) {\n context.report({ node, messageId: \"noDataTestIdInSpecs\" });\n }\n },\n CallExpression(node: CallExpression) {\n if (node.callee.type !== \"MemberExpression\")\n return;\n\n const callee = node.callee as MemberExpression;\n const isGetByTestId = !callee.computed\n ? callee.property.type === \"Identifier\" && callee.property.name === \"getByTestId\"\n : callee.property.type === \"Literal\" && callee.property.value === \"getByTestId\";\n\n if (isGetByTestId) {\n context.report({ node, messageId: \"noGetByTestIdInSpecs\" });\n }\n },\n };\n },\n};\n","import path from \"node:path\";\nimport type { Rule } from \"eslint\";\nimport type { ArrowFunctionExpression, CallExpression, FunctionExpression } from \"estree\";\n\nconst DIRECT_TEST_CALLS = new Set([\"test\", \"it\"]);\nconst TEST_WRAPPER_CALLS = new Set([\"only\", \"skip\", \"fixme\", \"fail\"]);\nconst TEST_HOOK_CALLS = new Set([\"beforeEach\", \"beforeAll\", \"afterEach\", \"afterAll\"]);\nconst SPEC_FILE_SUFFIXES = new Set([\n\t\".spec.ts\",\n\t\".spec.tsx\",\n\t\".spec.js\",\n\t\".spec.jsx\",\n\t\".spec.cts\",\n\t\".spec.ctsx\",\n\t\".spec.cjs\",\n\t\".spec.cjsx\",\n\t\".spec.mts\",\n\t\".spec.mtsx\",\n\t\".spec.mjs\",\n\t\".spec.mjsx\",\n]);\n\nfunction isSpecFile(filename: string): boolean {\n\tconst basename = path.basename(filename);\n\treturn Array.from(SPEC_FILE_SUFFIXES).some(suffix => basename.endsWith(suffix));\n}\n\nfunction isFunctionExpression(\n\tnode: CallExpression[\"arguments\"][number] | null | undefined,\n): node is ArrowFunctionExpression | FunctionExpression {\n\treturn node != null\n\t\t&& typeof node === \"object\"\n\t\t&& \"type\" in node\n\t\t&& (node.type === \"ArrowFunctionExpression\" || node.type === \"FunctionExpression\");\n}\n\nfunction getCallbackArgIndex(callee: CallExpression[\"callee\"]): number | null {\n\tif (callee.type === \"Identifier\" && DIRECT_TEST_CALLS.has(callee.name))\n\t\treturn 1;\n\n\tif (\n\t\tcallee.type === \"MemberExpression\"\n\t\t&& !callee.computed\n\t\t&& callee.object.type === \"Identifier\"\n\t\t&& DIRECT_TEST_CALLS.has(callee.object.name)\n\t\t&& callee.property.type === \"Identifier\"\n\t) {\n\t\tif (TEST_WRAPPER_CALLS.has(callee.property.name))\n\t\t\treturn 1;\n\n\t\tif (TEST_HOOK_CALLS.has(callee.property.name))\n\t\t\treturn 0;\n\t}\n\n\treturn null;\n}\n\nfunction getPageFixtureProperty(param: ArrowFunctionExpression[\"params\"][0] | FunctionExpression[\"params\"][0]) {\n\tif (!param || param.type !== \"ObjectPattern\")\n\t\treturn null;\n\n\tfor (const property of param.properties) {\n\t\tif (property.type !== \"Property\" || property.computed)\n\t\t\tcontinue;\n\n\t\tif (property.key.type === \"Identifier\" && property.key.name === \"page\")\n\t\t\treturn property;\n\t}\n\n\treturn null;\n}\n\nexport const noPageFixtureInSpecsRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow Playwright's default `page` fixture in spec callbacks. Prefer generated fixtures and POMs instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoPageFixture:\n\t\t\t\t\"Do not destructure the default `page` fixture in spec callbacks. Use generated fixtures and POMs instead.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.getFilename();\n\t\tif (!isSpecFile(filename))\n\t\t\treturn {};\n\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tconst callbackArgIndex = getCallbackArgIndex(node.callee);\n\t\t\t\tif (callbackArgIndex == null)\n\t\t\t\t\treturn;\n\n\t\t\t\tconst callback = node.arguments[callbackArgIndex];\n\t\t\t\tif (!isFunctionExpression(callback))\n\t\t\t\t\treturn;\n\n\t\t\t\tconst pageFixtureProperty = getPageFixtureProperty(callback.params[0]);\n\t\t\t\tif (!pageFixtureProperty)\n\t\t\t\t\treturn;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: pageFixtureProperty,\n\t\t\t\t\tmessageId: \"noPageFixture\",\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { MemberExpression } from \"estree\";\n\n// Locator-filter methods available on Page/Locator/Frame etc. Banned regardless of\n// the receiver object. `getByTestId` is the generator's own test-id contract — specs\n// should reach it through a generated POM accessor, never a raw `*.getByTestId(...)`.\nconst bannedPlaywrightApis = new Set([\"locator\", \"getByRole\", \"getByText\", \"getByLabel\", \"getByTestId\"]);\n\nconst bannedPageApis = new Set([\n\t\"$eval\",\n\t\"$$eval\",\n\t\"click\",\n\t\"evaluate\",\n\t\"isHidden\",\n\t\"isVisible\",\n\t\"waitForSelector\",\n]);\n\nconst SPEC_FILE_SUFFIXES = [\".spec.ts\", \".spec.tsx\", \".spec.js\", \".spec.jsx\"];\n\nfunction isSpecFile(filename: string): boolean {\n\treturn SPEC_FILE_SUFFIXES.some((suffix) => filename.endsWith(suffix));\n}\n\n/**\n * Resolve the accessed property name from a MemberExpression callee, covering both\n * the usual member access (`page.getByTestId(...)`) and the computed equivalent\n * (`page[\"getByTestId\"](...)`). A computed access whose key is a non-Literal\n * (e.g. `obj[dynamicKey]()`) cannot be resolved to a name, so it returns\n * `undefined` and is left alone — it could be anything at runtime.\n */\nfunction resolveMemberPropertyName(callee: MemberExpression): string | undefined {\n\tconst { property, computed } = callee;\n\tif (!computed && property.type === \"Identifier\") {\n\t\treturn property.name;\n\t}\n\tif (computed && property.type === \"Literal\" && typeof property.value === \"string\") {\n\t\treturn property.value;\n\t}\n\treturn undefined;\n}\n\nexport const noRawPlaywrightApisRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Ban raw Playwright APIs in spec files. Use generated fixtures/POMs or a custom POM for unsupported surfaces instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tlegacyCursorHelper:\n\t\t\t\t\"Do not use {{name}} in Playwright spec files. Prefer generated fixtures/POMs or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightApi:\n\t\t\t\t\"Do not call {{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightPageApi:\n\t\t\t\t\"Do not call page.{{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tif (!isSpecFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst sourceCode = context.sourceCode;\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (node.callee.type === \"Identifier\" && node.callee.name.includes(\"animateCursor\")) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee,\n\t\t\t\t\t\tmessageId: \"legacyCursorHelper\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: node.callee.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst apiName = resolveMemberPropertyName(node.callee as MemberExpression);\n\t\t\t\tif (apiName === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst objectText = sourceCode.getText(node.callee.object);\n\n\t\t\t\tif (\n\t\t\t\t\t(objectText === \"page\" || objectText === \"playwrightPage\")\n\t\t\t\t\t&& bannedPageApis.has(apiName)\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\t\tmessageId: \"rawPlaywrightPageApi\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!bannedPlaywrightApis.has(apiName)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\tmessageId: \"rawPlaywrightApi\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { AST as VueAST } from \"vue-eslint-parser\";\n\ntype VAttribute = VueAST.VAttribute;\ntype VDirective = VueAST.VDirective;\ntype VElement = VueAST.VElement;\ntype VueAttribute = VAttribute | VDirective;\ntype VueTemplateVisitor = {\n\tVElement: (node: VElement) => void;\n};\n\nfunction isVueTemplateFile(filename: string): boolean {\n\treturn filename.endsWith(\".vue\");\n}\n\nfunction isWhitespaceCharacter(character: string): boolean {\n\treturn character === \" \"\n\t\t|| character === \"\\t\"\n\t\t|| character === \"\\n\"\n\t\t|| character === \"\\r\"\n\t\t|| character === \"\\f\";\n}\n\nfunction removeAttributeWithWhitespace(\n\tattribute: VueAttribute,\n\tcontext: Rule.RuleContext,\n\tfixer: Rule.RuleFixer,\n): Rule.Fix {\n\tconst sourceText = context.sourceCode.getText();\n\tconst [start, end] = attribute.range;\n\n\tlet adjustedStart = start;\n\twhile (adjustedStart > 0 && isWhitespaceCharacter(sourceText[adjustedStart - 1])) {\n\t\tadjustedStart -= 1;\n\t}\n\n\treturn fixer.removeRange([adjustedStart, end]);\n}\n\nfunction isTargetAttribute(attribute: VueAttribute, attributeName: string): boolean {\n\tif (!attribute.directive) {\n\t\treturn attribute.key.type === \"VIdentifier\" && attribute.key.name === attributeName;\n\t}\n\n\tif (attribute.key.type !== \"VDirectiveKey\") {\n\t\treturn false;\n\t}\n\n\tconst directiveName = attribute.key.name;\n\tconst argument = attribute.key.argument;\n\n\treturn directiveName.type === \"VIdentifier\"\n\t\t&& directiveName.name === \"bind\"\n\t\t&& argument?.type === \"VIdentifier\"\n\t\t&& argument.name === attributeName;\n}\n\nfunction findExistingTestIdAttribute(node: VElement, attributeName: string): VueAttribute | undefined {\n\treturn node.startTag.attributes.find(attribute => isTargetAttribute(attribute, attributeName));\n}\n\nfunction defineVueTemplateVisitor(\n\tcontext: Rule.RuleContext,\n\ttemplateVisitor: VueTemplateVisitor,\n): Rule.RuleListener {\n\tconst parserServices = context.sourceCode.parserServices as {\n\t\tdefineTemplateBodyVisitor?: (\n\t\t\ttemplateBodyVisitor: VueTemplateVisitor,\n\t\t\tscriptVisitor: Rule.RuleListener,\n\t\t\toptions: { templateBodyTriggerSelector: \"Program\" },\n\t\t) => Rule.RuleListener;\n\t};\n\n\tif (!parserServices.defineTemplateBodyVisitor) {\n\t\treturn {};\n\t}\n\n\treturn parserServices.defineTemplateBodyVisitor(\n\t\ttemplateVisitor,\n\t\t{},\n\t\t{ templateBodyTriggerSelector: \"Program\" },\n\t);\n}\n\nexport const removeExistingTestIdAttributesRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Remove existing test-id attributes from Vue templates so vue-pom-generator can generate them consistently.\",\n\t\t},\n\t\tfixable: \"code\",\n\t\tmessages: {\n\t\t\tremoveExistingTestIdAttribute:\n\t\t\t\t\"Remove explicit {{attribute}}. vue-pom-generator can generate it; run this rule with --fix to clean legacy attributes project-wide.\",\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tattribute: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescription: \"Attribute name to remove. Defaults to data-testid.\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tcreate(context): Rule.RuleListener {\n\t\tif (!isVueTemplateFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst options = (context.options[0] ?? {}) as { attribute?: string };\n\t\tconst attributeName = (options.attribute ?? \"data-testid\").trim() || \"data-testid\";\n\n\t\treturn defineVueTemplateVisitor(context, {\n\t\t\tVElement(node: VElement) {\n\t\t\t\tconst existingAttribute = findExistingTestIdAttribute(node, attributeName);\n\t\t\t\tif (!existingAttribute) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: existingAttribute,\n\t\t\t\t\tmessageId: \"removeExistingTestIdAttribute\",\n\t\t\t\t\tdata: { attribute: attributeName },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\treturn removeAttributeWithWhitespace(existingAttribute, context, fixer);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t},\n};","import type { Rule } from \"eslint\";\nimport type { CallExpression, Expression, MemberExpression } from \"estree\";\n\nimport { noDataTestIdInSpecsRule } from \"./no-data-testid-in-specs\";\nimport { noPageFixtureInSpecsRule } from \"./no-page-fixture-in-specs\";\nimport { noRawPlaywrightApisRule } from \"./no-raw-playwright-apis\";\nimport { removeExistingTestIdAttributesRule } from \"./remove-existing-test-id-attributes\";\n\n/**\n * Playwright locator action methods that should be called via generated POM\n * methods rather than directly on element getters.\n */\nconst LOCATOR_ACTIONS = new Set([\n\t\"click\",\n\t\"dblclick\",\n\t\"fill\",\n\t\"check\",\n\t\"uncheck\",\n\t\"type\",\n\t\"clear\",\n\t\"selectOption\",\n\t\"setInputFiles\",\n\t\"tap\",\n\t\"hover\",\n\t\"focus\",\n\t\"dispatchEvent\",\n\t\"press\",\n\t\"selectText\",\n]);\n\n/**\n * Locator chain methods that are transparent for the purposes of this rule —\n * `.last().click()` is still a raw action on a POM getter.\n */\nconst CHAIN_METHODS = new Set([\"last\", \"first\", \"nth\", \"filter\"]);\n\nfunction startsWithUppercaseLetter(value: string): boolean {\n\tconst first = value.charCodeAt(0);\n\treturn first >= 65 && first <= 90;\n}\n\n/**\n * Returns the PascalCase getter name if `node` is (or chains from) a direct\n * PascalCase member-expression access. Returns null otherwise.\n *\n * Handles:\n * pom.SubmitButton → \"SubmitButton\"\n * pom.SubmitButton.last() → \"SubmitButton\"\n * pom.SubmitButton.nth(0) → \"SubmitButton\"\n */\nfunction getPomGetterName(node: Expression): string | null {\n\tif (node.type === \"MemberExpression\" && !node.computed && node.property.type === \"Identifier\") {\n\t\tconst name = node.property.name;\n\t\tif (startsWithUppercaseLetter(name)) return name;\n\t}\n\n\tif (\n\t\tnode.type === \"CallExpression\"\n\t\t&& node.callee.type === \"MemberExpression\"\n\t\t&& !node.callee.computed\n\t\t&& node.callee.property.type === \"Identifier\"\n\t\t&& CHAIN_METHODS.has(node.callee.property.name)\n\t) {\n\t\treturn getPomGetterName((node.callee as MemberExpression).object as Expression);\n\t}\n\n\treturn null;\n}\n\nexport const noRawLocatorActionRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow calling raw Playwright action methods directly on POM element getters. Use the generated typed POM methods instead (e.g. `clickSubmitButton()`).\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoRawAction:\n\t\t\t\t\"Use the generated POM method instead of `{{getter}}.{{method}}()`. \"\n\t\t\t\t+ \"Call `click{{getter}}()` / `type{{getter}}(text)` or similar.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") return;\n\t\t\t\tconst callee = node.callee as MemberExpression;\n\t\t\t\tif (callee.computed || callee.property.type !== \"Identifier\") return;\n\n\t\t\t\tconst methodName = callee.property.name;\n\t\t\t\tif (!LOCATOR_ACTIONS.has(methodName)) return;\n\n\t\t\t\tconst getterName = getPomGetterName(callee.object as Expression);\n\t\t\t\tif (!getterName) return;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: \"noRawAction\",\n\t\t\t\t\tdata: { getter: getterName, method: methodName },\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport const plugin = {\n\trules: {\n\t\t\"no-data-testid-in-specs\": noDataTestIdInSpecsRule,\n\t\t\"no-page-fixture-in-specs\": noPageFixtureInSpecsRule,\n\t\t\"no-raw-locator-action\": noRawLocatorActionRule,\n\t\t\"no-raw-playwright-apis\": noRawPlaywrightApisRule,\n\t\t\"remove-existing-test-id-attributes\": removeExistingTestIdAttributesRule,\n\t},\n} satisfies { rules: Record<string, Rule.RuleModule> };\n\nexport { noPageFixtureInSpecsRule };\nexport { noDataTestIdInSpecsRule };\nexport { noRawPlaywrightApisRule };\nexport { removeExistingTestIdAttributesRule };\n"],"names":["SPEC_FILE_SUFFIXES","isSpecFile"],"mappings":";;;AAGA,SAAS,mBAAmB,OAA0C;AACpE,SAAO,OAAO,UAAU,YAAY,MAAM,SAAS,aAAa;AAClE;AAEO,MAAM,0BAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,aAAa;AAAA,IAAA;AAAA,IAEf,UAAU;AAAA,MACR,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,IAAA;AAAA,IAExB,QAAQ,CAAA;AAAA,EAAC;AAAA,EAEX,OAAO,SAAS;AACd,WAAO;AAAA,MACL,QAAQ,MAAe;AACrB,YAAI,mBAAmB,KAAK,KAAK,GAAG;AAClC,kBAAQ,OAAO,EAAE,MAAM,WAAW,uBAAuB;AAAA,QAC3D;AAAA,MACF;AAAA,MACA,gBAAgB,MAAuB;AACrC,cAAM,aAAa,KAAK,OAAO,IAAI,C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nC,YAAI,CAAC,gBAAgB,IAAI,UAAU,EAAG;AAEtC,cAAM,aAAa,iBAAiB,OAAO,MAAoB;AAC/D,YAAI,CAAC,WAAY;AAEjB,gBAAQ,OAAO;AAAA,UACd;AAAA,UACA,WAAW;AAAA,UACX,MAAM,EAAE,QAAQ,YAAY,QAAQ,WAAA;AAAA,QAAW,CAC/C;AAAA,MACF;AAAA,IAAA;AAAA,EAEF;AACD;AAEO,MAAM,SAAS;AAAA,EACrB,OAAO;AAAA,IACN,2BAA2B;AAAA,IAC3B,4BAA4B;AAAA,IAC5B,yBAAyB;AAAA,IACzB,0BAA0B;AAAA,IAC1B,sCAAsC;AAAA,EAAA;AAExC;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../eslint/no-data-testid-in-specs.ts","../../eslint/no-page-fixture-in-specs.ts","../../eslint/no-raw-playwright-apis.ts","../../eslint/remove-existing-test-id-attributes.ts","../../eslint/index.ts"],"sourcesContent":["import type { Rule } from \"eslint\";\nimport type { CallExpression, Literal, MemberExpression, TemplateLiteral } from \"estree\";\n\nfunction includesDataTestId(value: Literal[\"value\"]): value is string {\n return typeof value === \"string\" && value.includes(\"data-testid\");\n}\n\nexport const noDataTestIdInSpecsRule: Rule.RuleModule = {\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow raw data-testid strings and getByTestId calls in Playwright specs.\",\n },\n messages: {\n noDataTestIdInSpecs: \"Avoid data-testid in spec files; use a generated POM or fixture accessor instead.\",\n noGetByTestIdInSpecs: \"Avoid getByTestId(...) in spec files; use a generated POM or fixture accessor instead.\",\n },\n schema: [],\n },\n create(context) {\n return {\n Literal(node: Literal) {\n if (includesDataTestId(node.value)) {\n context.report({ node, messageId: \"noDataTestIdInSpecs\" });\n }\n },\n TemplateLiteral(node: TemplateLiteral) {\n const staticText = node.quasis.map(quasi => quasi.value.cooked).join(\"\");\n if (includesDataTestId(staticText)) {\n context.report({ node, messageId: \"noDataTestIdInSpecs\" });\n }\n },\n CallExpression(node: CallExpression) {\n if (node.callee.type !== \"MemberExpression\")\n return;\n\n const callee = node.callee as MemberExpression;\n const isGetByTestId = !callee.computed\n ? callee.property.type === \"Identifier\" && callee.property.name === \"getByTestId\"\n : callee.property.type === \"Literal\" && callee.property.value === \"getByTestId\";\n\n if (isGetByTestId) {\n context.report({ node, messageId: \"noGetByTestIdInSpecs\" });\n }\n },\n };\n },\n};\n","import path from \"node:path\";\nimport type { Rule } from \"eslint\";\nimport type { ArrowFunctionExpression, CallExpression, FunctionExpression } from \"estree\";\n\nconst DIRECT_TEST_CALLS = new Set([\"test\", \"it\"]);\nconst TEST_WRAPPER_CALLS = new Set([\"only\", \"skip\", \"fixme\", \"fail\"]);\nconst TEST_HOOK_CALLS = new Set([\"beforeEach\", \"beforeAll\", \"afterEach\", \"afterAll\"]);\nconst SPEC_FILE_SUFFIXES = new Set([\n\t\".spec.ts\",\n\t\".spec.tsx\",\n\t\".spec.js\",\n\t\".spec.jsx\",\n\t\".spec.cts\",\n\t\".spec.ctsx\",\n\t\".spec.cjs\",\n\t\".spec.cjsx\",\n\t\".spec.mts\",\n\t\".spec.mtsx\",\n\t\".spec.mjs\",\n\t\".spec.mjsx\",\n]);\n\nfunction isSpecFile(filename: string): boolean {\n\tconst basename = path.basename(filename);\n\treturn Array.from(SPEC_FILE_SUFFIXES).some(suffix => basename.endsWith(suffix));\n}\n\nfunction isFunctionExpression(\n\tnode: CallExpression[\"arguments\"][number] | null | undefined,\n): node is ArrowFunctionExpression | FunctionExpression {\n\treturn node != null\n\t\t&& typeof node === \"object\"\n\t\t&& \"type\" in node\n\t\t&& (node.type === \"ArrowFunctionExpression\" || node.type === \"FunctionExpression\");\n}\n\nfunction getCallbackArgIndex(callee: CallExpression[\"callee\"]): number | null {\n\tif (callee.type === \"Identifier\" && DIRECT_TEST_CALLS.has(callee.name))\n\t\treturn 1;\n\n\tif (\n\t\tcallee.type === \"MemberExpression\"\n\t\t&& !callee.computed\n\t\t&& callee.object.type === \"Identifier\"\n\t\t&& DIRECT_TEST_CALLS.has(callee.object.name)\n\t\t&& callee.property.type === \"Identifier\"\n\t) {\n\t\tif (TEST_WRAPPER_CALLS.has(callee.property.name))\n\t\t\treturn 1;\n\n\t\tif (TEST_HOOK_CALLS.has(callee.property.name))\n\t\t\treturn 0;\n\t}\n\n\treturn null;\n}\n\nfunction getPageFixtureProperty(param: ArrowFunctionExpression[\"params\"][0] | FunctionExpression[\"params\"][0]) {\n\tif (!param || param.type !== \"ObjectPattern\")\n\t\treturn null;\n\n\tfor (const property of param.properties) {\n\t\tif (property.type !== \"Property\" || property.computed)\n\t\t\tcontinue;\n\n\t\tif (property.key.type === \"Identifier\" && property.key.name === \"page\")\n\t\t\treturn property;\n\t}\n\n\treturn null;\n}\n\nexport const noPageFixtureInSpecsRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow Playwright's default `page` fixture in spec callbacks. Prefer generated fixtures and POMs instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoPageFixture:\n\t\t\t\t\"Do not destructure the default `page` fixture in spec callbacks. Use generated fixtures and POMs instead.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.getFilename();\n\t\tif (!isSpecFile(filename))\n\t\t\treturn {};\n\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tconst callbackArgIndex = getCallbackArgIndex(node.callee);\n\t\t\t\tif (callbackArgIndex == null)\n\t\t\t\t\treturn;\n\n\t\t\t\tconst callback = node.arguments[callbackArgIndex];\n\t\t\t\tif (!isFunctionExpression(callback))\n\t\t\t\t\treturn;\n\n\t\t\t\tconst pageFixtureProperty = getPageFixtureProperty(callback.params[0]);\n\t\t\t\tif (!pageFixtureProperty)\n\t\t\t\t\treturn;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: pageFixtureProperty,\n\t\t\t\t\tmessageId: \"noPageFixture\",\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { MemberExpression } from \"estree\";\n\n// Locator-filter methods available on Page/Locator/Frame etc. Banned regardless of\n// the receiver object. `getByTestId` is the generator's own test-id contract — specs\n// should reach it through a generated POM accessor, never a raw `*.getByTestId(...)`.\nconst bannedPlaywrightApis = new Set([\"locator\", \"getByRole\", \"getByText\", \"getByLabel\", \"getByTestId\"]);\n\nconst bannedPageApis = new Set([\n\t\"$eval\",\n\t\"$$eval\",\n\t\"click\",\n\t\"evaluate\",\n\t\"isHidden\",\n\t\"isVisible\",\n\t\"waitForSelector\",\n]);\n\nconst SPEC_FILE_SUFFIXES = [\".spec.ts\", \".spec.tsx\", \".spec.js\", \".spec.jsx\"];\n\nfunction isSpecFile(filename: string): boolean {\n\treturn SPEC_FILE_SUFFIXES.some((suffix) => filename.endsWith(suffix));\n}\n\n/**\n * Resolve the accessed property name from a MemberExpression callee, covering both\n * the usual member access (`page.getByTestId(...)`) and the computed equivalent\n * (`page[\"getByTestId\"](...)`). A computed access whose key is a non-Literal\n * (e.g. `obj[dynamicKey]()`) cannot be resolved to a name, so it returns\n * `undefined` and is left alone — it could be anything at runtime.\n */\nfunction resolveMemberPropertyName(callee: MemberExpression): string | undefined {\n\tconst { property, computed } = callee;\n\tif (!computed && property.type === \"Identifier\") {\n\t\treturn property.name;\n\t}\n\tif (computed && property.type === \"Literal\" && typeof property.value === \"string\") {\n\t\treturn property.value;\n\t}\n\treturn undefined;\n}\n\nexport const noRawPlaywrightApisRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Ban raw Playwright APIs in spec files. Use generated fixtures/POMs or a custom POM for unsupported surfaces instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tlegacyCursorHelper:\n\t\t\t\t\"Do not use {{name}} in Playwright spec files. Prefer generated fixtures/POMs or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightApi:\n\t\t\t\t\"Do not call {{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightPageApi:\n\t\t\t\t\"Do not call page.{{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tif (!isSpecFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst sourceCode = context.sourceCode;\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (node.callee.type === \"Identifier\" && node.callee.name.includes(\"animateCursor\")) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee,\n\t\t\t\t\t\tmessageId: \"legacyCursorHelper\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: node.callee.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst apiName = resolveMemberPropertyName(node.callee as MemberExpression);\n\t\t\t\tif (apiName === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst objectText = sourceCode.getText(node.callee.object);\n\n\t\t\t\tif (\n\t\t\t\t\t(objectText === \"page\" || objectText === \"playwrightPage\")\n\t\t\t\t\t&& bannedPageApis.has(apiName)\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\t\tmessageId: \"rawPlaywrightPageApi\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!bannedPlaywrightApis.has(apiName)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\tmessageId: \"rawPlaywrightApi\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { AST as VueAST } from \"vue-eslint-parser\";\n\ntype VAttribute = VueAST.VAttribute;\ntype VDirective = VueAST.VDirective;\ntype VElement = VueAST.VElement;\ntype VueAttribute = VAttribute | VDirective;\ntype VueTemplateVisitor = {\n\tVElement: (node: VElement) => void;\n};\n\nfunction isVueTemplateFile(filename: string): boolean {\n\treturn filename.endsWith(\".vue\");\n}\n\nfunction isWhitespaceCharacter(character: string): boolean {\n\treturn character === \" \"\n\t\t|| character === \"\\t\"\n\t\t|| character === \"\\n\"\n\t\t|| character === \"\\r\"\n\t\t|| character === \"\\f\";\n}\n\nfunction removeAttributeWithWhitespace(\n\tattribute: VueAttribute,\n\tcontext: Rule.RuleContext,\n\tfixer: Rule.RuleFixer,\n): Rule.Fix {\n\tconst sourceText = context.sourceCode.getText();\n\tconst [start, end] = attribute.range;\n\n\tlet adjustedStart = start;\n\twhile (adjustedStart > 0 && isWhitespaceCharacter(sourceText[adjustedStart - 1])) {\n\t\tadjustedStart -= 1;\n\t}\n\n\treturn fixer.removeRange([adjustedStart, end]);\n}\n\nfunction isTargetAttribute(attribute: VueAttribute, attributeName: string): boolean {\n\tif (!attribute.directive) {\n\t\treturn attribute.key.type === \"VIdentifier\" && attribute.key.name === attributeName;\n\t}\n\n\tif (attribute.key.type !== \"VDirectiveKey\") {\n\t\treturn false;\n\t}\n\n\tconst directiveName = attribute.key.name;\n\tconst argument = attribute.key.argument;\n\n\treturn directiveName.type === \"VIdentifier\"\n\t\t&& directiveName.name === \"bind\"\n\t\t&& argument?.type === \"VIdentifier\"\n\t\t&& argument.name === attributeName;\n}\n\nfunction findExistingTestIdAttribute(node: VElement, attributeName: string): VueAttribute | undefined {\n\treturn node.startTag.attributes.find(attribute => isTargetAttribute(attribute, attributeName));\n}\n\nfunction defineVueTemplateVisitor(\n\tcontext: Rule.RuleContext,\n\ttemplateVisitor: VueTemplateVisitor,\n): Rule.RuleListener {\n\tconst parserServices = context.sourceCode.parserServices as {\n\t\tdefineTemplateBodyVisitor?: (\n\t\t\ttemplateBodyVisitor: VueTemplateVisitor,\n\t\t\tscriptVisitor: Rule.RuleListener,\n\t\t\toptions: { templateBodyTriggerSelector: \"Program\" },\n\t\t) => Rule.RuleListener;\n\t};\n\n\tif (!parserServices.defineTemplateBodyVisitor) {\n\t\treturn {};\n\t}\n\n\treturn parserServices.defineTemplateBodyVisitor(\n\t\ttemplateVisitor,\n\t\t{},\n\t\t{ templateBodyTriggerSelector: \"Program\" },\n\t);\n}\n\nexport const removeExistingTestIdAttributesRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Remove existing test-id attributes from Vue templates so vue-pom-generator can generate them consistently.\",\n\t\t},\n\t\tfixable: \"code\",\n\t\tmessages: {\n\t\t\tremoveExistingTestIdAttribute:\n\t\t\t\t\"Remove explicit {{attribute}}. vue-pom-generator can generate it; run this rule with --fix to clean legacy attributes project-wide.\",\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tattribute: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescription: \"Attribute name to remove. Defaults to data-testid.\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tcreate(context): Rule.RuleListener {\n\t\tif (!isVueTemplateFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst options = (context.options[0] ?? {}) as { attribute?: string };\n\t\tconst attributeName = (options.attribute ?? \"data-testid\").trim() || \"data-testid\";\n\n\t\treturn defineVueTemplateVisitor(context, {\n\t\t\tVElement(node: VElement) {\n\t\t\t\tconst existingAttribute = findExistingTestIdAttribute(node, attributeName);\n\t\t\t\tif (!existingAttribute) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: existingAttribute,\n\t\t\t\t\tmessageId: \"removeExistingTestIdAttribute\",\n\t\t\t\t\tdata: { attribute: attributeName },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\treturn removeAttributeWithWhitespace(existingAttribute, context, fixer);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t},\n};","import type { Rule } from \"eslint\";\nimport type { CallExpression, Expression, MemberExpression } from \"estree\";\nimport playwrightEslint from \"eslint-plugin-playwright\";\n\nimport { noDataTestIdInSpecsRule } from \"./no-data-testid-in-specs\";\nimport { noPageFixtureInSpecsRule } from \"./no-page-fixture-in-specs\";\nimport { noRawPlaywrightApisRule } from \"./no-raw-playwright-apis\";\nimport { removeExistingTestIdAttributesRule } from \"./remove-existing-test-id-attributes\";\n\n/**\n * Playwright locator action methods that should be called via generated POM\n * methods rather than directly on element getters.\n */\nconst LOCATOR_ACTIONS = new Set([\n\t\"click\",\n\t\"dblclick\",\n\t\"fill\",\n\t\"check\",\n\t\"uncheck\",\n\t\"type\",\n\t\"clear\",\n\t\"selectOption\",\n\t\"setInputFiles\",\n\t\"tap\",\n\t\"hover\",\n\t\"focus\",\n\t\"dispatchEvent\",\n\t\"press\",\n\t\"selectText\",\n\t\"scrollIntoViewIfNeeded\",\n]);\n\nconst RAW_POM_ACTION_HELPERS = new Set([\"clickByTestId\", \"clickLocator\"]);\n\n/**\n * Locator chain methods that are transparent for the purposes of this rule —\n * `.last().click()` is still a raw action on a POM getter.\n */\nconst CHAIN_METHODS = new Set([\"last\", \"first\", \"nth\", \"filter\"]);\n\nfunction startsWithUppercaseLetter(value: string): boolean {\n\tconst first = value.charCodeAt(0);\n\treturn first >= 65 && first <= 90;\n}\n\n/**\n * Returns the PascalCase getter name if `node` is (or chains from) a direct\n * PascalCase member-expression access. Returns null otherwise.\n *\n * Handles:\n * pom.SubmitButton → \"SubmitButton\"\n * pom.SubmitButton.last() → \"SubmitButton\"\n * pom.SubmitButton.nth(0) → \"SubmitButton\"\n */\nfunction getPomGetterName(node: Expression): string | null {\n\tif (node.type === \"MemberExpression\" && !node.computed && node.property.type === \"Identifier\") {\n\t\tconst name = node.property.name;\n\t\tif (startsWithUppercaseLetter(name)) return name;\n\t}\n\n\tif (\n\t\tnode.type === \"CallExpression\"\n\t\t&& node.callee.type === \"MemberExpression\"\n\t\t&& !node.callee.computed\n\t\t&& node.callee.property.type === \"Identifier\"\n\t\t&& CHAIN_METHODS.has(node.callee.property.name)\n\t) {\n\t\treturn getPomGetterName((node.callee as MemberExpression).object as Expression);\n\t}\n\n\treturn null;\n}\n\nexport const noRawLocatorActionRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow calling raw Playwright action methods directly on POM element getters. Use the generated typed POM methods instead (e.g. `clickSubmitButton()`).\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoRawAction:\n\t\t\t\t\"Use the generated POM method instead of `{{getter}}.{{method}}()`. \"\n\t\t\t\t+ \"Call `click{{getter}}()` / `type{{getter}}(text)` or similar.\",\n\t\t\tnoRawPomActionHelper:\n\t\t\t\t\"Use the generated POM action instead of the low-level `{{method}}()` helper.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") return;\n\t\t\t\tconst callee = node.callee as MemberExpression;\n\t\t\t\tif (callee.computed || callee.property.type !== \"Identifier\") return;\n\n\t\t\t\tconst methodName = callee.property.name;\n\t\t\t\tif (RAW_POM_ACTION_HELPERS.has(methodName)) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: \"noRawPomActionHelper\",\n\t\t\t\t\t\tdata: { method: methodName },\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!LOCATOR_ACTIONS.has(methodName)) return;\n\n\t\t\t\tconst getterName = getPomGetterName(callee.object as Expression);\n\t\t\t\tif (!getterName) return;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: \"noRawAction\",\n\t\t\t\t\tdata: { getter: getterName, method: methodName },\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst rules = {\n\t\"no-data-testid-in-specs\": noDataTestIdInSpecsRule,\n\t\"no-page-fixture-in-specs\": noPageFixtureInSpecsRule,\n\t\"no-raw-locator-action\": noRawLocatorActionRule,\n\t\"no-raw-playwright-apis\": noRawPlaywrightApisRule,\n\t\"remove-existing-test-id-attributes\": removeExistingTestIdAttributesRule,\n};\n\ntype FlatConfig = {\n\tfiles?: string[];\n\tlanguageOptions?: Record<string, unknown>;\n\tplugins?: Record<string, unknown>;\n\trules?: Record<string, unknown>;\n};\n\nexport const plugin: {\n\trules: typeof rules;\n\tconfigs: Record<string, FlatConfig[]>;\n} = {\n\trules,\n\tconfigs: {},\n};\n\nconst playwrightRecommended = playwrightEslint.configs[\"flat/recommended\"] as FlatConfig;\nconst playwrightFiles = [\"**/tests/playwright/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}\"];\n\nplugin.configs[\"flat/recommended\"] = [\n\t{\n\t\t...playwrightRecommended,\n\t\tfiles: playwrightFiles,\n\t\trules: {\n\t\t\t\"playwright/no-force-option\": \"error\",\n\t\t\t\"playwright/no-networkidle\": \"error\",\n\t\t\t\"playwright/no-wait-for-selector\": \"error\",\n\t\t\t\"playwright/no-wait-for-timeout\": \"error\",\n\t\t\t\"playwright/prefer-web-first-assertions\": \"error\",\n\t\t},\n\t},\n\t{\n\t\tfiles: playwrightFiles,\n\t\tplugins: {\n\t\t\t\"@immense/vue-pom-generator\": plugin,\n\t\t},\n\t\trules: {\n\t\t\t\"@immense/vue-pom-generator/no-data-testid-in-specs\": \"error\",\n\t\t\t\"@immense/vue-pom-generator/no-page-fixture-in-specs\": \"error\",\n\t\t\t\"@immense/vue-pom-generator/no-raw-locator-action\": \"error\",\n\t\t\t\"@immense/vue-pom-generator/no-raw-playwright-apis\": \"error\",\n\t\t},\n\t},\n];\n\nexport const recommendedPlaywrightConfig = plugin.configs[\"flat/recommended\"];\n\nexport { noPageFixtureInSpecsRule };\nexport { noDataTestIdInSpecsRule };\nexport { noRawPlaywrightApisRule };\nexport { removeExistingTestIdAttributesRule };\n"],"names":["SPEC_FILE_SUFFIXES","isSpecFile"],"mappings":";;;;AAGA,SAAS,mBAAmB,OAA0C;AACpE,SAAO,OAAO,UAAU,YAAY,MAAM,SAAS,aAAa;AAClE;AAEO,MAAM,0BAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,aAAa;AAAA,IAAA;AAAA,IAEf,UAAU;AAAA,MACR,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,IAAA;AAAA,IAExB,QAAQ,CAAA;AAAA,EAAC;AAAA,EAEX,OAAO,SAAS;AACd,WAAO;AAAA,MACL,QAAQ,MAAe;AACrB,YAAI,mBAAmB,KAAK,KAAK,GAAG;AAClC,kBAAQ,OAAO,EAAE,MAAM,WAAW,uBAAuB;AAAA,QAC3D;AAAA,MACF;AAAA,MACA,gBAAgB,MAAuB;AACrC,cAAM,aAAa,KAAK,OAAO,IAAI,CAAA,UAAS,MAAM,MAAM,MAAM,EAAE,KAAK,EAAE;AACvE,YAAI,mBAAmB,UAAU,GAAG;AAClC,kBAAQ,OAAO,EAAE,MAAM,WAAW,uBAAuB;AAAA,QAC3D;AAAA,MACF;AAAA,MACA,eAAe,MAAsB;AACnC,YAAI,KAAK,OAAO,SAAS;AACvB;AAEF,cAAM,SAAS,KAAK;AACpB,cAA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AACA,YAAI,CAAC,gBAAgB,IAAI,UAAU,EAAG;AAEtC,cAAM,aAAa,iBAAiB,OAAO,MAAoB;AAC/D,YAAI,CAAC,WAAY;AAEjB,gBAAQ,OAAO;AAAA,UACd;AAAA,UACA,WAAW;AAAA,UACX,MAAM,EAAE,QAAQ,YAAY,QAAQ,WAAA;AAAA,QAAW,CAC/C;AAAA,MACF;AAAA,IAAA;AAAA,EAEF;AACD;AAEA,MAAM,QAAQ;AAAA,EACb,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAC5B,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,sCAAsC;AACvC;AASO,MAAM,SAGT;AAAA,EACH;AAAA,EACA,SAAS,CAAA;AACV;AAEA,MAAM,wBAAwB,iBAAiB,QAAQ,kBAAkB;AACzE,MAAM,kBAAkB,CAAC,0DAA0D;AAEnF,OAAO,QAAQ,kBAAkB,IAAI;AAAA,EACpC;AAAA,IACC,GAAG;AAAA,IACH,OAAO;AAAA,IACP,OAAO;AAAA,MACN,8BAA8B;AAAA,MAC9B,6BAA6B;AAAA,MAC7B,mCAAmC;AAAA,MACnC,kCAAkC;AAAA,MAClC,0CAA0C;AAAA,IAAA;AAAA,EAC3C;AAAA,EAED;AAAA,IACC,OAAO;AAAA,IACP,SAAS;AAAA,MACR,8BAA8B;AAAA,IAAA;AAAA,IAE/B,OAAO;AAAA,MACN,sDAAsD;AAAA,MACtD,uDAAuD;AAAA,MACvD,oDAAoD;AAAA,MACpD,qDAAqD;AAAA,IAAA;AAAA,EACtD;AAEF;AAEO,MAAM,8BAA8B,OAAO,QAAQ,kBAAkB;;;;;;;;"}
|
package/dist/eslint/index.d.ts
CHANGED
|
@@ -4,15 +4,24 @@ import { noPageFixtureInSpecsRule } from "./no-page-fixture-in-specs";
|
|
|
4
4
|
import { noRawPlaywrightApisRule } from "./no-raw-playwright-apis";
|
|
5
5
|
import { removeExistingTestIdAttributesRule } from "./remove-existing-test-id-attributes";
|
|
6
6
|
export declare const noRawLocatorActionRule: Rule.RuleModule;
|
|
7
|
+
declare const rules: {
|
|
8
|
+
"no-data-testid-in-specs": Rule.RuleModule;
|
|
9
|
+
"no-page-fixture-in-specs": Rule.RuleModule;
|
|
10
|
+
"no-raw-locator-action": Rule.RuleModule;
|
|
11
|
+
"no-raw-playwright-apis": Rule.RuleModule;
|
|
12
|
+
"remove-existing-test-id-attributes": Rule.RuleModule;
|
|
13
|
+
};
|
|
14
|
+
type FlatConfig = {
|
|
15
|
+
files?: string[];
|
|
16
|
+
languageOptions?: Record<string, unknown>;
|
|
17
|
+
plugins?: Record<string, unknown>;
|
|
18
|
+
rules?: Record<string, unknown>;
|
|
19
|
+
};
|
|
7
20
|
export declare const plugin: {
|
|
8
|
-
rules:
|
|
9
|
-
|
|
10
|
-
"no-page-fixture-in-specs": Rule.RuleModule;
|
|
11
|
-
"no-raw-locator-action": Rule.RuleModule;
|
|
12
|
-
"no-raw-playwright-apis": Rule.RuleModule;
|
|
13
|
-
"remove-existing-test-id-attributes": Rule.RuleModule;
|
|
14
|
-
};
|
|
21
|
+
rules: typeof rules;
|
|
22
|
+
configs: Record<string, FlatConfig[]>;
|
|
15
23
|
};
|
|
24
|
+
export declare const recommendedPlaywrightConfig: FlatConfig[];
|
|
16
25
|
export { noPageFixtureInSpecsRule };
|
|
17
26
|
export { noDataTestIdInSpecsRule };
|
|
18
27
|
export { noRawPlaywrightApisRule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../eslint/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../eslint/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAInC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAkE1F,eAAO,MAAM,sBAAsB,EAAE,IAAI,CAAC,UA6CzC,CAAC;AAEF,QAAA,MAAM,KAAK;;;;;;CAMV,CAAC;AAEF,KAAK,UAAU,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE;IACpB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;CAItC,CAAC;AA+BF,eAAO,MAAM,2BAA2B,cAAqC,CAAC;AAE9E,OAAO,EAAE,wBAAwB,EAAE,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACnC,OAAO,EAAE,kCAAkC,EAAE,CAAC"}
|
package/dist/eslint/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import playwrightEslint from "eslint-plugin-playwright";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
function includesDataTestId(value) {
|
|
3
4
|
return typeof value === "string" && value.includes("data-testid");
|
|
@@ -307,8 +308,10 @@ const LOCATOR_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
307
308
|
"focus",
|
|
308
309
|
"dispatchEvent",
|
|
309
310
|
"press",
|
|
310
|
-
"selectText"
|
|
311
|
+
"selectText",
|
|
312
|
+
"scrollIntoViewIfNeeded"
|
|
311
313
|
]);
|
|
314
|
+
const RAW_POM_ACTION_HELPERS = /* @__PURE__ */ new Set(["clickByTestId", "clickLocator"]);
|
|
312
315
|
const CHAIN_METHODS = /* @__PURE__ */ new Set(["last", "first", "nth", "filter"]);
|
|
313
316
|
function startsWithUppercaseLetter(value) {
|
|
314
317
|
const first = value.charCodeAt(0);
|
|
@@ -331,7 +334,8 @@ const noRawLocatorActionRule = {
|
|
|
331
334
|
description: "Disallow calling raw Playwright action methods directly on POM element getters. Use the generated typed POM methods instead (e.g. `clickSubmitButton()`)."
|
|
332
335
|
},
|
|
333
336
|
messages: {
|
|
334
|
-
noRawAction: "Use the generated POM method instead of `{{getter}}.{{method}}()`. Call `click{{getter}}()` / `type{{getter}}(text)` or similar."
|
|
337
|
+
noRawAction: "Use the generated POM method instead of `{{getter}}.{{method}}()`. Call `click{{getter}}()` / `type{{getter}}(text)` or similar.",
|
|
338
|
+
noRawPomActionHelper: "Use the generated POM action instead of the low-level `{{method}}()` helper."
|
|
335
339
|
},
|
|
336
340
|
schema: []
|
|
337
341
|
},
|
|
@@ -342,6 +346,14 @@ const noRawLocatorActionRule = {
|
|
|
342
346
|
const callee = node.callee;
|
|
343
347
|
if (callee.computed || callee.property.type !== "Identifier") return;
|
|
344
348
|
const methodName = callee.property.name;
|
|
349
|
+
if (RAW_POM_ACTION_HELPERS.has(methodName)) {
|
|
350
|
+
context.report({
|
|
351
|
+
node,
|
|
352
|
+
messageId: "noRawPomActionHelper",
|
|
353
|
+
data: { method: methodName }
|
|
354
|
+
});
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
345
357
|
if (!LOCATOR_ACTIONS.has(methodName)) return;
|
|
346
358
|
const getterName = getPomGetterName(callee.object);
|
|
347
359
|
if (!getterName) return;
|
|
@@ -354,21 +366,52 @@ const noRawLocatorActionRule = {
|
|
|
354
366
|
};
|
|
355
367
|
}
|
|
356
368
|
};
|
|
369
|
+
const rules = {
|
|
370
|
+
"no-data-testid-in-specs": noDataTestIdInSpecsRule,
|
|
371
|
+
"no-page-fixture-in-specs": noPageFixtureInSpecsRule,
|
|
372
|
+
"no-raw-locator-action": noRawLocatorActionRule,
|
|
373
|
+
"no-raw-playwright-apis": noRawPlaywrightApisRule,
|
|
374
|
+
"remove-existing-test-id-attributes": removeExistingTestIdAttributesRule
|
|
375
|
+
};
|
|
357
376
|
const plugin = {
|
|
358
|
-
rules
|
|
359
|
-
|
|
360
|
-
"no-page-fixture-in-specs": noPageFixtureInSpecsRule,
|
|
361
|
-
"no-raw-locator-action": noRawLocatorActionRule,
|
|
362
|
-
"no-raw-playwright-apis": noRawPlaywrightApisRule,
|
|
363
|
-
"remove-existing-test-id-attributes": removeExistingTestIdAttributesRule
|
|
364
|
-
}
|
|
377
|
+
rules,
|
|
378
|
+
configs: {}
|
|
365
379
|
};
|
|
380
|
+
const playwrightRecommended = playwrightEslint.configs["flat/recommended"];
|
|
381
|
+
const playwrightFiles = ["**/tests/playwright/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}"];
|
|
382
|
+
plugin.configs["flat/recommended"] = [
|
|
383
|
+
{
|
|
384
|
+
...playwrightRecommended,
|
|
385
|
+
files: playwrightFiles,
|
|
386
|
+
rules: {
|
|
387
|
+
"playwright/no-force-option": "error",
|
|
388
|
+
"playwright/no-networkidle": "error",
|
|
389
|
+
"playwright/no-wait-for-selector": "error",
|
|
390
|
+
"playwright/no-wait-for-timeout": "error",
|
|
391
|
+
"playwright/prefer-web-first-assertions": "error"
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
files: playwrightFiles,
|
|
396
|
+
plugins: {
|
|
397
|
+
"@immense/vue-pom-generator": plugin
|
|
398
|
+
},
|
|
399
|
+
rules: {
|
|
400
|
+
"@immense/vue-pom-generator/no-data-testid-in-specs": "error",
|
|
401
|
+
"@immense/vue-pom-generator/no-page-fixture-in-specs": "error",
|
|
402
|
+
"@immense/vue-pom-generator/no-raw-locator-action": "error",
|
|
403
|
+
"@immense/vue-pom-generator/no-raw-playwright-apis": "error"
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
];
|
|
407
|
+
const recommendedPlaywrightConfig = plugin.configs["flat/recommended"];
|
|
366
408
|
export {
|
|
367
409
|
noDataTestIdInSpecsRule,
|
|
368
410
|
noPageFixtureInSpecsRule,
|
|
369
411
|
noRawLocatorActionRule,
|
|
370
412
|
noRawPlaywrightApisRule,
|
|
371
413
|
plugin,
|
|
414
|
+
recommendedPlaywrightConfig,
|
|
372
415
|
removeExistingTestIdAttributesRule
|
|
373
416
|
};
|
|
374
417
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../eslint/no-data-testid-in-specs.ts","../../eslint/no-page-fixture-in-specs.ts","../../eslint/no-raw-playwright-apis.ts","../../eslint/remove-existing-test-id-attributes.ts","../../eslint/index.ts"],"sourcesContent":["import type { Rule } from \"eslint\";\nimport type { CallExpression, Literal, MemberExpression, TemplateLiteral } from \"estree\";\n\nfunction includesDataTestId(value: Literal[\"value\"]): value is string {\n return typeof value === \"string\" && value.includes(\"data-testid\");\n}\n\nexport const noDataTestIdInSpecsRule: Rule.RuleModule = {\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow raw data-testid strings and getByTestId calls in Playwright specs.\",\n },\n messages: {\n noDataTestIdInSpecs: \"Avoid data-testid in spec files; use a generated POM or fixture accessor instead.\",\n noGetByTestIdInSpecs: \"Avoid getByTestId(...) in spec files; use a generated POM or fixture accessor instead.\",\n },\n schema: [],\n },\n create(context) {\n return {\n Literal(node: Literal) {\n if (includesDataTestId(node.value)) {\n context.report({ node, messageId: \"noDataTestIdInSpecs\" });\n }\n },\n TemplateLiteral(node: TemplateLiteral) {\n const staticText = node.quasis.map(quasi => quasi.value.cooked).join(\"\");\n if (includesDataTestId(staticText)) {\n context.report({ node, messageId: \"noDataTestIdInSpecs\" });\n }\n },\n CallExpression(node: CallExpression) {\n if (node.callee.type !== \"MemberExpression\")\n return;\n\n const callee = node.callee as MemberExpression;\n const isGetByTestId = !callee.computed\n ? callee.property.type === \"Identifier\" && callee.property.name === \"getByTestId\"\n : callee.property.type === \"Literal\" && callee.property.value === \"getByTestId\";\n\n if (isGetByTestId) {\n context.report({ node, messageId: \"noGetByTestIdInSpecs\" });\n }\n },\n };\n },\n};\n","import path from \"node:path\";\nimport type { Rule } from \"eslint\";\nimport type { ArrowFunctionExpression, CallExpression, FunctionExpression } from \"estree\";\n\nconst DIRECT_TEST_CALLS = new Set([\"test\", \"it\"]);\nconst TEST_WRAPPER_CALLS = new Set([\"only\", \"skip\", \"fixme\", \"fail\"]);\nconst TEST_HOOK_CALLS = new Set([\"beforeEach\", \"beforeAll\", \"afterEach\", \"afterAll\"]);\nconst SPEC_FILE_SUFFIXES = new Set([\n\t\".spec.ts\",\n\t\".spec.tsx\",\n\t\".spec.js\",\n\t\".spec.jsx\",\n\t\".spec.cts\",\n\t\".spec.ctsx\",\n\t\".spec.cjs\",\n\t\".spec.cjsx\",\n\t\".spec.mts\",\n\t\".spec.mtsx\",\n\t\".spec.mjs\",\n\t\".spec.mjsx\",\n]);\n\nfunction isSpecFile(filename: string): boolean {\n\tconst basename = path.basename(filename);\n\treturn Array.from(SPEC_FILE_SUFFIXES).some(suffix => basename.endsWith(suffix));\n}\n\nfunction isFunctionExpression(\n\tnode: CallExpression[\"arguments\"][number] | null | undefined,\n): node is ArrowFunctionExpression | FunctionExpression {\n\treturn node != null\n\t\t&& typeof node === \"object\"\n\t\t&& \"type\" in node\n\t\t&& (node.type === \"ArrowFunctionExpression\" || node.type === \"FunctionExpression\");\n}\n\nfunction getCallbackArgIndex(callee: CallExpression[\"callee\"]): number | null {\n\tif (callee.type === \"Identifier\" && DIRECT_TEST_CALLS.has(callee.name))\n\t\treturn 1;\n\n\tif (\n\t\tcallee.type === \"MemberExpression\"\n\t\t&& !callee.computed\n\t\t&& callee.object.type === \"Identifier\"\n\t\t&& DIRECT_TEST_CALLS.has(callee.object.name)\n\t\t&& callee.property.type === \"Identifier\"\n\t) {\n\t\tif (TEST_WRAPPER_CALLS.has(callee.property.name))\n\t\t\treturn 1;\n\n\t\tif (TEST_HOOK_CALLS.has(callee.property.name))\n\t\t\treturn 0;\n\t}\n\n\treturn null;\n}\n\nfunction getPageFixtureProperty(param: ArrowFunctionExpression[\"params\"][0] | FunctionExpression[\"params\"][0]) {\n\tif (!param || param.type !== \"ObjectPattern\")\n\t\treturn null;\n\n\tfor (const property of param.properties) {\n\t\tif (property.type !== \"Property\" || property.computed)\n\t\t\tcontinue;\n\n\t\tif (property.key.type === \"Identifier\" && property.key.name === \"page\")\n\t\t\treturn property;\n\t}\n\n\treturn null;\n}\n\nexport const noPageFixtureInSpecsRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow Playwright's default `page` fixture in spec callbacks. Prefer generated fixtures and POMs instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoPageFixture:\n\t\t\t\t\"Do not destructure the default `page` fixture in spec callbacks. Use generated fixtures and POMs instead.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.getFilename();\n\t\tif (!isSpecFile(filename))\n\t\t\treturn {};\n\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tconst callbackArgIndex = getCallbackArgIndex(node.callee);\n\t\t\t\tif (callbackArgIndex == null)\n\t\t\t\t\treturn;\n\n\t\t\t\tconst callback = node.arguments[callbackArgIndex];\n\t\t\t\tif (!isFunctionExpression(callback))\n\t\t\t\t\treturn;\n\n\t\t\t\tconst pageFixtureProperty = getPageFixtureProperty(callback.params[0]);\n\t\t\t\tif (!pageFixtureProperty)\n\t\t\t\t\treturn;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: pageFixtureProperty,\n\t\t\t\t\tmessageId: \"noPageFixture\",\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { MemberExpression } from \"estree\";\n\n// Locator-filter methods available on Page/Locator/Frame etc. Banned regardless of\n// the receiver object. `getByTestId` is the generator's own test-id contract — specs\n// should reach it through a generated POM accessor, never a raw `*.getByTestId(...)`.\nconst bannedPlaywrightApis = new Set([\"locator\", \"getByRole\", \"getByText\", \"getByLabel\", \"getByTestId\"]);\n\nconst bannedPageApis = new Set([\n\t\"$eval\",\n\t\"$$eval\",\n\t\"click\",\n\t\"evaluate\",\n\t\"isHidden\",\n\t\"isVisible\",\n\t\"waitForSelector\",\n]);\n\nconst SPEC_FILE_SUFFIXES = [\".spec.ts\", \".spec.tsx\", \".spec.js\", \".spec.jsx\"];\n\nfunction isSpecFile(filename: string): boolean {\n\treturn SPEC_FILE_SUFFIXES.some((suffix) => filename.endsWith(suffix));\n}\n\n/**\n * Resolve the accessed property name from a MemberExpression callee, covering both\n * the usual member access (`page.getByTestId(...)`) and the computed equivalent\n * (`page[\"getByTestId\"](...)`). A computed access whose key is a non-Literal\n * (e.g. `obj[dynamicKey]()`) cannot be resolved to a name, so it returns\n * `undefined` and is left alone — it could be anything at runtime.\n */\nfunction resolveMemberPropertyName(callee: MemberExpression): string | undefined {\n\tconst { property, computed } = callee;\n\tif (!computed && property.type === \"Identifier\") {\n\t\treturn property.name;\n\t}\n\tif (computed && property.type === \"Literal\" && typeof property.value === \"string\") {\n\t\treturn property.value;\n\t}\n\treturn undefined;\n}\n\nexport const noRawPlaywrightApisRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Ban raw Playwright APIs in spec files. Use generated fixtures/POMs or a custom POM for unsupported surfaces instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tlegacyCursorHelper:\n\t\t\t\t\"Do not use {{name}} in Playwright spec files. Prefer generated fixtures/POMs or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightApi:\n\t\t\t\t\"Do not call {{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightPageApi:\n\t\t\t\t\"Do not call page.{{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tif (!isSpecFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst sourceCode = context.sourceCode;\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (node.callee.type === \"Identifier\" && node.callee.name.includes(\"animateCursor\")) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee,\n\t\t\t\t\t\tmessageId: \"legacyCursorHelper\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: node.callee.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst apiName = resolveMemberPropertyName(node.callee as MemberExpression);\n\t\t\t\tif (apiName === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst objectText = sourceCode.getText(node.callee.object);\n\n\t\t\t\tif (\n\t\t\t\t\t(objectText === \"page\" || objectText === \"playwrightPage\")\n\t\t\t\t\t&& bannedPageApis.has(apiName)\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\t\tmessageId: \"rawPlaywrightPageApi\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!bannedPlaywrightApis.has(apiName)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\tmessageId: \"rawPlaywrightApi\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { AST as VueAST } from \"vue-eslint-parser\";\n\ntype VAttribute = VueAST.VAttribute;\ntype VDirective = VueAST.VDirective;\ntype VElement = VueAST.VElement;\ntype VueAttribute = VAttribute | VDirective;\ntype VueTemplateVisitor = {\n\tVElement: (node: VElement) => void;\n};\n\nfunction isVueTemplateFile(filename: string): boolean {\n\treturn filename.endsWith(\".vue\");\n}\n\nfunction isWhitespaceCharacter(character: string): boolean {\n\treturn character === \" \"\n\t\t|| character === \"\\t\"\n\t\t|| character === \"\\n\"\n\t\t|| character === \"\\r\"\n\t\t|| character === \"\\f\";\n}\n\nfunction removeAttributeWithWhitespace(\n\tattribute: VueAttribute,\n\tcontext: Rule.RuleContext,\n\tfixer: Rule.RuleFixer,\n): Rule.Fix {\n\tconst sourceText = context.sourceCode.getText();\n\tconst [start, end] = attribute.range;\n\n\tlet adjustedStart = start;\n\twhile (adjustedStart > 0 && isWhitespaceCharacter(sourceText[adjustedStart - 1])) {\n\t\tadjustedStart -= 1;\n\t}\n\n\treturn fixer.removeRange([adjustedStart, end]);\n}\n\nfunction isTargetAttribute(attribute: VueAttribute, attributeName: string): boolean {\n\tif (!attribute.directive) {\n\t\treturn attribute.key.type === \"VIdentifier\" && attribute.key.name === attributeName;\n\t}\n\n\tif (attribute.key.type !== \"VDirectiveKey\") {\n\t\treturn false;\n\t}\n\n\tconst directiveName = attribute.key.name;\n\tconst argument = attribute.key.argument;\n\n\treturn directiveName.type === \"VIdentifier\"\n\t\t&& directiveName.name === \"bind\"\n\t\t&& argument?.type === \"VIdentifier\"\n\t\t&& argument.name === attributeName;\n}\n\nfunction findExistingTestIdAttribute(node: VElement, attributeName: string): VueAttribute | undefined {\n\treturn node.startTag.attributes.find(attribute => isTargetAttribute(attribute, attributeName));\n}\n\nfunction defineVueTemplateVisitor(\n\tcontext: Rule.RuleContext,\n\ttemplateVisitor: VueTemplateVisitor,\n): Rule.RuleListener {\n\tconst parserServices = context.sourceCode.parserServices as {\n\t\tdefineTemplateBodyVisitor?: (\n\t\t\ttemplateBodyVisitor: VueTemplateVisitor,\n\t\t\tscriptVisitor: Rule.RuleListener,\n\t\t\toptions: { templateBodyTriggerSelector: \"Program\" },\n\t\t) => Rule.RuleListener;\n\t};\n\n\tif (!parserServices.defineTemplateBodyVisitor) {\n\t\treturn {};\n\t}\n\n\treturn parserServices.defineTemplateBodyVisitor(\n\t\ttemplateVisitor,\n\t\t{},\n\t\t{ templateBodyTriggerSelector: \"Program\" },\n\t);\n}\n\nexport const removeExistingTestIdAttributesRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Remove existing test-id attributes from Vue templates so vue-pom-generator can generate them consistently.\",\n\t\t},\n\t\tfixable: \"code\",\n\t\tmessages: {\n\t\t\tremoveExistingTestIdAttribute:\n\t\t\t\t\"Remove explicit {{attribute}}. vue-pom-generator can generate it; run this rule with --fix to clean legacy attributes project-wide.\",\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tattribute: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescription: \"Attribute name to remove. Defaults to data-testid.\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tcreate(context): Rule.RuleListener {\n\t\tif (!isVueTemplateFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst options = (context.options[0] ?? {}) as { attribute?: string };\n\t\tconst attributeName = (options.attribute ?? \"data-testid\").trim() || \"data-testid\";\n\n\t\treturn defineVueTemplateVisitor(context, {\n\t\t\tVElement(node: VElement) {\n\t\t\t\tconst existingAttribute = findExistingTestIdAttribute(node, attributeName);\n\t\t\t\tif (!existingAttribute) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: existingAttribute,\n\t\t\t\t\tmessageId: \"removeExistingTestIdAttribute\",\n\t\t\t\t\tdata: { attribute: attributeName },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\treturn removeAttributeWithWhitespace(existingAttribute, context, fixer);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t},\n};","import type { Rule } from \"eslint\";\nimport type { CallExpression, Expression, MemberExpression } from \"estree\";\n\nimport { noDataTestIdInSpecsRule } from \"./no-data-testid-in-specs\";\nimport { noPageFixtureInSpecsRule } from \"./no-page-fixture-in-specs\";\nimport { noRawPlaywrightApisRule } from \"./no-raw-playwright-apis\";\nimport { removeExistingTestIdAttributesRule } from \"./remove-existing-test-id-attributes\";\n\n/**\n * Playwright locator action methods that should be called via generated POM\n * methods rather than directly on element getters.\n */\nconst LOCATOR_ACTIONS = new Set([\n\t\"click\",\n\t\"dblclick\",\n\t\"fill\",\n\t\"check\",\n\t\"uncheck\",\n\t\"type\",\n\t\"clear\",\n\t\"selectOption\",\n\t\"setInputFiles\",\n\t\"tap\",\n\t\"hover\",\n\t\"focus\",\n\t\"dispatchEvent\",\n\t\"press\",\n\t\"selectText\",\n]);\n\n/**\n * Locator chain methods that are transparent for the purposes of this rule —\n * `.last().click()` is still a raw action on a POM getter.\n */\nconst CHAIN_METHODS = new Set([\"last\", \"first\", \"nth\", \"filter\"]);\n\nfunction startsWithUppercaseLetter(value: string): boolean {\n\tconst first = value.charCodeAt(0);\n\treturn first >= 65 && first <= 90;\n}\n\n/**\n * Returns the PascalCase getter name if `node` is (or chains from) a direct\n * PascalCase member-expression access. Returns null otherwise.\n *\n * Handles:\n * pom.SubmitButton → \"SubmitButton\"\n * pom.SubmitButton.last() → \"SubmitButton\"\n * pom.SubmitButton.nth(0) → \"SubmitButton\"\n */\nfunction getPomGetterName(node: Expression): string | null {\n\tif (node.type === \"MemberExpression\" && !node.computed && node.property.type === \"Identifier\") {\n\t\tconst name = node.property.name;\n\t\tif (startsWithUppercaseLetter(name)) return name;\n\t}\n\n\tif (\n\t\tnode.type === \"CallExpression\"\n\t\t&& node.callee.type === \"MemberExpression\"\n\t\t&& !node.callee.computed\n\t\t&& node.callee.property.type === \"Identifier\"\n\t\t&& CHAIN_METHODS.has(node.callee.property.name)\n\t) {\n\t\treturn getPomGetterName((node.callee as MemberExpression).object as Expression);\n\t}\n\n\treturn null;\n}\n\nexport const noRawLocatorActionRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow calling raw Playwright action methods directly on POM element getters. Use the generated typed POM methods instead (e.g. `clickSubmitButton()`).\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoRawAction:\n\t\t\t\t\"Use the generated POM method instead of `{{getter}}.{{method}}()`. \"\n\t\t\t\t+ \"Call `click{{getter}}()` / `type{{getter}}(text)` or similar.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") return;\n\t\t\t\tconst callee = node.callee as MemberExpression;\n\t\t\t\tif (callee.computed || callee.property.type !== \"Identifier\") return;\n\n\t\t\t\tconst methodName = callee.property.name;\n\t\t\t\tif (!LOCATOR_ACTIONS.has(methodName)) return;\n\n\t\t\t\tconst getterName = getPomGetterName(callee.object as Expression);\n\t\t\t\tif (!getterName) return;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: \"noRawAction\",\n\t\t\t\t\tdata: { getter: getterName, method: methodName },\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport const plugin = {\n\trules: {\n\t\t\"no-data-testid-in-specs\": noDataTestIdInSpecsRule,\n\t\t\"no-page-fixture-in-specs\": noPageFixtureInSpecsRule,\n\t\t\"no-raw-locator-action\": noRawLocatorActionRule,\n\t\t\"no-raw-playwright-apis\": noRawPlaywrightApisRule,\n\t\t\"remove-existing-test-id-attributes\": removeExistingTestIdAttributesRule,\n\t},\n} satisfies { rules: Record<string, Rule.RuleModule> };\n\nexport { noPageFixtureInSpecsRule };\nexport { noDataTestIdInSpecsRule };\nexport { noRawPlaywrightApisRule };\nexport { removeExistingTestIdAttributesRule };\n"],"names":["SPEC_FILE_SUFFIXES","isSpecFile"],"mappings":";AAGA,SAAS,mBAAmB,OAA0C;AACpE,SAAO,OAAO,UAAU,YAAY,MAAM,SAAS,aAAa;AAClE;AAEO,MAAM,0BAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,aAAa;AAAA,IAAA;AAAA,IAEf,UAAU;AAAA,MACR,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,IAAA;AAAA,IAExB,QAAQ,CAAA;AAAA,EAAC;AAAA,EAEX,OAAO,SAAS;AACd,WAAO;AAAA,MACL,QAAQ,MAAe;AACrB,YAAI,mBAAmB,KAAK,KAAK,GAAG;AAClC,kBAAQ,OAAO,EAAE,MAAM,WAAW,uBAAuB;AAAA,QAC3D;AAAA,MACF;AAAA,MACA,gBAAgB,MAAuB;AACrC,cAAM,aAAa,KAAK,OAAO,IAAI,CAAA,UAAS,MAAM,MAAM,MAAM,EAAE,KAAK,EAAE;AACvE,YAAI,mBAAmB,UAAU,GAAG;AAClC,kBAAQ,OAAO,EAAE,MAAM,WAAW,uBAAuB;AAAA,QAC3D;AAAA,MACF;AAAA,MACA,eAAe,MAAsB;AACnC,YAAI,KAAK,OAAO,SAAS;AACvB;AAEF,cAAM,SAAS,KAAK;AACpB,cAAM,gBAAgB,CAAC,OAAO,WAC1B,OAAO,SAAS,SAAS,gBAAgB,OAAO,SAAS,SAAS,gB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AAAA,IAC3B,4BAA4B;AAAA,IAC5B,yBAAyB;AAAA,IACzB,0BAA0B;AAAA,IAC1B,sCAAsC;AAAA,EAAA;AAExC;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../eslint/no-data-testid-in-specs.ts","../../eslint/no-page-fixture-in-specs.ts","../../eslint/no-raw-playwright-apis.ts","../../eslint/remove-existing-test-id-attributes.ts","../../eslint/index.ts"],"sourcesContent":["import type { Rule } from \"eslint\";\nimport type { CallExpression, Literal, MemberExpression, TemplateLiteral } from \"estree\";\n\nfunction includesDataTestId(value: Literal[\"value\"]): value is string {\n return typeof value === \"string\" && value.includes(\"data-testid\");\n}\n\nexport const noDataTestIdInSpecsRule: Rule.RuleModule = {\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow raw data-testid strings and getByTestId calls in Playwright specs.\",\n },\n messages: {\n noDataTestIdInSpecs: \"Avoid data-testid in spec files; use a generated POM or fixture accessor instead.\",\n noGetByTestIdInSpecs: \"Avoid getByTestId(...) in spec files; use a generated POM or fixture accessor instead.\",\n },\n schema: [],\n },\n create(context) {\n return {\n Literal(node: Literal) {\n if (includesDataTestId(node.value)) {\n context.report({ node, messageId: \"noDataTestIdInSpecs\" });\n }\n },\n TemplateLiteral(node: TemplateLiteral) {\n const staticText = node.quasis.map(quasi => quasi.value.cooked).join(\"\");\n if (includesDataTestId(staticText)) {\n context.report({ node, messageId: \"noDataTestIdInSpecs\" });\n }\n },\n CallExpression(node: CallExpression) {\n if (node.callee.type !== \"MemberExpression\")\n return;\n\n const callee = node.callee as MemberExpression;\n const isGetByTestId = !callee.computed\n ? callee.property.type === \"Identifier\" && callee.property.name === \"getByTestId\"\n : callee.property.type === \"Literal\" && callee.property.value === \"getByTestId\";\n\n if (isGetByTestId) {\n context.report({ node, messageId: \"noGetByTestIdInSpecs\" });\n }\n },\n };\n },\n};\n","import path from \"node:path\";\nimport type { Rule } from \"eslint\";\nimport type { ArrowFunctionExpression, CallExpression, FunctionExpression } from \"estree\";\n\nconst DIRECT_TEST_CALLS = new Set([\"test\", \"it\"]);\nconst TEST_WRAPPER_CALLS = new Set([\"only\", \"skip\", \"fixme\", \"fail\"]);\nconst TEST_HOOK_CALLS = new Set([\"beforeEach\", \"beforeAll\", \"afterEach\", \"afterAll\"]);\nconst SPEC_FILE_SUFFIXES = new Set([\n\t\".spec.ts\",\n\t\".spec.tsx\",\n\t\".spec.js\",\n\t\".spec.jsx\",\n\t\".spec.cts\",\n\t\".spec.ctsx\",\n\t\".spec.cjs\",\n\t\".spec.cjsx\",\n\t\".spec.mts\",\n\t\".spec.mtsx\",\n\t\".spec.mjs\",\n\t\".spec.mjsx\",\n]);\n\nfunction isSpecFile(filename: string): boolean {\n\tconst basename = path.basename(filename);\n\treturn Array.from(SPEC_FILE_SUFFIXES).some(suffix => basename.endsWith(suffix));\n}\n\nfunction isFunctionExpression(\n\tnode: CallExpression[\"arguments\"][number] | null | undefined,\n): node is ArrowFunctionExpression | FunctionExpression {\n\treturn node != null\n\t\t&& typeof node === \"object\"\n\t\t&& \"type\" in node\n\t\t&& (node.type === \"ArrowFunctionExpression\" || node.type === \"FunctionExpression\");\n}\n\nfunction getCallbackArgIndex(callee: CallExpression[\"callee\"]): number | null {\n\tif (callee.type === \"Identifier\" && DIRECT_TEST_CALLS.has(callee.name))\n\t\treturn 1;\n\n\tif (\n\t\tcallee.type === \"MemberExpression\"\n\t\t&& !callee.computed\n\t\t&& callee.object.type === \"Identifier\"\n\t\t&& DIRECT_TEST_CALLS.has(callee.object.name)\n\t\t&& callee.property.type === \"Identifier\"\n\t) {\n\t\tif (TEST_WRAPPER_CALLS.has(callee.property.name))\n\t\t\treturn 1;\n\n\t\tif (TEST_HOOK_CALLS.has(callee.property.name))\n\t\t\treturn 0;\n\t}\n\n\treturn null;\n}\n\nfunction getPageFixtureProperty(param: ArrowFunctionExpression[\"params\"][0] | FunctionExpression[\"params\"][0]) {\n\tif (!param || param.type !== \"ObjectPattern\")\n\t\treturn null;\n\n\tfor (const property of param.properties) {\n\t\tif (property.type !== \"Property\" || property.computed)\n\t\t\tcontinue;\n\n\t\tif (property.key.type === \"Identifier\" && property.key.name === \"page\")\n\t\t\treturn property;\n\t}\n\n\treturn null;\n}\n\nexport const noPageFixtureInSpecsRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow Playwright's default `page` fixture in spec callbacks. Prefer generated fixtures and POMs instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoPageFixture:\n\t\t\t\t\"Do not destructure the default `page` fixture in spec callbacks. Use generated fixtures and POMs instead.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst filename = context.getFilename();\n\t\tif (!isSpecFile(filename))\n\t\t\treturn {};\n\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tconst callbackArgIndex = getCallbackArgIndex(node.callee);\n\t\t\t\tif (callbackArgIndex == null)\n\t\t\t\t\treturn;\n\n\t\t\t\tconst callback = node.arguments[callbackArgIndex];\n\t\t\t\tif (!isFunctionExpression(callback))\n\t\t\t\t\treturn;\n\n\t\t\t\tconst pageFixtureProperty = getPageFixtureProperty(callback.params[0]);\n\t\t\t\tif (!pageFixtureProperty)\n\t\t\t\t\treturn;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: pageFixtureProperty,\n\t\t\t\t\tmessageId: \"noPageFixture\",\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { MemberExpression } from \"estree\";\n\n// Locator-filter methods available on Page/Locator/Frame etc. Banned regardless of\n// the receiver object. `getByTestId` is the generator's own test-id contract — specs\n// should reach it through a generated POM accessor, never a raw `*.getByTestId(...)`.\nconst bannedPlaywrightApis = new Set([\"locator\", \"getByRole\", \"getByText\", \"getByLabel\", \"getByTestId\"]);\n\nconst bannedPageApis = new Set([\n\t\"$eval\",\n\t\"$$eval\",\n\t\"click\",\n\t\"evaluate\",\n\t\"isHidden\",\n\t\"isVisible\",\n\t\"waitForSelector\",\n]);\n\nconst SPEC_FILE_SUFFIXES = [\".spec.ts\", \".spec.tsx\", \".spec.js\", \".spec.jsx\"];\n\nfunction isSpecFile(filename: string): boolean {\n\treturn SPEC_FILE_SUFFIXES.some((suffix) => filename.endsWith(suffix));\n}\n\n/**\n * Resolve the accessed property name from a MemberExpression callee, covering both\n * the usual member access (`page.getByTestId(...)`) and the computed equivalent\n * (`page[\"getByTestId\"](...)`). A computed access whose key is a non-Literal\n * (e.g. `obj[dynamicKey]()`) cannot be resolved to a name, so it returns\n * `undefined` and is left alone — it could be anything at runtime.\n */\nfunction resolveMemberPropertyName(callee: MemberExpression): string | undefined {\n\tconst { property, computed } = callee;\n\tif (!computed && property.type === \"Identifier\") {\n\t\treturn property.name;\n\t}\n\tif (computed && property.type === \"Literal\" && typeof property.value === \"string\") {\n\t\treturn property.value;\n\t}\n\treturn undefined;\n}\n\nexport const noRawPlaywrightApisRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Ban raw Playwright APIs in spec files. Use generated fixtures/POMs or a custom POM for unsupported surfaces instead.\",\n\t\t},\n\t\tmessages: {\n\t\t\tlegacyCursorHelper:\n\t\t\t\t\"Do not use {{name}} in Playwright spec files. Prefer generated fixtures/POMs or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightApi:\n\t\t\t\t\"Do not call {{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t\trawPlaywrightPageApi:\n\t\t\t\t\"Do not call page.{{name}} directly in Playwright spec files. Prefer generated fixtures/POM methods or a custom POM for unsupported surfaces.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tif (!isSpecFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst sourceCode = context.sourceCode;\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tif (node.callee.type === \"Identifier\" && node.callee.name.includes(\"animateCursor\")) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee,\n\t\t\t\t\t\tmessageId: \"legacyCursorHelper\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: node.callee.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst apiName = resolveMemberPropertyName(node.callee as MemberExpression);\n\t\t\t\tif (apiName === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst objectText = sourceCode.getText(node.callee.object);\n\n\t\t\t\tif (\n\t\t\t\t\t(objectText === \"page\" || objectText === \"playwrightPage\")\n\t\t\t\t\t&& bannedPageApis.has(apiName)\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\t\tmessageId: \"rawPlaywrightPageApi\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!bannedPlaywrightApis.has(apiName)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: node.callee.property,\n\t\t\t\t\tmessageId: \"rawPlaywrightApi\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tname: apiName,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n","import type { Rule } from \"eslint\";\nimport type { AST as VueAST } from \"vue-eslint-parser\";\n\ntype VAttribute = VueAST.VAttribute;\ntype VDirective = VueAST.VDirective;\ntype VElement = VueAST.VElement;\ntype VueAttribute = VAttribute | VDirective;\ntype VueTemplateVisitor = {\n\tVElement: (node: VElement) => void;\n};\n\nfunction isVueTemplateFile(filename: string): boolean {\n\treturn filename.endsWith(\".vue\");\n}\n\nfunction isWhitespaceCharacter(character: string): boolean {\n\treturn character === \" \"\n\t\t|| character === \"\\t\"\n\t\t|| character === \"\\n\"\n\t\t|| character === \"\\r\"\n\t\t|| character === \"\\f\";\n}\n\nfunction removeAttributeWithWhitespace(\n\tattribute: VueAttribute,\n\tcontext: Rule.RuleContext,\n\tfixer: Rule.RuleFixer,\n): Rule.Fix {\n\tconst sourceText = context.sourceCode.getText();\n\tconst [start, end] = attribute.range;\n\n\tlet adjustedStart = start;\n\twhile (adjustedStart > 0 && isWhitespaceCharacter(sourceText[adjustedStart - 1])) {\n\t\tadjustedStart -= 1;\n\t}\n\n\treturn fixer.removeRange([adjustedStart, end]);\n}\n\nfunction isTargetAttribute(attribute: VueAttribute, attributeName: string): boolean {\n\tif (!attribute.directive) {\n\t\treturn attribute.key.type === \"VIdentifier\" && attribute.key.name === attributeName;\n\t}\n\n\tif (attribute.key.type !== \"VDirectiveKey\") {\n\t\treturn false;\n\t}\n\n\tconst directiveName = attribute.key.name;\n\tconst argument = attribute.key.argument;\n\n\treturn directiveName.type === \"VIdentifier\"\n\t\t&& directiveName.name === \"bind\"\n\t\t&& argument?.type === \"VIdentifier\"\n\t\t&& argument.name === attributeName;\n}\n\nfunction findExistingTestIdAttribute(node: VElement, attributeName: string): VueAttribute | undefined {\n\treturn node.startTag.attributes.find(attribute => isTargetAttribute(attribute, attributeName));\n}\n\nfunction defineVueTemplateVisitor(\n\tcontext: Rule.RuleContext,\n\ttemplateVisitor: VueTemplateVisitor,\n): Rule.RuleListener {\n\tconst parserServices = context.sourceCode.parserServices as {\n\t\tdefineTemplateBodyVisitor?: (\n\t\t\ttemplateBodyVisitor: VueTemplateVisitor,\n\t\t\tscriptVisitor: Rule.RuleListener,\n\t\t\toptions: { templateBodyTriggerSelector: \"Program\" },\n\t\t) => Rule.RuleListener;\n\t};\n\n\tif (!parserServices.defineTemplateBodyVisitor) {\n\t\treturn {};\n\t}\n\n\treturn parserServices.defineTemplateBodyVisitor(\n\t\ttemplateVisitor,\n\t\t{},\n\t\t{ templateBodyTriggerSelector: \"Program\" },\n\t);\n}\n\nexport const removeExistingTestIdAttributesRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Remove existing test-id attributes from Vue templates so vue-pom-generator can generate them consistently.\",\n\t\t},\n\t\tfixable: \"code\",\n\t\tmessages: {\n\t\t\tremoveExistingTestIdAttribute:\n\t\t\t\t\"Remove explicit {{attribute}}. vue-pom-generator can generate it; run this rule with --fix to clean legacy attributes project-wide.\",\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tattribute: {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdescription: \"Attribute name to remove. Defaults to data-testid.\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tcreate(context): Rule.RuleListener {\n\t\tif (!isVueTemplateFile(context.filename)) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst options = (context.options[0] ?? {}) as { attribute?: string };\n\t\tconst attributeName = (options.attribute ?? \"data-testid\").trim() || \"data-testid\";\n\n\t\treturn defineVueTemplateVisitor(context, {\n\t\t\tVElement(node: VElement) {\n\t\t\t\tconst existingAttribute = findExistingTestIdAttribute(node, attributeName);\n\t\t\t\tif (!existingAttribute) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: existingAttribute,\n\t\t\t\t\tmessageId: \"removeExistingTestIdAttribute\",\n\t\t\t\t\tdata: { attribute: attributeName },\n\t\t\t\t\tfix(fixer) {\n\t\t\t\t\t\treturn removeAttributeWithWhitespace(existingAttribute, context, fixer);\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t});\n\t},\n};","import type { Rule } from \"eslint\";\nimport type { CallExpression, Expression, MemberExpression } from \"estree\";\nimport playwrightEslint from \"eslint-plugin-playwright\";\n\nimport { noDataTestIdInSpecsRule } from \"./no-data-testid-in-specs\";\nimport { noPageFixtureInSpecsRule } from \"./no-page-fixture-in-specs\";\nimport { noRawPlaywrightApisRule } from \"./no-raw-playwright-apis\";\nimport { removeExistingTestIdAttributesRule } from \"./remove-existing-test-id-attributes\";\n\n/**\n * Playwright locator action methods that should be called via generated POM\n * methods rather than directly on element getters.\n */\nconst LOCATOR_ACTIONS = new Set([\n\t\"click\",\n\t\"dblclick\",\n\t\"fill\",\n\t\"check\",\n\t\"uncheck\",\n\t\"type\",\n\t\"clear\",\n\t\"selectOption\",\n\t\"setInputFiles\",\n\t\"tap\",\n\t\"hover\",\n\t\"focus\",\n\t\"dispatchEvent\",\n\t\"press\",\n\t\"selectText\",\n\t\"scrollIntoViewIfNeeded\",\n]);\n\nconst RAW_POM_ACTION_HELPERS = new Set([\"clickByTestId\", \"clickLocator\"]);\n\n/**\n * Locator chain methods that are transparent for the purposes of this rule —\n * `.last().click()` is still a raw action on a POM getter.\n */\nconst CHAIN_METHODS = new Set([\"last\", \"first\", \"nth\", \"filter\"]);\n\nfunction startsWithUppercaseLetter(value: string): boolean {\n\tconst first = value.charCodeAt(0);\n\treturn first >= 65 && first <= 90;\n}\n\n/**\n * Returns the PascalCase getter name if `node` is (or chains from) a direct\n * PascalCase member-expression access. Returns null otherwise.\n *\n * Handles:\n * pom.SubmitButton → \"SubmitButton\"\n * pom.SubmitButton.last() → \"SubmitButton\"\n * pom.SubmitButton.nth(0) → \"SubmitButton\"\n */\nfunction getPomGetterName(node: Expression): string | null {\n\tif (node.type === \"MemberExpression\" && !node.computed && node.property.type === \"Identifier\") {\n\t\tconst name = node.property.name;\n\t\tif (startsWithUppercaseLetter(name)) return name;\n\t}\n\n\tif (\n\t\tnode.type === \"CallExpression\"\n\t\t&& node.callee.type === \"MemberExpression\"\n\t\t&& !node.callee.computed\n\t\t&& node.callee.property.type === \"Identifier\"\n\t\t&& CHAIN_METHODS.has(node.callee.property.name)\n\t) {\n\t\treturn getPomGetterName((node.callee as MemberExpression).object as Expression);\n\t}\n\n\treturn null;\n}\n\nexport const noRawLocatorActionRule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow calling raw Playwright action methods directly on POM element getters. Use the generated typed POM methods instead (e.g. `clickSubmitButton()`).\",\n\t\t},\n\t\tmessages: {\n\t\t\tnoRawAction:\n\t\t\t\t\"Use the generated POM method instead of `{{getter}}.{{method}}()`. \"\n\t\t\t\t+ \"Call `click{{getter}}()` / `type{{getter}}(text)` or similar.\",\n\t\t\tnoRawPomActionHelper:\n\t\t\t\t\"Use the generated POM action instead of the low-level `{{method}}()` helper.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node: CallExpression) {\n\t\t\t\tif (node.callee.type !== \"MemberExpression\") return;\n\t\t\t\tconst callee = node.callee as MemberExpression;\n\t\t\t\tif (callee.computed || callee.property.type !== \"Identifier\") return;\n\n\t\t\t\tconst methodName = callee.property.name;\n\t\t\t\tif (RAW_POM_ACTION_HELPERS.has(methodName)) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: \"noRawPomActionHelper\",\n\t\t\t\t\t\tdata: { method: methodName },\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!LOCATOR_ACTIONS.has(methodName)) return;\n\n\t\t\t\tconst getterName = getPomGetterName(callee.object as Expression);\n\t\t\t\tif (!getterName) return;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: \"noRawAction\",\n\t\t\t\t\tdata: { getter: getterName, method: methodName },\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nconst rules = {\n\t\"no-data-testid-in-specs\": noDataTestIdInSpecsRule,\n\t\"no-page-fixture-in-specs\": noPageFixtureInSpecsRule,\n\t\"no-raw-locator-action\": noRawLocatorActionRule,\n\t\"no-raw-playwright-apis\": noRawPlaywrightApisRule,\n\t\"remove-existing-test-id-attributes\": removeExistingTestIdAttributesRule,\n};\n\ntype FlatConfig = {\n\tfiles?: string[];\n\tlanguageOptions?: Record<string, unknown>;\n\tplugins?: Record<string, unknown>;\n\trules?: Record<string, unknown>;\n};\n\nexport const plugin: {\n\trules: typeof rules;\n\tconfigs: Record<string, FlatConfig[]>;\n} = {\n\trules,\n\tconfigs: {},\n};\n\nconst playwrightRecommended = playwrightEslint.configs[\"flat/recommended\"] as FlatConfig;\nconst playwrightFiles = [\"**/tests/playwright/**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}\"];\n\nplugin.configs[\"flat/recommended\"] = [\n\t{\n\t\t...playwrightRecommended,\n\t\tfiles: playwrightFiles,\n\t\trules: {\n\t\t\t\"playwright/no-force-option\": \"error\",\n\t\t\t\"playwright/no-networkidle\": \"error\",\n\t\t\t\"playwright/no-wait-for-selector\": \"error\",\n\t\t\t\"playwright/no-wait-for-timeout\": \"error\",\n\t\t\t\"playwright/prefer-web-first-assertions\": \"error\",\n\t\t},\n\t},\n\t{\n\t\tfiles: playwrightFiles,\n\t\tplugins: {\n\t\t\t\"@immense/vue-pom-generator\": plugin,\n\t\t},\n\t\trules: {\n\t\t\t\"@immense/vue-pom-generator/no-data-testid-in-specs\": \"error\",\n\t\t\t\"@immense/vue-pom-generator/no-page-fixture-in-specs\": \"error\",\n\t\t\t\"@immense/vue-pom-generator/no-raw-locator-action\": \"error\",\n\t\t\t\"@immense/vue-pom-generator/no-raw-playwright-apis\": \"error\",\n\t\t},\n\t},\n];\n\nexport const recommendedPlaywrightConfig = plugin.configs[\"flat/recommended\"];\n\nexport { noPageFixtureInSpecsRule };\nexport { noDataTestIdInSpecsRule };\nexport { noRawPlaywrightApisRule };\nexport { removeExistingTestIdAttributesRule };\n"],"names":["SPEC_FILE_SUFFIXES","isSpecFile"],"mappings":";;AAGA,SAAS,mBAAmB,OAA0C;AACpE,SAAO,OAAO,UAAU,YAAY,MAAM,SAAS,aAAa;AAClE;AAEO,MAAM,0BAA2C;AAAA,EACtD,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,MACJ,aAAa;AAAA,IAAA;AAAA,IAEf,UAAU;AAAA,MACR,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,IAAA;AAAA,IAExB,QAAQ,CAAA;AAAA,EAAC;AAAA,EAEX,OAAO,SAAS;AACd,WAAO;AAAA,MACL,QAAQ,MAAe;AACrB,YAAI,mBAAmB,KAAK,KAAK,GAAG;AAClC,kBAAQ,OAAO,EAAE,MAAM,WAAW,uBAAuB;AAAA,QAC3D;AAAA,MACF;AAAA,MACA,gBAAgB,MAAuB;AACrC,cAAM,aAAa,KAAK,OAAO,IAAI,CAAA,UAAS,MAAM,MAAM,MAAM,EAAE,KAAK,EAAE;AACvE,YAAI,mBAAmB,UAAU,GAAG;AAClC,kBAAQ,OAAO,EAAE,MAAM,WAAW,uBAAuB;AAAA,QAC3D;AAAA,MACF;AAAA,MACA,eAAe,MAAsB;AACnC,YAAI,KAAK,OAAO,SAAS;AACvB;AAEF,cAAM,SAAS,KAAK;AACpB,cAAM,gBAAgB,CAAC,OAAO,WAC1B,OAAO,SAAS,SAAS,gBAAgB,OAAO,SAAS,SAAS,gBAClE,OAAO,SAAS,SAAS,aAAa,OAAO,SAAS,UAAU;AAEpE,YAAI,eAAe;AACjB,kBAAQ,OAAO,EAAE,MAAM,WAAW,wBAAwB;AAAA,QAC5D;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AACF;AC3CA,MAAM,oBAAoB,oBAAI,IAAI,CAAC,QAAQ,IAAI,CAAC;AAChD,MAAM,yCAAyB,IAAI,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