Socket
Socket
Sign inDemoInstall

@meowsos/playwright-eslint-prettier-setup

Package Overview
Dependencies
0
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @meowsos/playwright-eslint-prettier-setup

Developer setup for Playwright Typescript projects with ESLint Prettier Unicorn SonarJS


Version published
Weekly downloads
6
decreased by-33.33%
Maintainers
2
Install size
128 kB
Created
Weekly downloads
 

Readme

Source

@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.

Keywords

FAQs

Last updated on 26 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc