La libreria
@nodecfdi/eslint-config
exporta la configuración base para eslint usada en los proyectos de NodeCfdi.
🇺🇸 The documentation of this project is in spanish as this is the natural language for intended audience.
🇲🇽 La documentación del proyecto está en español porque ese es el lenguaje principal de los usuarios.
Warning
This package is native ESM and no longer provides a CommonJS export. If your project uses CommonJS, you will have to convert to ESM. Please don't open issues for questions regarding CommonJS / ESM.
npm i -D eslint @nodecfdi/eslint-config
yarn add -D eslint @nodecfdi/eslint-config
pnpm add -D eslint @nodecfdi/eslint-config
Para habilitar está configuración crea un archivo eslint.config.js
en el root del proyecto y copia y pega el siguiente contenido:
// @ts-check
import nodecfdiConfig from '@nodecfdi/eslint-config';
const { defineConfig } = nodecfdiConfig(import.meta.dirname);
export default defineConfig(); // Puedes agregar mas reglas o bloques de configuracion dentro de esta funcion
Note
Por defecto tiene habilitado las siguientes opciones: projectService -> true, sonarjs -> true
Si deseas aplicar algun ajuste puedes y/o personalización puedes hacerlo de la siguiente manera:
// @ts-check
import nodecfdiConfig from '@nodecfdi/eslint-config';
const { defineConfig } = nodecfdiConfig(import.meta.dirname, {
vitest: true,
adonisjs: true,
sonarjs: true,
n: true,
});
export default defineConfig(); // Puedes agregar mas reglas o bloques de configuracion dentro de esta funcion
type NodecfdiSettings = {
/**
* Vitest support.
*/
vitest?: boolean;
/**
* AdonisJS support.
*/
adonisjs?: boolean;
/**
* Vue3 Support.
*/
vue?:
| boolean
| {
globalComponentsPatterns?: string[];
globalPropertiesPatterns?: string[];
};
/**
* SonarJS support
*/
sonarjs?: boolean;
/**
* Node using n support
*/
n?: boolean;
/**
* Typescript eslint project service option
*/
projectService?: boolean | ProjectServiceOptions;
/**
* This setting apply some ignore patterns to the whole config.
*/
ignores?: {
/**
* Some commonly ignored folders.
*/
recommended?: boolean;
/**
* With this setting, Nodecfdi will ignore all the files that are currently ignored by git. Chances are that if you are ignoring a file in git, you don't want to lint it, which usually is the case with temporary and autogenerated files.
*/
inheritedFromGitignore?: boolean;
/**
* Include additional ignore files paths or regex paths to ignore on current eslint config
*/
additional?: string[];
};
};
Puedes obtener soporte abriendo un ticket en Github.
Esta librería se mantendrá compatible con al menos la versión con soporte activo de Node más reciente y soporte activo de Typescript más reciente.
También utilizamos Versionado Semántico 2.0.0 por lo que puedes usar esta librería sin temor a romper tu aplicación.
Las contribuciones con bienvenidas. Por favor lee CONTRIBUTING para más detalles y recuerda revisar el archivo CHANGELOG.
The @nodecfdi/eslint-config
library is copyright © NodeCfdi and licensed for use under the MIT License (MIT). Please see LICENSE for more information.