Skip to content

Commit 09c13f3

Browse files
committed
chore(deps): update version of vasu-playwright-utils to 1.23.0; refactor ESLint configuration to extend shared config and add sample config file
1 parent 4bcb5db commit 09c13f3

4 files changed

Lines changed: 425 additions & 390 deletions

File tree

eslint.config.js

Lines changed: 17 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,170 +1,36 @@
1-
const typescript = require('@typescript-eslint/eslint-plugin');
2-
const typescriptParser = require('@typescript-eslint/parser');
3-
const prettier = require('eslint-plugin-prettier');
4-
const importPlugin = require('eslint-plugin-import');
5-
const jsdoc = require('eslint-plugin-jsdoc');
6-
const playwright = require('eslint-plugin-playwright');
7-
const js = require('@eslint/js');
1+
/**
2+
* ESLint config that extends vasu-playwright-utils shared config.
3+
* @see https://www.npmjs.com/package/vasu-playwright-utils
4+
*
5+
* @example
6+
* // eslint.config.js (in your project)
7+
* const playwrightLibConfig = require('vasu-playwright-utils/eslint');
8+
* module.exports = [
9+
* ...playwrightLibConfig,
10+
* { rules: { 'playwright/no-focused-test': 'warn' } },
11+
* ];
12+
*/
13+
const playwrightLibConfig = require('vasu-playwright-utils/eslint');
814

