@tshifhiwa/ohrm-ui-automation-framework
Version:
Playwright and TypeScript–based test automation framework for validating core UI features and workflows of the OrangeHRM demo application.
122 lines (107 loc) • 3.45 kB
JavaScript
import tseslint from "typescript-eslint";
import prettierConfig from "eslint-config-prettier";
import playwright from "eslint-plugin-playwright";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const config = tseslint.config(
// Base recommended configs
...tseslint.configs.recommended.map((config) => ({
...config,
files: ["**/*.ts"],
})),
// Main TypeScript ruleset
{
files: ["**/*.ts"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: ["./tsconfig.json"],
tsconfigRootDir: __dirname,
},
},
rules: {
// Variable handling
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
// Console and pattern rules
"no-console": ["error", { allow: ["error"] }],
"no-empty-pattern": "off",
// Type safety
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-argument": "error",
// Promise / async safety
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: { arguments: false },
checksConditionals: true,
checksSpreads: true,
},
],
// Flexibility rules
"@typescript-eslint/prefer-nullish-coalescing": "off",
"no-duplicate-imports": "off",
"@typescript-eslint/no-non-null-assertion": "off",
},
},
// Playwright test ruleset
{
files: ["**/*.spec.ts", "**/tests/**/*.ts"],
plugins: {
playwright,
},
rules: {
// Playwright-specific recommendations
...playwright.configs["flat/recommended"].rules,
// Disable only this specific rule
"playwright/expect-expect": "off",
// Relaxed rules for test files
"no-console": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "error",
// Promise safety still enforced in tests
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: { arguments: false },
checksConditionals: true,
checksSpreads: true,
},
],
},
},
// Ignored paths
{
ignores: [
"src/testData/**",
"node_modules/**",
"logs/**",
"playwright-report/**",
"ortoni-report/**",
"test-results/**",
"dist/**",
],
},
// Integrate Prettier formatting
prettierConfig,
);
export default config;