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

181
Vistas
Have ESLint or Prettier detect undefined / unimported code

I set up a JavaScript project with ESLint and Prettier.

Here is my .eslintrc.json:

{
  "extends": [
    "next/core-web-vitals",
    "plugin:unicorn/recommended",
    "plugin:prettier/recommended"
  ],
  "parserOptions": {
    "ecmaVersion": 2022
  },
  "plugins": ["simple-import-sort"],
  "rules": {
    "simple-import-sort/imports": "error",
    "simple-import-sort/exports": "error",
    "unicorn/no-null": "off",
    "unicorn/prevent-abbreviations": [
      "error",
      {
        "allowList": {
          "getServerSideProps": true,
          "getStaticProps": true
        }
      }
    ]
  },
  "overrides": [
    {
      "files": ["*.spec.ts"],
      "extends": ["plugin:cypress/recommended"]
    }
  ]
}

and here is my .prettierrc.json:

{
  "arrowParens": "avoid",
  "bracketSameLine": false,
  "bracketSpacing": true,
  "htmlWhitespaceSensitivity": "css",
  "insertPragma": false,
  "jsxSingleQuote": false,
  "printWidth": 80,
  "proseWrap": "always",
  "quoteProps": "as-needed",
  "requirePragma": false,
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "all",
  "useTabs": false
}

Now I wrote this test:

import { describe } from 'riteway';

describe('mapUserSessionToUserProfile()', async assert => {
  const email = 'foo@bar.com';
  const session = {
    email,
    issuer: 'did:example:123456789abcdefghi',
    publicAddress: '0xDC25EF3F5B8A186998338A2ADA83795FBA2D695E',
  };

  const userProfile = { email, id: session.issuer };

  assert({
    given: 'a user session',
    should: 'return a user profile',
    actual: mapUserSessionToUserProfile(session),
    expected: userProfile,
  });
});

but as you can see, I forgot to:

import { mapUserSessionToUserProfile } from './user-profile-helpers';

ESLint didn't complain. I was wondering, is there a way for ESLint to recognize these errors?

about 4 years ago · Juan Pablo Isaza
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