https://cypress.io logo
ESLint rule to scream when the import is missing
# i-need-help
b
I tried to use this - eslintrc.json file :
Copy code
{
  "parser": "@typescript-eslint/parser",
  "plugins": [
    "@typescript-eslint"
  ],
  "extends": [
    "eslint:recommended",
    "plugin:node/recommended",
    "plugin:cypress/recommended"
  ],
  "parserOptions": {
    // Only ESLint 6.2.0 and later support ES2020.
    "ecmaVersion": 2020
  },
  "rules": {
    "cypress/no-assigning-return-values": "error",
    "cypress/no-unnecessary-waiting": "warn",
    "cypress/assertion-before-screenshot": "error",
    "cypress/no-force": "warn",
    "cypress/no-async-tests": "error",
    "node/no-missing-import": "error",
    "node/no-unsupported-features/es-syntax": "off",
    "no-unused-vars": "off"
  }
}
And in the package.json:
Copy code
"engines": {
    "node": ">=8.10.0"
  },
But I get this errror for all the imports:
ESLint: "../common/product-detail-actions" is not found.(node/no-missing-import)
On the line like this:
import { ProductDetailPageActions } from '../common/product-detail-actions';
which I know should work. Can you please advise how to do this properly? What am I missing here?
4 Views