Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
How to disable eslint 'no-undef' for a specific package import?

I'm working with a framework ('hardhat') that automatically requires a package ('ethers') but eslint keeps calling it out as undefined. Requiring 'ethers' is not a solution because it just breaks everything; but from what I understand, a way to add exceptions to the entire document is to place overrides in a comment block above the entire thing.

 /*
    eslint-disable jest/valid-expect
 */ 
const { expect } = require("chai");
const { txHist } = require("../scripts/utils.js");

describe("DStor", () => {
    let DStor;
    let deployer, user1, user2, user3, users; // eslint-disable-line no-unused-vars

    beforeEach(async () => {
        // Get ContractFactory and Signers
        const DStorFactory = await ethers.getContractFactory("DStor"); // 'ethers' is highlighted with no-undef
...

I suspect the solution is to add another eslint-disable rule, but I don't know how to target the 'ethers' package with it. Anyone have any solutions?

Update: fixed by adding const { ethers } = require("hardhat");

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Have a look at ESLint globals. Basically, you can declare a global value ethers in your ESLint configuration, and that will be treated as defined in all linted files.

For ESLint >= 7, if your configuration file is .eslintrc, add an entry like:

{
    "globals": {
        "ethers": "readonly"
    }
}

For ESLint < 7, use "ethers": false instead.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda