Skip to content

Commit

Permalink
185 eslint plugin playwright (#201)
Browse files Browse the repository at this point in the history
* fix: plugin applies to specific files

---------

Co-authored-by: Yordan Ramchev <[email protected]>
  • Loading branch information
georgi-mateev and Yordan-Ramchev authored Feb 5, 2024
1 parent 24169d2 commit 81c6af3
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions utils/renderEslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,22 @@ export default function renderEslint(
}

if (needsPlaywright) {
// if the extends key already exists make sure to not override it, but add to it
if (additionalConfig.extends) {
additionalConfig.extends = [...additionalConfig.extends, 'plugin:playwright/recommended']
// if the key already exists make sure to not override it, but add to it
if (additionalConfig.overrides) {
additionalConfig.overrides = [
...additionalConfig.overrides,
{
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
extends: ['plugin:playwright/recommended']
}
]
} else {
additionalConfig.extends = ['plugin:playwright/recommended']
additionalConfig.overrides = [
{
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
extends: ['plugin:playwright/recommended']
}
]
}

additionalDependencies['eslint-plugin-playwright'] = eslintDeps['eslint-plugin-playwright']
Expand Down

0 comments on commit 81c6af3

Please sign in to comment.