Skip to content

Commit

Permalink
chore: extend linting to cypress examples (#1373)
Browse files Browse the repository at this point in the history
* chore: add examples linting

* remove unused setupnodeevents or parameters

* selective disable cypress/no-unnecessary-waiting
  • Loading branch information
MikeMcC399 authored Feb 26, 2025
1 parent d9accb7 commit 013dd06
Show file tree
Hide file tree
Showing 29 changed files with 42 additions and 24 deletions.
9 changes: 7 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import globals from 'globals'
import pluginJs from '@eslint/js'
import pluginCypress from 'eslint-plugin-cypress/flat'

export default [
pluginJs.configs.recommended,
{ name: 'global-ignores', ignores: ['dist/', 'examples/'] },
pluginCypress.configs.recommended,
{
name: `all-js`,
name: 'global-ignores',
ignores: ['dist/', 'examples/nextjs/src/app/']
},
{
name: 'all-js',
languageOptions: {
globals: {
...globals.browser,
Expand Down
1 change: 0 additions & 1 deletion examples/basic-pnpm/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
},
})
1 change: 0 additions & 1 deletion examples/basic/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
},
})
2 changes: 1 addition & 1 deletion examples/browser/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const os = require('os')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {
setupNodeEvents(on) {
on('before:browser:launch', (browser, launchOptions) => {
console.log('before launching browser')
console.log(browser)
Expand Down
2 changes: 1 addition & 1 deletion examples/config/cypress.config-alternate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = defineConfig({
fixturesFolder: false,
e2e: {
baseUrl: 'http://localhost:3333',
setupNodeEvents(on, config) {
setupNodeEvents() {
console.log('\nUsing cypress.config-alternate.js config-file')
},
supportFile: false
Expand Down
1 change: 0 additions & 1 deletion examples/config/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
},
})
1 change: 0 additions & 1 deletion examples/custom-command/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
},
})
1 change: 0 additions & 1 deletion examples/install-command/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'https://example.cypress.io/',
},
Expand Down
1 change: 0 additions & 1 deletion examples/install-only/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'https://example.cypress.io/',
},
Expand Down
1 change: 0 additions & 1 deletion examples/node-versions/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
},
})
2 changes: 1 addition & 1 deletion examples/quiet/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {
setupNodeEvents(on) {
on('task', {
log(message) {
console.log(message)
Expand Down
1 change: 0 additions & 1 deletion examples/recording/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module.exports = defineConfig({
fixturesFolder: false,
projectId: '3tb7jn',
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
},
})
1 change: 1 addition & 0 deletions examples/recording/cypress/e2e/spec-a.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
it('spec-A works', () => {
expect(42).to.equal(21 + 21)
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.visit('https://example.cypress.io').wait(2000)
})
1 change: 1 addition & 0 deletions examples/recording/cypress/e2e/spec-b.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
it('spec-B works', () => {
expect(42).to.equal(21 + 21)
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.visit('https://example.cypress.io').wait(5000)
})
1 change: 1 addition & 0 deletions examples/recording/cypress/e2e/spec-c.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
it('spec-C works', () => {
expect(42).to.equal(21 + 21)
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.visit('https://example.cypress.io').wait(4000)
})
1 change: 1 addition & 0 deletions examples/recording/cypress/e2e/spec-d.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
it('spec-D works', () => {
expect(42).to.equal(21 + 21)
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.visit('https://example.cypress.io').wait(3600)
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'http://localhost:5000',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'http://localhost:5000',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'http://localhost:5000',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'http://localhost:5000',
},
Expand Down
1 change: 0 additions & 1 deletion examples/start/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'http://localhost:3000',
},
Expand Down
1 change: 0 additions & 1 deletion examples/wait-on-vite/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'http://localhost:5173',
},
Expand Down
1 change: 0 additions & 1 deletion examples/wait-on/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'http://localhost:3050',
},
Expand Down
1 change: 0 additions & 1 deletion examples/webpack/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'http://localhost:8080',
},
Expand Down
1 change: 0 additions & 1 deletion examples/yarn-classic/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'https://example.cypress.io/',
},
Expand Down
1 change: 0 additions & 1 deletion examples/yarn-modern-pnp/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'https://example.cypress.io/',
},
Expand Down
1 change: 0 additions & 1 deletion examples/yarn-modern/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
fixturesFolder: false,
e2e: {
setupNodeEvents(on, config) {},
supportFile: false,
baseUrl: 'https://example.cypress.io/',
},
Expand Down
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@types/node": "22.13.5",
"@vercel/ncc": "0.38.1",
"eslint": "9.21.0",
"eslint-plugin-cypress": "4.1.0",
"globals": "16.0.0",
"husky": "9.1.7",
"markdown-link-check": "3.13.6",
Expand Down

0 comments on commit 013dd06

Please sign in to comment.