Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@meowsos/playwright-eslint-prettier-setup

meowso15ISC1.0.5

Developer setup for Playwright Typescript projects with ESLint Prettier Unicorn SonarJS

typescript, playwright, eslint, eslint-config, prettier, eslint-config-prettier, eslint-plugin-prettier, eslint-plugin-unicorn, eslint-plugin-sonarjs, eslint-plugin-playwright, code quality, vscode, javascript, front-end, automation, api testing, web development, typescript framework, web testing, playwright javascript testing, playwright code quality, typescript linting, prettier config, sonarqube integration, unicorn linter, visual studio code extensions, recommendations

readme

@meowsos/playwright-eslint-prettier-setup

npm (scoped) License GitHub issues GitHub stars GitHub pull requests GitHub last commit

Meow

Description

Modern ESLint + Prettier setup for Playwright Typescript projects, with SonarJS and ESLint Unicorn plugins.

It tries to be very agnostic while at the same time use all available, very opinionated tools from the community, to enforce and automate code quality standards and conventions.

This mono-repo was inspire in this wonderful article here and aims to be a plug-and-play solution for Playwright only code repositories.


Requirements

Before using this package, you need to have a playwright project in your repository; if you haven't, thy this code:

npm init playwright@latest new-project

And it needs to have a tsconfig.json file in the root folder; if you haven't got one, try:

npx tsc --init

Usage

  1. Install the package as a dev dependency:

    npm i -D @meowsos/eslint-config @meowsos/prettier-config
  2. Add the following to your package.json: (The rules here are just an example on how to override them if you wish, don't add them.)

    {
      "scripts": {
        "lint": "eslint . --ext .ts",
        "lint:fix": "eslint . --ext .ts --fix",
        "format": "prettier --write .",
        "format:check": "prettier --check ."
      },
      "prettier": "@meowsos/prettier-config",
      "eslintConfig": {
        "extends": "@meowsos/eslint-config",
        "rules": {
          "playwright/expect-expect": 0,
          "playwright/no-networkidle": 0,
          "playwright/no-skipped-test": 0,
          "playwright/valid-title": 0,
          "unicorn/no-nested-ternary": "off"
        }
      }
    }
  3. Create a .eslintignore file in the root of your project with the following:

    .vscode/
    node_modules/
    test-results/
    reports/
  4. Create a .prettierignore file in the root of your project with the following:

    node_modules/
    reports/
    test-results/
    .bash_history
    *.lock
  5. Create a .vscode/settings.json file in the root of your project with the following:

    {
      "editor.defaultFormatter": "esbenp.prettier-vscode",
      "editor.formatOnSave": true,
      "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
      }
    }

We recommend the following extensions for VSCode, which will be automatically suggested to be installed if you add the following setup.

Create a .vscode/extensions.json file in the root of your project with the following:

{
  "recommendations": [
    "dbaeumer.vscode-eslint",
    "esbenp.prettier-vscode",
    "ms-playwright.playwright",
    "ryanrosello-og.playwright-vscode-trace-viewer",
    "yoavbls.pretty-ts-errors"
  ]
}

Contributing

See CONTRIBUTING.md for contribution guidelines.

changelog

@meowsos/eslint-config

1.1.8

Patch Changes

  • update api keyword eslint

1.1.7

Patch Changes

  • update api keyword

1.1.6

Patch Changes

  • Updating keywords on package.json

1.1.5

Patch Changes

  • Updating documentation

1.1.4

Patch Changes

  • Updating documentation, and ever

1.1.3

Patch Changes

  • Update documentation, yet again s2

1.1.2

Patch Changes

  • Updaing documentation

1.1.1

Patch Changes

  • Updating documentation and peerDependencies

1.1.0

Minor Changes

  • Updating README.md files

1.0.0

Major Changes

  • a0ba4a1: First release version