Skip to content

Commit aa00c21

Browse files
authored
chore: migrate to ESLint extends config structure (#1545)
* chore: migrate to ESLint extends config structure * bump eslint-related deps
1 parent eb6ecdb commit aa00c21

File tree

12 files changed

+95
-97
lines changed

12 files changed

+95
-97
lines changed

eslint.config.mjs

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config'
12
import globals from 'globals'
2-
import pluginJs from '@eslint/js'
3+
import js from '@eslint/js'
34
import pluginCypress from 'eslint-plugin-cypress'
45
import stylistic from '@stylistic/eslint-plugin'
56

6-
export default [
7-
pluginJs.configs.recommended,
8-
pluginCypress.configs.recommended,
7+
export default defineConfig([
8+
globalIgnores([
9+
'dist/',
10+
'examples/component-tests/dist/',
11+
'examples/nextjs/.next/',
12+
'examples/nextjs/build/',
13+
'examples/nextjs/src/app/',
14+
'examples/wait-on-vite/dist/',
15+
'examples/**/.pnp.*',
16+
]),
917
{
10-
name: 'global-ignores',
11-
ignores: [
12-
'dist/',
13-
'examples/component-tests/dist/',
14-
'examples/nextjs/.next/',
15-
'examples/nextjs/build/',
16-
'examples/nextjs/src/app/',
17-
'examples/wait-on-vite/dist/',
18-
'examples/**/.pnp.*',
19-
],
20-
},
21-
{
22-
name: 'all-js',
23-
languageOptions: {
24-
globals: {
25-
...globals.browser,
26-
...globals.node,
27-
},
28-
},
29-
},
30-
{
31-
name: 'style',
3218
files: ['eslint.config.mjs', 'examples/**/*.js'],
33-
...stylistic.configs.recommended,
19+
extends:
20+
[
21+
js.configs.recommended,
22+
pluginCypress.configs.recommended,
23+
stylistic.configs.recommended,
24+
],
3425
rules: {
35-
'@stylistic/indent': ['error', 2],
26+
'@stylistic/arrow-parens': ['error', 'always'],
3627
'@stylistic/comma-dangle': ['error', 'always-multiline'],
28+
'@stylistic/indent': ['error', 2],
3729
'@stylistic/quotes': ['error', 'single'],
3830
'@stylistic/semi': ['error', 'never'],
31+
'@stylistic/space-before-function-paren': ['error', 'always'],
32+
},
33+
languageOptions: {
34+
globals: globals.node,
3935
},
4036
},
41-
]
37+
])

examples/browser/cypress.config.js

Lines changed: 2 additions & 2 deletions
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) {
7+
setupNodeEvents (on) {
88
on('before:browser:launch', (browser, launchOptions) => {
99
console.log('before launching browser')
1010
console.log(browser)
@@ -20,7 +20,7 @@ module.exports = defineConfig({
2020
})
2121

2222
on('task', {
23-
log(message) {
23+
log (message) {
2424
console.log(message)
2525
return null
2626
},

examples/component-tests/cypress/support/commands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
//
2323
//
2424
// -- This will overwrite an existing command --
25-
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

examples/config/cypress.config-alternate.js

Lines changed: 1 addition & 1 deletion
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() {
7+
setupNodeEvents () {
88
console.log('\nUsing cypress.config-alternate.js config-file')
99
},
1010
supportFile: false,

examples/custom-command/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const cypress = require('cypress')
44
const _ = require('lodash')
55
const fs = require('fs')
66

7-
cypress.run().then(results => {
7+
cypress.run().then((results) => {
88
const summary = _.pickBy(results, (value, key) =>
99
key.startsWith('total'),
1010
)

examples/env/cypress.config.js

Lines changed: 1 addition & 1 deletion
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, config) {
77
console.log('logging from cypress.config.js')
88
console.log(
99
'process.env.CYPRESS_environmentName',

examples/quiet/cypress.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
fixturesFolder: false,
55
e2e: {
6-
setupNodeEvents(on) {
6+
setupNodeEvents (on) {
77
on('task', {
8-
log(message) {
8+
log (message) {
99
console.log(message)
1010
return null
1111
},

examples/wait-on-vite/counter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function setupCounter(element) {
1+
export function setupCounter (element) {
22
let counter = 0
33
const setCounter = (count) => {
44
counter = count

examples/wait-on/index4.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ log('creating the server on port %d', port)
1717
const server = http.createServer((req, res) => {
1818
const reqTimestamp = +new Date()
1919
log('request at %d: %s %s', reqTimestamp, req.method, req.url)
20-
setTimeout(function() {
20+
setTimeout(function () {
2121
log('responding to request from %d', reqTimestamp)
2222
res.writeHead(200)
2323
res.end('all good')

examples/webpack/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
},
88
devServer: {
99
static: {
10-
directory: __dirname,
10+
directory: __dirname,
1111
},
1212
},
1313
mode: 'development',

0 commit comments

Comments
 (0)