@boehringer-ingelheim/eslint-config 7.1.0 → 7.2.0
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 +14 -0
- package/configs/playwright.js +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -156,6 +156,20 @@ export default boehringer.config(
|
|
|
156
156
|
);
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
+
or for specific files only:
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
import boehringer from '@boehringer-ingelheim/eslint-config';
|
|
163
|
+
|
|
164
|
+
export default boehringer.config(
|
|
165
|
+
boehringer.configs.strict,
|
|
166
|
+
{
|
|
167
|
+
files: ['src/**/*.test.{ts,tsx}'],
|
|
168
|
+
...(await boehringer.configs.playwright)[0],
|
|
169
|
+
},
|
|
170
|
+
);
|
|
171
|
+
```
|
|
172
|
+
|
|
159
173
|
This shared ESLint configuration is designed to enforce best practices and recommendations when writing tests with Playwright. It extends the [`eslint-plugin-playwright`](https://github.com/playwright-community/eslint-plugin-playwright) configuration and adds the following rules:
|
|
160
174
|
|
|
161
175
|
- [`playwright/prefer-to-be`](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-to-be.md): enforces the use of `.toBe()` instead of `.toEqual()` when testing for equality.
|
package/configs/playwright.js
CHANGED
|
@@ -4,8 +4,21 @@ const tseslint = require('typescript-eslint');
|
|
|
4
4
|
module.exports = tseslint.config({
|
|
5
5
|
...playwright.configs['flat/recommended'],
|
|
6
6
|
rules: {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* At the moment, `eslint-plugin-playwright` does not fully support component testing with type information.
|
|
9
|
+
* https://github.com/playwright-community/eslint-plugin-playwright/issues/298
|
|
10
|
+
*
|
|
11
|
+
* The `mount` function is flagged as an error by the `@typescript-eslint/unbound-method` rule.
|
|
12
|
+
* But it is okay to use `mount` in this context for test files.
|
|
13
|
+
* https://typescript-eslint.io/rules/unbound-method/#when-not-to-use-it
|
|
14
|
+
*
|
|
15
|
+
* Hint: `eslint-plugin-jest` has already a customized version of this rule.
|
|
16
|
+
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md
|
|
17
|
+
*/
|
|
18
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
19
|
+
|
|
8
20
|
// eslint-plugin-playwright: https://github.com/playwright-community/eslint-plugin-playwright
|
|
21
|
+
...playwright.configs['flat/recommended'].rules,
|
|
9
22
|
'playwright/prefer-to-be': 'error',
|
|
10
23
|
'playwright/prefer-to-have-length': 'error',
|
|
11
24
|
'playwright/require-top-level-describe': 'error',
|