915
module.exports = [
16+
// Project-specific ignores (in addition to lib defaults)
1017
{
1118
ignores: [
12-
'node_modules/**',
1319
'test-results/**',
1420
'playwright-report/**',
1521
'playwright/.cache/**',
1622
'playwright/.auth/**',
17-
'.husky/**',
1823
'.env',
1924
'.vscode/**',
2025
'.idea/**',
2126
'.DS_Store',
2227
'allure*/**',
23-
'dist/**',
24-
'package-lock.json',
2528
'**/*.sh',
2629
'**/*.png',
2730
'*.md',
28-
'**/*.js',
2931
],
3032
},
31-
// Base ESLint recommended rules
32-
js.configs.recommended,
33-
34-
// TypeScript configuration
35-
{
36-
files: ['**/*.ts'],
37-
languageOptions: {
38-
parser: typescriptParser,
39-
parserOptions: { project: './tsconfig.json', tsconfigRootDir: __dirname },
40-
globals: {
41-
// Node.js globals
42-
console: 'readonly',
43-
process: 'readonly',
44-
Buffer: 'readonly',
45-
__dirname: 'readonly',
46-
__filename: 'readonly',
47-
global: 'readonly',
48-
module: 'readonly',
49-
require: 'readonly',
50-
exports: 'readonly',
51-
// Browser globals
52-
window: 'readonly',
53-
document: 'readonly',
54-
navigator: 'readonly',
55-
location: 'readonly',
56-
history: 'readonly',
57-
localStorage: 'readonly',
58-
sessionStorage: 'readonly',
59-
fetch: 'readonly',
60-
XMLHttpRequest: 'readonly',
61-
FormData: 'readonly',
62-
URLSearchParams: 'readonly',
63-
URL: 'readonly',
64-
Event: 'readonly',
65-
EventTarget: 'readonly',
66-
CustomEvent: 'readonly',
67-
setTimeout: 'readonly',
68-
setInterval: 'readonly',
69-
clearTimeout: 'readonly',
70-
clearInterval: 'readonly',
71-
},
72-
},
73-
plugins: {
74-
'@typescript-eslint': typescript,
75-
prettier: prettier,
76-
import: importPlugin,
77-
jsdoc: jsdoc,
78-
playwright: playwright,
79-
},
80-
settings: { 'import/resolver': { typescript: { alwaysTryTypes: true } } },
81-
rules: {
82-
// Prettier Rules
83-
'prettier/prettier': 'error',
84-
'no-trailing-spaces': 'error',
85-
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
86-
'eol-last': ['error', 'always'],
87-
88-
// TypeScript Rules - Base
89-
...typescript.configs.recommended.rules,
90-
...typescript.configs['eslint-recommended'].overrides[0].rules,
91-
// TypeScript recommended-requiring-type-checking rules (type-aware rules)
92-
...typescript.configs['recommended-requiring-type-checking'].rules,
93-
'@typescript-eslint/no-unsafe-assignment': 'warn',
94-
'@typescript-eslint/no-unsafe-member-access': 'warn',
95-
'@typescript-eslint/no-unsafe-return': 'warn',
96-
'@typescript-eslint/no-unsafe-call': 'warn',
97-
'@typescript-eslint/no-floating-promises': 'error',
98-
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
99-
'@typescript-eslint/no-explicit-any': 'warn',
100-
'@typescript-eslint/explicit-module-boundary-types': 'off',
101-
102-
// TypeScript Rules - Additional Strict Rules
103-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
104-
'@typescript-eslint/no-unused-expressions': 'error',
105-
'@typescript-eslint/no-empty-function': 'warn',
106-
'@typescript-eslint/prefer-nullish-coalescing': 'error',
107-
'@typescript-eslint/prefer-optional-chain': 'error',
108-
'@typescript-eslint/prefer-as-const': 'error',
109-
'@typescript-eslint/no-non-null-assertion': 'warn',
110-
'@typescript-eslint/no-duplicate-enum-values': 'error',
111-
'@typescript-eslint/no-inferrable-types': ['error', { ignoreParameters: false, ignoreProperties: false }],
112-
113-
// Import Rules
114-
'import/no-unresolved': 'error',
115-
'import/named': 'error',
116-
'import/default': 'error',
117-
'import/no-absolute-path': 'error',
118-
'import/no-self-import': 'error',
119-
// 'import/no-duplicates': 'error',
120-
'import/first': 'error',
121-
'import/no-mutable-exports': 'error',
122-
'sort-imports': ['error', { ignoreDeclarationSort: true }],
123-
124-
// General Rules
125-
'require-await': 'off',
126-
'@typescript-eslint/require-await': 'error',
127-
'@typescript-eslint/await-thenable': 'error',
128-
'@typescript-eslint/no-misused-promises': 'error',
129-
complexity: ['warn', { max: 11 }],
130-
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
131-
'no-debugger': 'error',
132-
'no-var': 'error',
133-
'prefer-const': 'error',
134-
'prefer-template': 'error',
135-
'object-shorthand': 'error',
136-
// 'no-else-return': ['error', { allowElseIf: false }],
137-
'no-lonely-if': 'error',
138-
'no-useless-return': 'error',
139-
'no-nested-ternary': 'warn',
140-
eqeqeq: ['error', 'always', { null: 'ignore' }],
141-
'no-throw-literal': 'error',
142-
143-
// JSDoc Rules
144-
// 'jsdoc/check-alignment': 'warn',
145-
// 'jsdoc/check-indentation': 'warn',
146-
147-
// Playwright recommended rules (from plugin:playwright/playwright-test)
148-
...playwright.configs['playwright-test'].rules,
149-
150-
'playwright/missing-playwright-await': ['error'],
151-
'playwright/no-focused-test': 'error',
152-
'playwright/valid-expect': 'error',
153-
'playwright/prefer-web-first-assertions': 'error',
154-
'playwright/no-useless-await': 'error',
155-
'playwright/no-page-pause': 'error',
156-
'playwright/no-element-handle': 'error',
157-
'playwright/no-eval': 'error',
158-
'playwright/prefer-to-be': 'error',
159-
'playwright/prefer-to-contain': 'error',
160-
'playwright/prefer-to-have-length': 'error',
161-
'playwright/no-wait-for-timeout': 'warn',
162-
'playwright/no-useless-not': 'warn',
163-
'playwright/require-top-level-describe': 'off',
164-
'playwright/expect-expect': 'off',
165-
'playwright/no-conditional-in-test': 'off',
166-
'playwright/no-skipped-test': 'off',
167-
'playwright/consistent-spacing-between-blocks': 'off',
168-
},
169-
},
33+
...playwrightLibConfig,
34+
// Project-specific rule overrides
35+
{ rules: { 'playwright/no-focused-test': 'warn' } },
17036
];

eslint.config.sample.js

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/**
2+
* Reference only – not used by ESLint. The project uses eslint.config.js (extends vasu-playwright-utils/eslint).
3+
* Copy or adapt this file if you need a standalone config without the library.
4+
*/
5+
const typescript = require('@typescript-eslint/eslint-plugin');
6+
const typescriptParser = require('@typescript-eslint/parser');
7+
const prettier = require('eslint-plugin-prettier');
8+
const importPlugin = require('eslint-plugin-import');
9+
const jsdoc = require('eslint-plugin-jsdoc');
10+
const playwright = require('eslint-plugin-playwright');
11+
const js = require('@eslint/js');
12+
13+
module.exports = [
14+
{
15+
ignores: [
16+
'node_modules/**',
17+
'test-results/**',
18+
'playwright-report/**',
19+
'playwright/.cache/**',
20+
'playwright/.auth/**',
21+
'.husky/**',
22+
'.env',
23+
'.vscode/**',
24+
'.idea/**',
25+
'.DS_Store',
26+
'allure*/**',
27+
'dist/**',
28+
'package-lock.json',
29+
'**/*.sh',
30+
'**/*.png',
31+
'*.md',
32+
'**/*.js',
33+
],
34+
},
35+
// Base ESLint recommended rules
36+
js.configs.recommended,
37+
38+
// TypeScript configuration
39+
{
40+
files: ['**/*.ts'],
41+
languageOptions: {
42+
parser: typescriptParser,
43+
parserOptions: { project: './tsconfig.json', tsconfigRootDir: __dirname },
44+
globals: {
45+
// Node.js globals
46+
console: 'readonly',
47+
process: 'readonly',
48+
Buffer: 'readonly',
49+
__dirname: 'readonly',
50+
__filename: 'readonly',
51+
global: 'readonly',
52+
module: 'readonly',
53+
require: 'readonly',
54+
exports: 'readonly',
55+
// Browser globals
56+
window: 'readonly',
57+
document: 'readonly',
58+
navigator: 'readonly',
59+
location: 'readonly',
60+
history: 'readonly',
61+
localStorage: 'readonly',
62+
sessionStorage: 'readonly',
63+
fetch: 'readonly',
64+
XMLHttpRequest: 'readonly',
65+
FormData: 'readonly',
66+
URLSearchParams: 'readonly',
67+
URL: 'readonly',
68+
Event: 'readonly',
69+
EventTarget: 'readonly',
70+
CustomEvent: 'readonly',
71+
setTimeout: 'readonly',
72+
setInterval: 'readonly',
73+
clearTimeout: 'readonly',
74+
clearInterval: 'readonly',
75+
},
76+
},
77+
plugins: {
78+
'@typescript-eslint': typescript,
79+
prettier: prettier,
80+
import: importPlugin,
81+
jsdoc: jsdoc,
82+
playwright: playwright,
83+
},
84+
settings: { 'import/resolver': { typescript: { alwaysTryTypes: true } } },
85+
rules: {
86+
// Prettier Rules
87+
'prettier/prettier': 'error',
88+
'no-trailing-spaces': 'error',
89+
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
90+
'eol-last': ['error', 'always'],
91+
92+
// TypeScript Rules - Base
93+
...typescript.configs.recommended.rules,
94+
...typescript.configs['eslint-recommended'].overrides[0].rules,
95+
// TypeScript recommended-requiring-type-checking rules (type-aware rules)
96+
...typescript.configs['recommended-requiring-type-checking'].rules,
97+
'@typescript-eslint/no-unsafe-assignment': 'warn',
98+
'@typescript-eslint/no-unsafe-member-access': 'warn',
99+
'@typescript-eslint/no-unsafe-return': 'warn',
100+
'@typescript-eslint/no-unsafe-call': 'warn',
101+
'@typescript-eslint/no-floating-promises': 'error',
102+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
103+
'@typescript-eslint/no-explicit-any': 'warn',
104+
'@typescript-eslint/explicit-module-boundary-types': 'off',
105+
106+
// TypeScript Rules - Additional Strict Rules
107+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
108+
'@typescript-eslint/no-unused-expressions': 'error',
109+
'@typescript-eslint/no-empty-function': 'warn',
110+
'@typescript-eslint/prefer-nullish-coalescing': 'error',
111+
'@typescript-eslint/prefer-optional-chain': 'error',
112+
'@typescript-eslint/prefer-as-const': 'error',
113+
'@typescript-eslint/no-non-null-assertion': 'warn',
114+
'@typescript-eslint/no-duplicate-enum-values': 'error',
115+
'@typescript-eslint/no-inferrable-types': ['error', { ignoreParameters: false, ignoreProperties: false }],
116+
117+
// Import Rules
118+
'import/no-unresolved': 'error',
119+
'import/named': 'error',
120+
'import/default': 'error',
121+
'import/no-absolute-path': 'error',
122+
'import/no-self-import': 'error',
123+
// 'import/no-duplicates': 'error',
124+
'import/first': 'error',
125+
'import/no-mutable-exports': 'error',
126+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
127+
128+
// General Rules
129+
'require-await': 'off',
130+
'@typescript-eslint/require-await': 'error',
131+
'@typescript-eslint/await-thenable': 'error',
132+
'@typescript-eslint/no-misused-promises': 'error',
133+
complexity: ['warn', { max: 11 }],
134+
'no-console': ['warn', { allow: ['warn', 'error', 'info'] }],
135+
'no-debugger': 'error',
136+
'no-var': 'error',
137+
'prefer-const': 'error',
138+
'prefer-template': 'error',
139+
'object-shorthand': 'error',
140+
// 'no-else-return': ['error', { allowElseIf: false }],
141+
'no-lonely-if': 'error',
142+
'no-useless-return': 'error',
143+
'no-nested-ternary': 'warn',
144+
eqeqeq: ['error', 'always', { null: 'ignore' }],
145+
'no-throw-literal': 'error',
146+
147+
// JSDoc Rules
148+
// 'jsdoc/check-alignment': 'warn',
149+
// 'jsdoc/check-indentation': 'warn',
150+
151+
// Playwright recommended rules (from plugin:playwright/playwright-test)
152+
...playwright.configs['playwright-test'].rules,
153+
154+
'playwright/missing-playwright-await': ['error'],
155+
'playwright/no-focused-test': 'error',
156+
'playwright/valid-expect': 'error',
157+
'playwright/prefer-web-first-assertions': 'error',
158+
'playwright/no-useless-await': 'error',
159+
'playwright/no-page-pause': 'error',
160+
'playwright/no-element-handle': 'error',
161+
'playwright/no-eval': 'error',
162+
'playwright/prefer-to-be': 'error',
163+
'playwright/prefer-to-contain': 'error',
164+
'playwright/prefer-to-have-length': 'error',
165+
'playwright/no-wait-for-timeout': 'warn',
166+
'playwright/no-useless-not': 'warn',
167+
'playwright/require-top-level-describe': 'off',
168+
'playwright/expect-expect': 'off',
169+
'playwright/no-conditional-in-test': 'off',
170+
'playwright/no-skipped-test': 'off',
171+
'playwright/consistent-spacing-between-blocks': 'off',
172+
},
173+
},
174+
];

0 commit comments

Comments
 (0)