Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion guides/eslint-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [x] npm/cypress-schematic ✅ **COMPLETED**

### Batch 2: Framework adapters
- [ ] npm/react
- [x] npm/react ✅ **COMPLETED**
- [ ] npm/vue
- [ ] npm/svelte

Expand Down
5 changes: 0 additions & 5 deletions npm/react/.eslintignore

This file was deleted.

30 changes: 0 additions & 30 deletions npm/react/.eslintrc

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// https://medium.com/@pierrehedkvist/renderless-components-in-react-8d663746314c
// eslint-disable-next-line no-unused-vars

import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'

Expand Down
3 changes: 1 addition & 2 deletions npm/react/cypress/component/basic/document/document.cy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ const DocumentTest = ({ reportHeight }) => {
document.documentElement.clientHeight,
document.body.clientHeight,
)
}
}
}}
>
Report height
</button>
Expand Down
55 changes: 55 additions & 0 deletions npm/react/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { baseConfig } from '@packages/eslint-config'

// Root config files outside tsconfig may use the default project (no ** globs allowed).
const allowDefaultProject = [
'babel.config.js',
'cypress.config.js',
'eslint.config.ts',
'rollup.config.mjs',
'vite.config.ts',
]

// Only enable projectService for files in tsconfig or allowDefaultProject so cypress/** is linted without type-aware rules.
const projectServiceFiles = [
'src/**/*.ts',
'babel.config.js',
'cypress.config.js',
'eslint.config.ts',
'rollup.config.mjs',
'vite.config.ts',
]

export default [
{ ignores: ['**/dist', '**/*.d.ts', '**/package-lock.json', '**/tsconfig.json', '**/cypress/fixtures'] },
...baseConfig,
{
files: ['**/*.js', '**/*.ts', '**/*.jsx', '**/*.tsx'],
rules: {
'no-console': 'off',
'mocha/no-global-tests': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
},
},
{
files: projectServiceFiles,
languageOptions: {
parserOptions: {
tsconfigRootDir: __dirname,
projectService: {
allowDefaultProject,
},
},
},
},
{
files: ['cypress/**/*.js', 'cypress/**/*.ts', 'cypress/**/*.jsx', 'cypress/**/*.tsx'],
languageOptions: {
globals: {
Cypress: 'readonly',
cy: 'readonly',
expect: 'readonly',
},
},
},
]
8 changes: 7 additions & 1 deletion npm/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
"cy:open:debug": "node --inspect-brk ../../scripts/start.js --component-testing --run-project ${PWD}",
"cy:run": "node ../../scripts/cypress.js run --component",
"cy:run:debug": "node --inspect-brk ../../scripts/start.js --component-testing --run-project ${PWD}",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, .",
"lint": "eslint",
"test": "yarn cy:run",
"watch": "yarn build --watch --watch.exclude ./dist/**/*"
},
"devDependencies": {
"@packages/eslint-config": "0.0.0-development",
"@cypress/mount-utils": "0.0.0-development",
"eslint": "^9.31.0",
"jiti": "^2.4.2",
"@vitejs/plugin-react": "4.6.0",
"axios": "1.8.2",
"cypress": "0.0.0-development",
Expand Down Expand Up @@ -102,5 +105,8 @@
"cy",
"expect"
]
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": "eslint --fix"
}
}
Loading