diff --git a/.eslintrc.js b/.eslintrc.js index 5043606..06e16bb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,7 +4,12 @@ module.exports = { es2021: true, node: true, }, - plugins: ['@typescript-eslint', 'simple-import-sort', 'unused-imports'], + plugins: [ + '@typescript-eslint', + 'simple-import-sort', + 'unused-imports', + 'cypress', + ], extends: [ 'eslint:recommended', 'next', diff --git a/README.md b/README.md index d4ef04d..bef5ffc 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,12 @@ This project is using [conventional commits](https://www.conventionalcommits.org // TODO [cypress](https://www.cypress.io/) +- **Be aware** + + - Cypress uses a different ts `moduleResolution: node` from Next `bundler`, as a result of the difference the imports don't get formated properly + - Appending to top of your test file is the current fix `/* eslint-disable simple-import-sort/imports */` + - [Read More](https://github.com/cypress-io/cypress/issues/26308) + - **Running Cypress** - `pnpm run cypress:open` diff --git a/cypress/component/Dropdown.cy.tsx b/cypress/component/Dropdown.cy.tsx index 4e6e103..e6cbd0d 100644 --- a/cypress/component/Dropdown.cy.tsx +++ b/cypress/component/Dropdown.cy.tsx @@ -1,8 +1,9 @@ -/* eslint-disable simple-import-sort/imports */ +// /* eslint-disable simple-import-sort/imports */ -import { Dropdown } from '@/app/ui/Dropdown'; import '@/app/globals.css'; +import { Dropdown } from '@/app/ui/Dropdown'; + describe('Dropdown.cy.tsx', () => { const initialVal = 'Initial Val'; const options = ['Option 1', 'Options2']; diff --git a/package.json b/package.json index 777b152..787069e 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "format": "prettier --write .", "format:check": "prettier --check .", "lint": "next lint", - "lint:fix": "eslint src --fix && pnpm format", - "lint:strict": "eslint --max-warnings=0 src", + "lint:fix": "eslint . --fix && pnpm format", + "lint:strict": "eslint --max-warnings=0", "postbuild": "next-sitemap --config next-sitemap.config.js", "prepare": "husky install", "release": "release-it", @@ -47,6 +47,7 @@ "eslint": "latest", "eslint-config-next": "latest", "eslint-config-prettier": "latest", + "eslint-plugin-cypress": "latest", "eslint-plugin-simple-import-sort": "latest", "eslint-plugin-unused-imports": "latest", "husky": "latest", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6b5b43..a705434 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,7 +62,7 @@ devDependencies: specifier: latest version: 10.4.16(postcss@8.4.32) cypress: - specifier: ^13.6.2 + specifier: latest version: 13.6.2 daisyui: specifier: latest @@ -76,6 +76,9 @@ devDependencies: eslint-config-prettier: specifier: latest version: 9.1.0(eslint@8.56.0) + eslint-plugin-cypress: + specifier: latest + version: 2.15.1(eslint@8.56.0) eslint-plugin-simple-import-sort: specifier: latest version: 10.0.0(eslint@8.56.0) @@ -2519,6 +2522,15 @@ packages: - supports-color dev: true + /eslint-plugin-cypress@2.15.1(eslint@8.56.0): + resolution: {integrity: sha512-eLHLWP5Q+I4j2AWepYq0PgFEei9/s5LvjuSqWrxurkg1YZ8ltxdvMNmdSf0drnsNo57CTgYY/NIHHLRSWejR7w==} + peerDependencies: + eslint: '>= 3.2.1' + dependencies: + eslint: 8.56.0 + globals: 13.24.0 + dev: true + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@6.16.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'}