You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Traditional Configuration (ESLint 8.x, Next.js 14 or earlier)
53
+
54
+
To use the traditional configuration, you have several options:
55
+
56
+
#### Option 1: Via package.json
57
+
58
+
Add the `eslint` property to your `package.json` file:
28
59
29
60
```json
30
61
"eslintConfig": {
31
62
"extends": "@hypetech/eslint-config"
32
63
}
33
64
```
34
65
35
-
Instead of manually editing your `package.json`, you can also utilize the `npm pkg` subcommand:
66
+
You can use the `npm pkg` subcommand to add this automatically:
36
67
37
68
```bash
38
69
npm pkg set eslintConfig.extends=@hypetech/eslint-config
39
70
```
40
71
41
-
Alternatively, you can also create a `.eslintrc.cjs` file in your project root and add the following content:
72
+
#### Option 2: Via .eslintrc.js or .eslintrc.cjs
73
+
74
+
Create a `.eslintrc.js` file (or `.eslintrc.cjs` if your package uses `"type": "module"`) in your project root:
42
75
43
76
```js
44
77
module.exports= {
@@ -47,21 +80,136 @@ module.exports = {
47
80
}
48
81
```
49
82
50
-
> Notice: You should add configuration to your `package.json` if you are creating a library, and use a `.eslintrc.cjs` file if you are creating an application. And you should avoid both ways in the same project.
51
-
52
-
## Extending
83
+
#### Option 3: Extending the configuration
53
84
54
-
To extend the configuration, you will have to create a `.eslintrc.js`file (or `.eslintrc.cjs`if your package is a `"type": "module"`) and import the HypeTech configuration using `require`:
85
+
To customize the configuration, create a `.eslintrc.js` or `.eslintrc.cjs`file:
55
86
56
87
```js
57
88
module.exports= {
58
89
...require('@hypetech/eslint-config'),
59
90
rules: {
91
+
// Your custom rules here
60
92
'no-console':'warn',
61
93
},
62
94
}
63
95
```
64
96
97
+
> **Best Practice**: Use `package.json` for libraries and `.eslintrc.js`/`.eslintrc.cjs` for applications. Avoid using both methods in the same project.
98
+
99
+
### Flat Configuration (ESLint 9.x, Next.js 15 or later)
100
+
101
+
Next.js 15 uses ESLint 9 with the new flat configuration system. Here's how to use our flat config:
102
+
103
+
#### Option 1: Basic Usage
104
+
105
+
Create an `eslint.config.mjs` file in your project root:
If you have an existing `.eslintrc.js`, `.eslintrc.cjs`, or `eslintConfig` in your `package.json`, you can remove it or keep it for backward compatibility with tools that don't yet support the flat config system.
204
+
205
+
4. **Update your VS Code settings** (optional):
206
+
If you're using VS Code, update your settings to work with the new flat config:
207
+
```json
208
+
{
209
+
"eslint.experimental.useFlatConfig":true
210
+
}
211
+
```
212
+
65
213
# Contributing
66
214
67
215
Contributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.
0 commit comments