Skip to content

Commit 013dd06

Browse files
authored
chore: extend linting to cypress examples (#1373)
* chore: add examples linting * remove unused setupnodeevents or parameters * selective disable cypress/no-unnecessary-waiting
1 parent d9accb7 commit 013dd06

File tree

29 files changed

+42
-24
lines changed

29 files changed

+42
-24
lines changed

eslint.config.mjs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import globals from 'globals'
22
import pluginJs from '@eslint/js'
3+
import pluginCypress from 'eslint-plugin-cypress/flat'
34

45
export default [
56
pluginJs.configs.recommended,
6-
{ name: 'global-ignores', ignores: ['dist/', 'examples/'] },
7+
pluginCypress.configs.recommended,
78
{
8-
name: `all-js`,
9+
name: 'global-ignores',
10+
ignores: ['dist/', 'examples/nextjs/src/app/']
11+
},
12+
{
13+
name: 'all-js',
914
languageOptions: {
1015
globals: {
1116
...globals.browser,

examples/basic-pnpm/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
},
98
})

examples/basic/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
},
98
})

examples/browser/cypress.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const os = require('os')
44
module.exports = defineConfig({
55
fixturesFolder: false,
66
e2e: {
7-
setupNodeEvents(on, config) {
7+
setupNodeEvents(on) {
88
on('before:browser:launch', (browser, launchOptions) => {
99
console.log('before launching browser')
1010
console.log(browser)

examples/config/cypress.config-alternate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
66
baseUrl: 'http://localhost:3333',
7-
setupNodeEvents(on, config) {
7+
setupNodeEvents() {
88
console.log('\nUsing cypress.config-alternate.js config-file')
99
},
1010
supportFile: false

examples/config/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
},
98
})

examples/custom-command/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
},
98
})

examples/install-command/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'https://example.cypress.io/',
98
},

examples/install-only/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'https://example.cypress.io/',
98
},

examples/node-versions/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
},
98
})

examples/quiet/cypress.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {
6+
setupNodeEvents(on) {
77
on('task', {
88
log(message) {
99
console.log(message)

examples/recording/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = defineConfig({
44
fixturesFolder: false,
55
projectId: '3tb7jn',
66
e2e: {
7-
setupNodeEvents(on, config) {},
87
supportFile: false,
98
},
109
})
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
it('spec-A works', () => {
22
expect(42).to.equal(21 + 21)
3+
// eslint-disable-next-line cypress/no-unnecessary-waiting
34
cy.visit('https://example.cypress.io').wait(2000)
45
})
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
it('spec-B works', () => {
22
expect(42).to.equal(21 + 21)
3+
// eslint-disable-next-line cypress/no-unnecessary-waiting
34
cy.visit('https://example.cypress.io').wait(5000)
45
})
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
it('spec-C works', () => {
22
expect(42).to.equal(21 + 21)
3+
// eslint-disable-next-line cypress/no-unnecessary-waiting
34
cy.visit('https://example.cypress.io').wait(4000)
45
})
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
it('spec-D works', () => {
22
expect(42).to.equal(21 + 21)
3+
// eslint-disable-next-line cypress/no-unnecessary-waiting
34
cy.visit('https://example.cypress.io').wait(3600)
45
})

examples/start-and-pnpm-workspaces/packages/workspace-1/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'http://localhost:5000',
98
},

examples/start-and-pnpm-workspaces/packages/workspace-2/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'http://localhost:5000',
98
},

examples/start-and-yarn-workspaces/workspace-1/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'http://localhost:5000',
98
},

examples/start-and-yarn-workspaces/workspace-2/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'http://localhost:5000',
98
},

examples/start/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'http://localhost:3000',
98
},

examples/wait-on-vite/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'http://localhost:5173',
98
},

examples/wait-on/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'http://localhost:3050',
98
},

examples/webpack/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'http://localhost:8080',
98
},

examples/yarn-classic/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'https://example.cypress.io/',
98
},

examples/yarn-modern-pnp/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'https://example.cypress.io/',
98
},

examples/yarn-modern/cypress.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on, config) {},
76
supportFile: false,
87
baseUrl: 'https://example.cypress.io/',
98
},

package-lock.json

+27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"@types/node": "22.13.5",
5252
"@vercel/ncc": "0.38.1",
5353
"eslint": "9.21.0",
54+
"eslint-plugin-cypress": "4.1.0",
5455
"globals": "16.0.0",
5556
"husky": "9.1.7",
5657
"markdown-link-check": "3.13.6",

0 commit comments

Comments
 (0)