@mridang/eslint-defaults
v1.6.0
Published
A set of sane default for the NestJS framework
Downloads
661
Maintainers
Readme
A plugin for eslint that has an opinionated set of linting rules for all the @mridang scoped packages.
[!NOTE] This plugin targets ESLint 9 and the flat config format.
It ships a batteries-included lint setup for JS/TS, JSON/JSONC/JSON5, Markdown, YAML, TOML, HTML, and CSS. Bundled plugins include:
@eslint/js@typescript-eslint/eslint-pluginwith@typescript-eslint/parsereslint-plugin-prettiereslint-plugin-jsonandeslint-plugin-jsonceslint-plugin-markdowneslint-plugin-tailwindcsseslint-plugin-testing-libraryeslint-plugin-reactandeslint-plugin-react-hookseslint-plugin-jsx-a11yeslint-plugin-importeslint-plugin-perfectionisteslint-plugin-no-unsanitizedeslint-plugin-cypress@html-eslint/eslint-plugin@eslint/csseslint-plugin-ymleslint-plugin-toml
Installation
Install using NPM by using the following command
npm install --save-dev @mridang/eslint-defaultsAnd then add the plugin to your eslint.config.js file.
// eslint.config.mjs
import mridangPlugin from '@mridang/eslint-defaults';
export default [...mridangPlugin.configs.recommended];The example above uses the ESLint 9 flat configuration. Legacy config is not supported.
Usage
Once installed, point your flat config at the recommended export and you’re good to go. Treat it like any other shareable config; add your own rules and overrides as needed.
Adding support for a framework
You can layer framework presets on top of this config. Import the framework plugin’s flat config and spread it after @mridang/eslint-defaults.
Astro (via eslint-plugin-astro)
// eslint.config.mjs
import mridangPlugin from '@mridang/eslint-defaults';
import astro from 'eslint-plugin-astro';
export default [
...mridangPlugin.configs.recommended,
...astro.configs.recommended,
];Svelte (via eslint-plugin-svelte)
// eslint.config.mjs
import mridangPlugin from '@mridang/eslint-defaults';
import svelte from 'eslint-plugin-svelte';
export default [
...mridangPlugin.configs.recommended,
...svelte.configs['flat/recommended'],
];Next.js (via @next/eslint-plugin-next)
// eslint.config.mjs
import mridangPlugin from '@mridang/eslint-defaults';
import next from '@next/eslint-plugin-next';
export default [
...mridangPlugin.configs.recommended,
next.configs['core-web-vitals'],
];Vue (via eslint-plugin-vue)
// eslint.config.mjs
import mridangPlugin from '@mridang/eslint-defaults';
import vue from 'eslint-plugin-vue';
export default [
...mridangPlugin.configs.recommended,
...vue.configs['flat/recommended'],
];Contributing
If you have suggestions for how this library could be improved, or want to report a bug, open an issue - I'd love all and any contributions.
License
Apache License 2.0 © 2024 Mridang Agarwalla
