@jimmy.codes/eslint-config 5.4.0 → 5.6.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 CHANGED
@@ -3,45 +3,37 @@
3
3
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/jimmy-guzman/eslint-config/cd.yml?style=flat-square&logo=github-actions)
4
4
  [![version](https://img.shields.io/npm/v/@jimmy.codes/eslint-config.svg?logo=npm&style=flat-square)](https://www.npmjs.com/package/@jimmy.codes/eslint-config)
5
5
  [![downloads](https://img.shields.io/npm/dm/@jimmy.codes/eslint-config.svg?logo=npm&style=flat-square)](http://www.npmtrends.com/@jimmy.codes/eslint-config)
6
- [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://semantic-release.gitbook.io/semantic-release)
7
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square&logo=prettier)](https://github.com/prettier/prettier)
8
6
 
9
- > 🔍 A pragmatic and opinionated [ESLint](https://eslint.org) config for modern development.
7
+ > A simple, modern ESLint config that covers most use cases.
10
8
 
11
- ## **✨ Features**
9
+ ## **Why Use This?**
12
10
 
13
- - **📡 Auto-detects your stack** Supports React, TypeScript, Astro, Next.js, Vitest, Jest, Playwright, Storybook, and TanStack Query.
14
- - **⚡ Efficient & lightweight** – Dynamically imports configs for better performance.
15
- - **🛠️ Works out of the box** – No manual setup required for most projects.
16
- - **🎛️ Fully customizable** – Override, extend, or disable rules to fit your needs.
17
- - **🔄 Always up to date** – Evolves with the latest ESLint, TypeScript, and framework best practices.
11
+ A strict-but-practical ESLint config that **doesn’t require much thought**. It works out of the box, adapts to your stack, and enforces good patterns without getting in the way.
18
12
 
19
- ---
20
-
21
- ## **🚀 Philosophy**
13
+ - **Auto-detects dependencies** – Handles React, TypeScript, Astro, Next.js, Vitest, Jest, Playwright, Storybook, and TanStack Query.
14
+ - **Prevents real issues** – Focuses on rules that actually matter.
15
+ - **Fast & lightweight** – Loads only what’s needed, so it won’t slow you down.
16
+ - **No setup needed** – Install it, import it, done.
17
+ - **Customizable** – Turn off what you don’t need.
18
+ - **Works with tests** – Supports Vitest, Jest, Playwright, and Testing Library.
19
+ - **Encourages modern JS** – Keeps things clean and readable.
22
20
 
23
- A strict yet ergonomic ESLint config that ensures **clean, maintainable, and modern** JavaScript and TypeScript codebases.
24
-
25
- - **🛡️ Code safety first** – Enforce patterns that prevent runtime errors and unexpected behavior.
26
- - **📜 Embrace modern JavaScript** – Prefer maintainable, expressive, and future-proof code.
27
- - **⚙️ Optimized for performance** – Loads only relevant configs to keep linting fast.
28
- - **📏 Consistency without rigidity** – Prioritizes structure and readability over personal opinions.
29
- - **🧪 Built for testing** – Enforces best practices for Vitest, Jest, Playwright, and Testing Library.
21
+ ---
30
22
 
31
- ## 🛠️ Usage
23
+ ## Installation & Usage
32
24
 
33
25
  > [!NOTE]
34
- > For a better experience, use [@jimmy.codes/prettier-config](https://github.com/jimmy-guzman/prettier-config) as well.
26
+ > Works best with [@jimmy.codes/prettier-config](https://github.com/jimmy-guzman/prettier-config).
35
27
 
36
- ### 🔨 Getting Started
37
-
38
- Install the package:
28
+ ### Install
39
29
 
40
30
  ```sh
41
31
  pnpm add -D @jimmy.codes/eslint-config
42
32
  ```
43
33
 
44
- Then, in your `eslint.config.ts`, simply add:
34
+ ### Basic Setup
35
+
36
+ Add this to `eslint.config.ts`:
45
37
 
46
38
  ```mjs
47
39
  import { defineConfig } from "@jimmy.codes/eslint-config";
@@ -49,12 +41,13 @@ import { defineConfig } from "@jimmy.codes/eslint-config";
49
41
  export default defineConfig();
50
42
  ```
51
43
 
52
- This automatically applies rules **based on your installed dependencies**.
44
+ It’ll auto-configure based on your installed dependencies.
53
45
 
54
- ### 🔧 Configuration
46
+ ---
55
47
 
56
- By default, this config **auto-detects** relevant rules based on your dependencies (`react`, `vitest`, etc.).
57
- To disable this behavior:
48
+ ## Customization
49
+
50
+ ### Disable Auto-Detection
58
51
 
59
52
  ```ts
60
53
  import { defineConfig } from "@jimmy.codes/eslint-config";
@@ -62,9 +55,7 @@ import { defineConfig } from "@jimmy.codes/eslint-config";
62
55
  export default defineConfig({ autoDetect: false });
63
56
  ```
64
57
 
65
- #### **Manually Enable/Disable Rule Sets**
66
-
67
- You can explicitly enable or disable rule sets:
58
+ ### Enable/Disable Rule Sets
68
59
 
69
60
  ```ts
70
61
  import { defineConfig } from "@jimmy.codes/eslint-config";
@@ -83,9 +74,7 @@ export default defineConfig({
83
74
  });
84
75
  ```
85
76
 
86
- #### **Extending/Overriding the Configuration**
87
-
88
- Use the `overrides` option:
77
+ ### Override Specific Rules
89
78
 
90
79
  ```ts
91
80
  import { defineConfig } from "@jimmy.codes/eslint-config";
@@ -108,51 +97,51 @@ export default defineConfig({
108
97
  });
109
98
  ```
110
99
 
111
- Alternatively, pass multiple configurations as separate arguments:
112
-
113
- ```ts
114
- import { defineConfig } from "@jimmy.codes/eslint-config";
115
-
116
- export default defineConfig(
117
- {},
118
- {
119
- files: ["**/*.js"],
120
- rules: {
121
- "prefer-spread": "error",
122
- },
123
- },
124
- {
125
- files: ["**/*.ts"],
126
- rules: {
127
- "prefer-const": "error",
128
- },
129
- },
130
- );
131
- ```
132
-
133
- #### **Ignoring Files**
134
-
135
- Extend ignored files:
136
-
137
- ```ts
138
- import { defineConfig } from "@jimmy.codes/eslint-config";
100
+ ---
139
101
 
140
- export default defineConfig({
141
- ignores: ["**/*.mjs"],
142
- });
143
- ```
102
+ ## Plugins Used
103
+
104
+ This config includes the following plugins:
105
+
106
+ | Plugin | Purpose |
107
+ | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
108
+ | [`@eslint-community/eslint-plugin-eslint-comments`](https://eslint-community.github.io/eslint-plugin-eslint-comments) | ESLint directive comments |
109
+ | [`@eslint-react/eslint-plugin`](https://eslint-react.xyz/) | Modern React linting |
110
+ | [`@eslint/js`](https://eslint.org/docs/latest/rules/) | Core ESLint rules |
111
+ | [`@next/eslint-plugin-next`](https://nextjs.org/docs/basic-features/eslint) | Next.js best practices |
112
+ | [`@stylistic/eslint-plugin`](https://eslint.style/) | Consistent formatting |
113
+ | [`@tanstack/eslint-plugin-query`](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query) | TanStack Query rules |
114
+ | [`@vitest/eslint-plugin`](https://github.com/vitest-dev/eslint-plugin-vitest) | Vitest support |
115
+ | [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) | Disable formatting conflicts |
116
+ | [`eslint-plugin-astro`](https://ota-meshi.github.io/eslint-plugin-astro/) | Astro framework support |
117
+ | [`eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x) | Import order and hygiene |
118
+ | [`eslint-plugin-jest`](https://github.com/jest-community/eslint-plugin-jest) | Jest support |
119
+ | [`eslint-plugin-jest-dom`](https://github.com/testing-library/eslint-plugin-jest-dom) | DOM assertions for tests |
120
+ | [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc) | JSDoc comment rules |
121
+ | [`eslint-plugin-jsx-a11y`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) | Accessibility in JSX |
122
+ | [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n) | Node.js-specific rules |
123
+ | [`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist) | Sorting and consistency |
124
+ | [`eslint-plugin-playwright`](https://github.com/playwright-community/eslint-plugin-playwright) | Playwright testing support |
125
+ | [`eslint-plugin-react-compiler`](https://www.npmjs.com/package/eslint-plugin-react-compiler) | React Compiler rules |
126
+ | [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) | Enforce React Hooks rules |
127
+ | [`eslint-plugin-react-refresh`](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) | Safe Fast Refresh boundaries |
128
+ | [`eslint-plugin-regexp`](https://ota-meshi.github.io/eslint-plugin-regexp/) | RegExp best practices |
129
+ | [`eslint-plugin-storybook`](https://github.com/storybookjs/eslint-plugin-storybook) | Storybook support |
130
+ | [`eslint-plugin-testing-library`](https://github.com/testing-library/eslint-plugin-testing-library) | Testing Library rules |
131
+ | [`eslint-plugin-unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn) | Modern JavaScript best practices |
132
+ | [`typescript-eslint`](https://typescript-eslint.io/) | TypeScript linting and type safety |
144
133
 
145
134
  ---
146
135
 
147
- ## 💬 Want to Contribute or Suggest Changes?
136
+ ## Contributing
148
137
 
149
- PRs and discussions are welcome! Open an issue if you have suggestions.
138
+ PRs and issues welcome.
150
139
 
151
140
  ---
152
141
 
153
- ## ❤️ Credits
142
+ ## Credits
154
143
 
155
- This config is inspired by:
144
+ Inspired by:
156
145
 
157
146
  - [@antfu/eslint-config](https://github.com/antfu/eslint-config) by [Anthony Fu](https://antfu.me)
158
147
  - [@pvtnbr/eslint-config](https://github.com/privatenumber/eslint-config) by [Hiroki Osame](https://hirok.io)
@@ -1,5 +1,5 @@
1
- // src/utils/warnings-as-errors.ts
2
- var warningAsErrors = (rules = {}) => {
1
+ // src/utils/upwarn.ts
2
+ var upwarn = (rules = {}) => {
3
3
  return Object.fromEntries(
4
4
  Object.entries(rules).map(([rule, option]) => {
5
5
  return [rule, option === "warn" ? "error" : option];
@@ -8,5 +8,5 @@ var warningAsErrors = (rules = {}) => {
8
8
  };
9
9
 
10
10
  export {
11
- warningAsErrors
11
+ upwarn
12
12
  };