From 40f6f596fad56549ee98d6253654cb98432df0a9 Mon Sep 17 00:00:00 2001 From: Marcus Quinn <6428977+marcusquinn@users.noreply.github.com> Date: Mon, 16 Mar 2026 23:40:05 +0000 Subject: [PATCH] fix: resolve ESLint sourceType mismatch for cypress.config.js (issue #31) (#64) Add overrides block in .eslintrc.js to parse cypress.config.js as CommonJS (sourceType: 'script') rather than ESM. The global sourceType: 'module' caused ESLint to flag require() as undefined, since require is not available in ESM scope. The project has no 'type: module' in package.json, so CommonJS is correct. Closes #31 --- .eslintrc.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index d4393da..a20b89b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,6 +19,19 @@ module.exports = { 'no-console': 'warn', 'no-unused-vars': 'warn' }, + overrides: [ + { + // cypress.config.js uses CommonJS (require/module.exports). + // Override sourceType to 'script' so ESLint does not flag require as undefined. + files: ['cypress.config.js', 'cypress.config.cjs'], + parserOptions: { + sourceType: 'script' + }, + env: { + node: true + } + } + ], globals: { cy: 'readonly', Cypress: 'readonly',