|
1 | 1 | /** |
2 | 2 | * Shareable ESLint config for Playwright TypeScript projects. |
3 | | - * Single source of truth: used by this repo (via eslint.config.js) and by consumers (vasu-playwright-utils/eslint). |
| 3 | + * Single source of truth: used by this repo (via eslint.config.mjs) and by consumers (vasu-playwright-utils/eslint). |
4 | 4 | * |
5 | 5 | * @example |
6 | | - * // eslint.config.js (in your project) |
7 | | - * const playwrightLibConfig = require('vasu-playwright-utils/eslint'); |
8 | | - * module.exports = [ |
| 6 | + * // eslint.config.mjs (in your project) |
| 7 | + * import playwrightLibConfig from 'vasu-playwright-utils/eslint'; |
| 8 | + * export default [ |
9 | 9 | * ...playwrightLibConfig, |
10 | 10 | * { rules: { 'playwright/no-focused-test': 'warn' } }, |
11 | 11 | * ]; |
12 | 12 | */ |
13 | 13 |
|
14 | | -const typescript = require('@typescript-eslint/eslint-plugin'); |
15 | | -const typescriptParser = require('@typescript-eslint/parser'); |
16 | | -const prettier = require('eslint-plugin-prettier'); |
17 | | -const importPlugin = require('eslint-plugin-import'); |
18 | | -const jsdoc = require('eslint-plugin-jsdoc'); |
19 | | -const playwright = require('eslint-plugin-playwright'); |
20 | | -const js = require('@eslint/js'); |
| 14 | +import typescript from '@typescript-eslint/eslint-plugin'; |
| 15 | +import typescriptParser from '@typescript-eslint/parser'; |
| 16 | +import prettier from 'eslint-plugin-prettier'; |
| 17 | +import importPlugin from 'eslint-plugin-import'; |
| 18 | +import jsdoc from 'eslint-plugin-jsdoc'; |
| 19 | +import playwright from 'eslint-plugin-playwright'; |
| 20 | +import js from '@eslint/js'; |
| 21 | +import process from 'node:process'; |
21 | 22 |
|
22 | | -// Works in this repo and when required from other projects (consumer's cwd) |
23 | | -const projectRoot = require('process').cwd(); |
| 23 | +// Works in this repo and when imported from other projects (consumer's cwd) |
| 24 | +const projectRoot = process.cwd(); |
24 | 25 |
|
25 | | -module.exports = [ |
| 26 | +export default [ |
26 | 27 | { |
27 | 28 | ignores: [ |
28 | 29 | 'node_modules/**', |
|
0 commit comments