@favorodera/eslint-config 2.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -137
- package/dist/globs.d.mts +40 -0
- package/dist/globs.mjs +1 -0
- package/dist/index.d.mts +256 -21808
- package/dist/index.mjs +1 -1
- package/dist/types-D-U1-CaX.d.mts +22075 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/dist/utils.d.mts +36 -0
- package/dist/utils.mjs +1 -0
- package/package.json +40 -36
package/README.md
CHANGED
|
@@ -1,165 +1,103 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<p>
|
|
5
|
-
<a href="https://github.com/favorodera/eslint-config/blob/main/LICENSE"><img src="https://img.shields.io/github/license/favorodera/eslint-config.svg?style=plastic&label=License&color=blue" alt="License"></a>
|
|
6
|
-
<a href="https://github.com/favorodera/eslint-config/stargazers"><img src="https://img.shields.io/github/stars/favorodera/eslint-config.svg?style=plastic&label=Stars&color=blue" alt="GitHub Stars"></a>
|
|
7
|
-
<a href="https://npmx.dev/package/@favorodera/eslint-config"><img src="https://img.shields.io/npm/dt/@favorodera/eslint-config.svg?style=plastic&label=NPM%20Downloads&color=blue" alt="NPM Downloads"></a>
|
|
8
|
-
<a href="https://npmx.dev/package/@favorodera/eslint-config"><img src="https://img.shields.io/npm/v/@favorodera/eslint-config.svg?style=plastic&label=Version&color=blue" alt="NPM Version"></a>
|
|
9
|
-
</p>
|
|
10
|
-
</div>
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/header/transparent.svg?title=%40favorodera%2Feslint-config&subtitle=An+opinionated%2C+type-safe+ESLint+flat+configuration+for+JavaScript+and+TypeScript+projects.&size=wide&mode=dark" /><img alt="@favorodera/eslint-config" src="https://shieldcn.dev/header/transparent.svg?title=%40favorodera%2Feslint-config&subtitle=An+opinionated%2C+type-safe+ESLint+flat+configuration+for+JavaScript+and+TypeScript+projects.&size=wide&mode=light" /></picture>
|
|
3
|
+
</p>
|
|
11
4
|
|
|
12
|
-
<
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@favorodera/eslint-config"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/npm/@favorodera/eslint-config.svg?variant=outline&size=xs" /><img alt="npm version" src="https://shieldcn.dev/npm/@favorodera/eslint-config.svg?variant=outline&size=xs&mode=light" /></picture></a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/@favorodera/eslint-config"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/npm/dm/@favorodera/eslint-config.svg?variant=outline&size=xs" /><img alt="npm downloads" src="https://shieldcn.dev/npm/dm/@favorodera/eslint-config.svg?variant=outline&size=xs&mode=light" /></picture></a>
|
|
8
|
+
<a href="https://github.com/favorodera/eslint-config/actions"><picture><source media="(prefers-color-scheme: dark)" srcset="https://shieldcn.dev/github/favorodera/eslint-config/ci.svg?variant=outline&size=xs" /><img alt="CI status" src="https://shieldcn.dev/github/favorodera/eslint-config/ci.svg?variant=outline&size=xs&mode=light" /></picture></a>
|
|
9
|
+
</p>
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
`@favorodera/eslint-config` is an opinionated, type-safe ESLint flat configuration for JavaScript and TypeScript projects. It combines code-quality, sorting, and style rules with support for common project file formats and tooling.
|
|
15
12
|
|
|
16
13
|
## Features
|
|
17
14
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- **Highly Configurable** — Easily enable or disable specific rulesets based on your project's needs.
|
|
26
|
-
|
|
27
|
-
## Supported Configs
|
|
28
|
-
|
|
29
|
-
The following configurations are bundled and enabled by default (they can be individually disabled or customized):
|
|
30
|
-
|
|
31
|
-
- **JavaScript** — Core ESLint rules (`@eslint/js`)
|
|
32
|
-
- **TypeScript** — Type-aware linting (`typescript-eslint`)
|
|
33
|
-
- **Vue** — Single-file component support and accessibility linting (`eslint-plugin-vue`, `vue-eslint-parser`, `eslint-plugin-vuejs-accessibility`)
|
|
34
|
-
- **Stylistic** — Formatting rules (`@stylistic/eslint-plugin`)
|
|
35
|
-
- **CSS** — CSS linting and best practices (`@eslint/css` and `eslint-cssicorn`)
|
|
36
|
-
- **Tailwind CSS** — Utility class linting and sorting (`eslint-plugin-better-tailwindcss`)
|
|
37
|
-
- **Test** — Test and Vitest specific linting (`@vitest/eslint-plugin`)
|
|
38
|
-
- **Imports** — Auto-sorting and import quality rules (`eslint-plugin-import-lite`)
|
|
39
|
-
- **Unused Imports** — Unused imports and variables detection and cleanup (`eslint-plugin-unused-imports`)
|
|
40
|
-
- **Markdown** — Linting for markdown files and embedded code blocks (`@eslint/markdown`)
|
|
41
|
-
- **JSON/JSONC/JSON5** — Formatting and sorting for JSON files like `package.json` (`eslint-plugin-jsonc`)
|
|
42
|
-
- **JSDoc** — Standardized comment formatting (`eslint-plugin-jsdoc`)
|
|
43
|
-
- **Unicorn** — Various code quality improvements (`eslint-plugin-unicorn`)
|
|
44
|
-
- **Perfectionist** — Sorting objects, imports, classes, etc. (`eslint-plugin-perfectionist`)
|
|
45
|
-
- **Node** — Node.js specific linting rules (`eslint-plugin-n`)
|
|
15
|
+
- Type-safe flat config with rule autocomplete.
|
|
16
|
+
- Configurable rule groups with sensible defaults.
|
|
17
|
+
- JavaScript, TypeScript, and Vue single-file component linting.
|
|
18
|
+
- CSS and Tailwind CSS linting.
|
|
19
|
+
- Markdown and embedded-code linting.
|
|
20
|
+
- Import hygiene, sorting, and unused-import detection.
|
|
21
|
+
- JSON-family, YAML, pnpm, Node.js, JSDoc, Unicorn, and Vitest rules.
|
|
46
22
|
|
|
23
|
+
## Installation
|
|
47
24
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Install
|
|
51
|
-
|
|
52
|
-
<details>
|
|
53
|
-
<summary><b>pnpm</b></summary>
|
|
25
|
+
**Requirements:** Node.js 24 or later and ESLint 10.
|
|
54
26
|
|
|
55
|
-
```
|
|
56
|
-
pnpm
|
|
27
|
+
```sh
|
|
28
|
+
pnpm add -D eslint@^10 @favorodera/eslint-config
|
|
57
29
|
```
|
|
58
|
-
</details>
|
|
59
30
|
|
|
60
|
-
|
|
61
|
-
<summary><b>npm</b></summary>
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
npm install -D eslint @favorodera/eslint-config
|
|
65
|
-
```
|
|
66
|
-
</details>
|
|
67
|
-
|
|
68
|
-
<details>
|
|
69
|
-
<summary><b>yarn</b></summary>
|
|
31
|
+
## Usage
|
|
70
32
|
|
|
71
|
-
|
|
72
|
-
yarn add -D eslint @favorodera/eslint-config
|
|
73
|
-
```
|
|
74
|
-
</details>
|
|
33
|
+
Create `eslint.config.ts` in your project root:
|
|
75
34
|
|
|
76
|
-
|
|
77
|
-
|
|
35
|
+
```ts
|
|
36
|
+
import { defineConfig } from '@favorodera/eslint-config'
|
|
78
37
|
|
|
79
|
-
|
|
80
|
-
bun add -D eslint @favorodera/eslint-config
|
|
38
|
+
export default defineConfig()
|
|
81
39
|
```
|
|
82
|
-
</details>
|
|
83
40
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Create an `eslint.config.ts` file in the root of your project. Since all configurations are enabled by default, you only need to pass options if you want to disable or customize something.
|
|
87
|
-
|
|
88
|
-
The `factory()` function returns a `FlatConfigComposer` instance (powered by [`eslint-flat-config-utils`](https://github.com/antfu/eslint-flat-config-utils)), which acts as a powerful composer. This makes it incredibly easy to append your own configurations, override existing rules, or insert plugins seamlessly.
|
|
41
|
+
All configuration groups are enabled by default. Disable groups you do not need or pass options to customize them:
|
|
89
42
|
|
|
90
43
|
```ts
|
|
91
|
-
import {
|
|
44
|
+
import { defineConfig } from '@favorodera/eslint-config'
|
|
92
45
|
|
|
93
|
-
export default
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
46
|
+
export default defineConfig({
|
|
47
|
+
ignores: (defaults) => {
|
|
48
|
+
return [...defaults, '**/generated/**']
|
|
49
|
+
},
|
|
97
50
|
stylistic: {
|
|
98
|
-
|
|
99
|
-
|
|
51
|
+
settings: {
|
|
52
|
+
indent: 2,
|
|
53
|
+
quotes: 'single',
|
|
54
|
+
semi: false,
|
|
55
|
+
},
|
|
100
56
|
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
})
|
|
105
|
-
// You can seamlessly chain methods to compose your config
|
|
106
|
-
.append({
|
|
107
|
-
// Add your own custom ESLint configs
|
|
108
|
-
ignores: ['src/types/rules.d.ts'],
|
|
109
|
-
})
|
|
110
|
-
.overrides({
|
|
111
|
-
// Easily override predefined rules by their name
|
|
112
|
-
'favorodera/typescript/rules': {
|
|
113
|
-
rules: {
|
|
114
|
-
'ts/no-explicit-any': 'off',
|
|
115
|
-
},
|
|
57
|
+
tailwind: {
|
|
58
|
+
settings: {
|
|
59
|
+
entryPoint: 'src/styles.css',
|
|
116
60
|
},
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
- [pnpm](https://pnpm.io/installation) v11 or later
|
|
126
|
-
|
|
127
|
-
### Getting Started
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
# Install all dependencies
|
|
131
|
-
pnpm install
|
|
132
|
-
|
|
133
|
-
# Start compiler in watch mode and open ESLint config inspector
|
|
134
|
-
pnpm dev
|
|
135
|
-
|
|
136
|
-
# Build the project
|
|
137
|
-
pnpm build
|
|
138
|
-
|
|
139
|
-
# Lint, typecheck, build, and test in one go
|
|
140
|
-
pnpm ready
|
|
61
|
+
},
|
|
62
|
+
typescript: {
|
|
63
|
+
overrides: {
|
|
64
|
+
'typescript/no-explicit-any': 'off',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
vue: false,
|
|
68
|
+
})
|
|
141
69
|
```
|
|
142
70
|
|
|
143
|
-
|
|
71
|
+
Use `overrides` for rule changes and `settings` for configuration-specific settings where supported. Ignore arrays are appended to the built-in patterns; an ignore callback receives the defaults and returns the complete list.
|
|
72
|
+
|
|
73
|
+
## Configuration groups
|
|
74
|
+
|
|
75
|
+
| Option | Purpose |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `javascript` | Core JavaScript rules. |
|
|
78
|
+
| `typescript` | TypeScript linting. |
|
|
79
|
+
| `vue` | Vue single-file components and accessibility rules. |
|
|
80
|
+
| `stylistic` | Code style and formatting. |
|
|
81
|
+
| `css` | CSS linting, including Tailwind CSS v4 syntax. |
|
|
82
|
+
| `tailwind` | Tailwind class validation and consistency. |
|
|
83
|
+
| `imports` | Import ordering and import quality. |
|
|
84
|
+
| `unusedImports` | Unused imports and variables. |
|
|
85
|
+
| `perfectionist` | Sorting rules for code structures. |
|
|
86
|
+
| `jsdoc` | JSDoc validation and style. |
|
|
87
|
+
| `jsonc` | JSON, JSON5, JSONC, `package.json`, and TypeScript config files. |
|
|
88
|
+
| `yaml` | YAML linting and `pnpm-workspace.yaml` key ordering. |
|
|
89
|
+
| `pnpm` | pnpm rules for `package.json` and `pnpm-workspace.yaml`. |
|
|
90
|
+
| `node` | Node.js-specific rules. |
|
|
91
|
+
| `unicorn` | Additional JavaScript and TypeScript code-quality rules. |
|
|
92
|
+
| `vitest` | Rules for Vitest test files. |
|
|
93
|
+
| `markdown` | Markdown linting; GitHub Flavored Markdown is enabled by default. |
|
|
94
|
+
| `codeInMarkdown` | Rules for supported code blocks embedded in Markdown. |
|
|
95
|
+
| `ignores` | Adds to or customizes the default ignored paths. Always applied. |
|
|
144
96
|
|
|
145
|
-
|
|
146
|
-
|---------|-------------|
|
|
147
|
-
| `pnpm dev` | Generates types, starts watch mode, and opens `@eslint/config-inspector` |
|
|
148
|
-
| `pnpm build` | Production build using `tsdown` |
|
|
149
|
-
| `pnpm script:generate-rules-types` | Extracts and generates type definitions for all ESLint rules |
|
|
150
|
-
| `pnpm lint` | Lint the repository |
|
|
151
|
-
| `pnpm typecheck` | Type-check without emitting files |
|
|
152
|
-
| `pnpm test` | Run test suites with Vitest |
|
|
153
|
-
| `pnpm ready` | Full pipeline: install → build → lint → typecheck → test |
|
|
154
|
-
|
|
155
|
-
## Contributing & Issues
|
|
156
|
-
|
|
157
|
-
Feel free to open an issue or submit a pull request if you'd like to improve the rules, add new features, or fix a bug. Please ensure you run `pnpm ready` before submitting your PR to make sure tests and linting pass.
|
|
158
|
-
|
|
159
|
-
## Inspiration
|
|
97
|
+
## Development
|
|
160
98
|
|
|
161
|
-
|
|
99
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development and contribution guidelines.
|
|
162
100
|
|
|
163
101
|
## License
|
|
164
102
|
|
|
165
|
-
[MIT](./LICENSE)
|
|
103
|
+
[MIT](./LICENSE) © [Favour Emeka](https://github.com/favorodera)
|
package/dist/globs.d.mts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Glob pattern for matching JavaScript files */
|
|
2
|
+
export declare const jsGlob = "**/*.{js,cjs,mjs}";
|
|
3
|
+
/** Glob pattern for matching TypeScript files */
|
|
4
|
+
export declare const tsGlob = "**/*.{ts,cts,mts}";
|
|
5
|
+
/** Glob pattern for matching Vue single-file components */
|
|
6
|
+
export declare const vueGlob = "**/*.vue";
|
|
7
|
+
/** Glob pattern for matching CSS files */
|
|
8
|
+
export declare const cssGlob = "**/*.css";
|
|
9
|
+
/** Glob pattern for matching Markdown files */
|
|
10
|
+
export declare const mdGlob = "**/*.md";
|
|
11
|
+
/** Glob pattern for matching virtual files extracted from Markdown */
|
|
12
|
+
export declare const mdInMdGlob = "**/*.md/*.md";
|
|
13
|
+
/** Glob pattern for matching code blocks embedded in Markdown files */
|
|
14
|
+
export declare const codeInMdGlob = "**/*.md/**/*.{js,cjs,mjs,ts,cts,mts,vue,css}";
|
|
15
|
+
/** Glob pattern for matching scripts files */
|
|
16
|
+
export declare const scriptsGlob = "**/*.{js,cjs,mjs,ts,cts,mts}";
|
|
17
|
+
/** Glob pattern for matching test files */
|
|
18
|
+
export declare const testGlob = "**/*.{test,spec,bench,benchmark}.{js,cjs,mjs,ts,cts,mts}";
|
|
19
|
+
/** Glob pattern for matching JSON files */
|
|
20
|
+
export declare const jsonGlob = "**/*.json";
|
|
21
|
+
/** Glob pattern for matching JSON5 files */
|
|
22
|
+
export declare const json5Glob = "**/*.json5";
|
|
23
|
+
/** Glob pattern for matching JSON with Comments files */
|
|
24
|
+
export declare const jsoncGlob = "**/*.jsonc";
|
|
25
|
+
/**
|
|
26
|
+
* Glob patterns matching standard and named TypeScript configuration files.
|
|
27
|
+
* Both `tsconfig.json` and files such as `tsconfig.build.json` are included.
|
|
28
|
+
*/
|
|
29
|
+
export declare const tsConfigGlob: string[];
|
|
30
|
+
/** Glob pattern for matching YAML files */
|
|
31
|
+
export declare const yamlGlob = "**/*.{yml,yaml}";
|
|
32
|
+
/** Glob pattern for matching pnpm-workspace.yaml file */
|
|
33
|
+
export declare const pnpmWorkspaceGlob = "pnpm-workspace.yaml";
|
|
34
|
+
/** Glob pattern for matching package.json files */
|
|
35
|
+
export declare const packageJsonGlob = "**/package.json";
|
|
36
|
+
/**
|
|
37
|
+
* Common glob patterns for files and directories that should be ignored by ESLint.
|
|
38
|
+
* Includes node_modules, build outputs, lock files, temporary files, and tool-specific caches.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ignoresGlob: string[];
|
package/dist/globs.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`**/*.{js,cjs,mjs}`,t=`**/*.{ts,cts,mts}`,n=`**/*.vue`,r=`**/*.css`,i=`**/*.md`,a=`**/*.md/*.md`,o=`**/*.md/**/*.{js,cjs,mjs,ts,cts,mts,vue,css}`,s=`**/*.{js,cjs,mjs,ts,cts,mts}`,c=`**/*.{test,spec,bench,benchmark}.{js,cjs,mjs,ts,cts,mts}`,l=`**/*.json`,u=`**/*.json5`,d=`**/*.jsonc`,f=[`**/tsconfig.*.json`,`**/tsconfig.json`],p=`**/*.{yml,yaml}`,m=`pnpm-workspace.yaml`,h=`**/package.json`,g=/* @__PURE__ */ `**/node_modules/**,**/package-lock.json,**/pnpm-lock.yaml,**/*.min.*,**/.output,**/cache,**/dist/**,**/output,**/__snapshots__,**/coverage,**/.nuxt,**/.turbo,**/.vercel,**/.vite-inspect,**/.vitepress/cache,**/.data,**/.history,**/.idea,**/.temp,**/.tmp,**/temp,**/tmp,**/auto-import?(s).d.ts,**/components.d.ts,**/vite.config.*.timestamp-*,**/CHANGELOG*.md,**/LICENSE*,**/.*/skills,**/.agents,**/.claude,**/.context`.split(`,`);export{o as codeInMdGlob,r as cssGlob,g as ignoresGlob,e as jsGlob,u as json5Glob,l as jsonGlob,d as jsoncGlob,i as mdGlob,a as mdInMdGlob,h as packageJsonGlob,m as pnpmWorkspaceGlob,s as scriptsGlob,c as testGlob,f as tsConfigGlob,t as tsGlob,n as vueGlob,p as yamlGlob};
|