quasarframework / quasar-testing

Testing Harness App Extensions for the Quasar Framework 2.0+
https://testing.quasar.dev
MIT License
180 stars 66 forks source link

ESLint not configured by the extension #95

Closed tomers closed 4 years ago

tomers commented 5 years ago

Software version

OS: macOS High Sierra 10.13.6 Node: v12.3.1 NPM: 6.9.0 Yarn: 1.16.0

Any other software related to your bug:

  "devDependencies": {
    "@quasar/app": "^1.0.0-rc.6",
    "@quasar/quasar-app-extension-testing-e2e-cypress": "^1.0.0-beta.10",
    "@vue/eslint-config-standard": "^4.0.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.16.0",
    "eslint-loader": "^2.1.2",
    "eslint-plugin-vue": "^5.2.2"
    ...
  },

What did you get as the error?

When writing tests after installing the quasar-app-extension-testing-e2e-cypress package, I see lining errors: describe is not defined in my IDE (IntelliJ).

I also get the following errors:

  1. it: "Element is not exported", and "Missing import statement"
  2. cy: "ESLint: 'cy' is not defined"

What were you expecting?

I would expect that the extension installation script would configure eslint properly, so that it will support the Cypress.io, Mocha and Chai directives.

What steps did you take, to get the error?

No steps needed - just write tests and see it.

How did you mitigate this issue?

I manually set the following in .eslintrc.js:

  env: {
    browser: true,
    mocha: true
  },

This helped resolve the describe is not defined error, but still I get warning for the describe and it globals: image

IlCallo commented 5 years ago

https://github.com/cypress-io/eslint-plugin-cypress should be used and a .eslintrc.js file should be added automatically inside test/cypress folder upon initialization. Via configuration cascading, it would enable Cypress linting rules, plugin and globals only inside cypress folder, extending root-level rules for all other

@nothingismagick this should be pretty easy

Suggested ESLint configuration:

module.exports = {
  extends: [
    // Add Cypress-specific lint rules, globals and Cypress plugin
    // See https://github.com/cypress-io/eslint-plugin-cypress#rules
    'plugin:cypress/recommended',
  ],
};

EDIT: Cypress team updated its recommended config to include globals, I updated the configuration to use