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
This commit is contained in:
13
.eslintrc.js
13
.eslintrc.js
@@ -19,6 +19,19 @@ module.exports = {
|
|||||||
'no-console': 'warn',
|
'no-console': 'warn',
|
||||||
'no-unused-vars': '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: {
|
globals: {
|
||||||
cy: 'readonly',
|
cy: 'readonly',
|
||||||
Cypress: 'readonly',
|
Cypress: 'readonly',
|
||||||
|
|||||||
Reference in New Issue
Block a user