Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imranbarbhuiya/eslint-config-mahir
The ultimate ESLint shareable config
https://github.com/imranbarbhuiya/eslint-config-mahir
eslint hacktoberfest javascript jsx nodejs prettier typescript
Last synced: about 1 month ago
JSON representation
The ultimate ESLint shareable config
- Host: GitHub
- URL: https://github.com/imranbarbhuiya/eslint-config-mahir
- Owner: imranbarbhuiya
- License: mit
- Created: 2022-09-25T12:44:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T14:50:16.000Z (8 months ago)
- Last Synced: 2024-05-01T16:53:49.180Z (8 months ago)
- Topics: eslint, hacktoberfest, javascript, jsx, nodejs, prettier, typescript
- Language: JavaScript
- Homepage:
- Size: 9.7 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Mahir ESLint Config
The ultimate ESLint shareable config. This config includes all of the ESLint rules that I use in my projects.
> [!Important]
> This is a highly opinionated config. It's based on my personal preferences and the way I write code.
> I don't recommend using this config as is as I'll update it based on my preferences without any notice.## Installation
```bash
npm install --save-dev eslint eslint-config-mahir
```## Usage
Add in your eslint.config.js (for esm projects) or eslint.config.mjs
```js
import common from 'eslint-config-mahir/common';
import node from 'eslint-config-mahir/node';
import module from 'eslint-config-mahir/module';
import typescript from 'eslint-config-mahir/typescript';
import jsx from 'eslint-config-mahir/jsx';
import react from 'eslint-config-mahir/react';
import next from 'eslint-config-mahir/next';
import mdx from 'eslint-config-mahir/mdx';
import edge from 'eslint-config-mahir/edge';
import jsdoc from 'eslint-config-mahir/jsdoc';
import tsdoc from 'eslint-config-mahir/tsdoc';
import native from 'eslint-config-mahir/native';export default [
...common,
...node,
...module,
...typescript,
...jsx,
...react, // when using react, you can omit jsx as it's already included with react
...next,
...mdx,
...edge,
...jsdoc,
...tsdoc, // when using tsdoc, you can omit jsdoc as it's already included with tsdoc
...native, // when using native, you can omit react as it's already included with native
];```
You can remove any of the configs you don't need.
> **Note**:
For typescript users, typed linting is done via `projectService`. You can learn more about it from https://typescript-eslint.io/getting-started/typed-linting/#faqs and customize it as per your need.
```js
/**
* @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray}
*/
export default [
...
{
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: [
'files-outside-tsconfig.json',
],
defaultProject: 'tsconfig.json',
},
tsconfigRootDir: process.cwd(),
},
},
]
```> **Warning**:
If you are using both `mdx` and `typescript` config, make sure add files to avoid conflicts
```js/**
* @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray}
*/
export default [
// ... other configs
...mdx.map((config) => ({
files: ['**/*.mdx'],
...config,
})),
...typescript.map((config) => ({
files: ['**/*.tsx', '**/*.ts', '**/*.cjs', '**/*.jsx', '**/*.js'],
...config,
})),
// ... other configs
]
```## Configs
This package contains eslint config for
- `common` rules common for all configs
- `node` rules for nodejs projects
- `module` rules for esm projects
- `typescript` rules for typescript projects
- `jsx` rules for jsx/tsx projects
- `react` rules for react projects (this config contains all the `jsx` rules too)
- `native` rules for react native projects (this config contains all the `react` rules too)
- `next` rules for nextjs projects
- `mdx` rules for mdx projects
- `edge` rules for projects running in edge
- `jsdoc` jsdoc related config
- `tsdoc` tsdoc related config (this config contains all the `jsdoc` rules too)## Contributors ✨
Thanks goes to these wonderful people: