Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ESLint failures #1547

Open
MikeMcC399 opened this issue May 6, 2024 · 0 comments
Open

Multiple ESLint failures #1547

MikeMcC399 opened this issue May 6, 2024 · 0 comments

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented May 6, 2024

Issue

If the repo is manually linted with ESLint then multiple issues are reported. Violations of the following rules are reported:

array-callback-return

Rule: array-callback-return

Violations in:

  • cypress-realworld-app/backend/database.ts

cypress/no-unnecessary-waiting

Rule: cypress/no-unnecessary-waiting

Violations in:

  • cypress-realworld-app/cypress/tests/ui/transaction-feeds.spec.ts

cypress/unsafe-to-chain-command

Rule: cypress/unsafe-to-chain-command

Violations in:

  • cypress-realworld-app/cypress/tests/ui/auth.spec.ts
  • cypress-realworld-app/cypress/tests/ui/bankaccounts.spec.ts
  • cypress-realworld-app/cypress/tests/ui/new-transaction.spec.ts
  • cypress-realworld-app/cypress/tests/ui/transaction-feeds.spec.ts
  • cypress-realworld-app/cypress/tests/ui/user-settings.spec.ts

@typescript-eslint/no-unused-expressions

Rule: @typescript-eslint/no-unused-expressions

Violations in:

cypress-realworld-app/cypress/tests/ui/transaction-feeds.spec.ts

@typescript-eslint/no-unused-vars

Rule: @typescript-eslint/no-unused-vars

Violations in:

  • cypress-realworld-app/cypress/global.d.ts

Steps to reproduce

Ubuntu 22.04.5 LTS, Node.js 20.12.0 according to .node-version

Execute

npm install yarn@latest -g
git clone https://github.com/cypress-io/cypress-realworld-app
cd cypress-realworld-app
n auto # only if using n as node.js version manager
yarn
yarn eslint .

Logs

Logs for "yarn eslint ." $ yarn eslint . yarn run v1.22.19 $ /home/mike/github/tmp/cypress-realworld-app/node_modules/.bin/eslint . Browserslist: caniuse-lite is outdated. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme

/home/mike/github/tmp/cypress-realworld-app/backend/database.ts
768:57 warning Array.prototype.flatMap() expects a value to be returned at the end of arrow function array-callback-return

/home/mike/github/tmp/cypress-realworld-app/cypress/global.d.ts
10:5 warning 'User' is defined but never used @typescript-eslint/no-unused-vars
11:5 warning 'BankAccount' is defined but never used @typescript-eslint/no-unused-vars
12:5 warning 'Like' is defined but never used @typescript-eslint/no-unused-vars
13:5 warning 'Comment' is defined but never used @typescript-eslint/no-unused-vars
14:5 warning 'Transaction' is defined but never used @typescript-eslint/no-unused-vars
15:5 warning 'BankTransfer' is defined but never used @typescript-eslint/no-unused-vars
16:5 warning 'Contact' is defined but never used @typescript-eslint/no-unused-vars

/home/mike/github/tmp/cypress-realworld-app/cypress/tests/ui/auth.spec.ts
114:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
114:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
118:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
133:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
133:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
136:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
136:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
139:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
139:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
142:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
142:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
145:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command

/home/mike/github/tmp/cypress-realworld-app/cypress/tests/ui/bankaccounts.spec.ts
72:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
72:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
77:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
84:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
90:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
96:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
101:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
107:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
113:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
118:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
122:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command

/home/mike/github/tmp/cypress-realworld-app/cypress/tests/ui/new-transaction.spec.ts
79:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
114:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
126:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
126:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
131:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
131:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command

/home/mike/github/tmp/cypress-realworld-app/cypress/tests/ui/transaction-feeds.spec.ts
76:9 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
123:13 error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions
177:9 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
191:11 error Do not wait for arbitrary time periods cypress/no-unnecessary-waiting
236:11 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
308:9 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
406:11 error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions
427:11 error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions

/home/mike/github/tmp/cypress-realworld-app/cypress/tests/ui/user-settings.spec.ts
32:7 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
32:7 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
38:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
38:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
43:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
48:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
48:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
53:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
63:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
64:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
65:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
66:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command
66:5 error It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from cy. in a next command line cypress/unsafe-to-chain-command

✖ 58 problems (50 errors, 8 warnings)

One of your dependencies, babel-preset-react-app, is importing the
"@babel/plugin-proposal-private-property-in-object" package without
declaring it in its dependencies. This is currently working because
"@babel/plugin-proposal-private-property-in-object" is already in your
node_modules folder for unrelated reasons, but it may break at any time.

babel-preset-react-app is part of the create-react-app project, which
is not maintianed anymore. It is thus unlikely that this bug will
ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
your devDependencies to work around this error. This will make this message
go away.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Suggestions

Each of the failures needs to be examined to decide whether they are valid/fixable, valid/not-fixable or false positives.

ESLint provides different options for disabling certain rules globally, individually for a source file, a section of a source file or a single line of a source file. This may be a temporary or permanent solution for each failure.

Related issues

Script lint

The script lint is inactive as far as ESLint is concerned. Since no files are specified, it lints zero files, which is probably the reason that the linting failures have not so far been noticed.

This should be logged as a separate issue. It would however be better to address the lint failures first, before enabling the script to work.

ESLint configuration

The ESLint configuration is contained in the eslintConfig property of package.json. This is allowed in ESLint 8.x and deprecated in ESLint 9.x.

It may be advantageous to update the configuration to use an eslint.config.*js format in parallel to resolving linting failures.

Edit: since Oct 5, 2024, ESLint v8, used in this repo, is unsupported. See https://eslint.org/version-support/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant