@bratislava/eslint-config-next 0.10.0 → 0.12.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 +114 -0
- package/index.js +1 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# @bratislava/eslint-config-next
|
|
2
|
+
|
|
3
|
+
ESLint configuration for Next.js frontend projects. Built for ESLint v9 flat config format.
|
|
4
|
+
|
|
5
|
+
Part of a monorepo of shareable ESLint configurations — see the [full repo](https://github.com/bratislava/eslint-config) for base, NestJS, and React variants.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save-dev @bratislava/eslint-config-next eslint typescript eslint-plugin-tailwindcss
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Create `eslint.config.mjs` in your project root:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import nextConfig from "@bratislava/eslint-config-next";
|
|
19
|
+
|
|
20
|
+
export default nextConfig;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or use the factory function for customization:
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
import { createNextConfig } from "@bratislava/eslint-config-next";
|
|
27
|
+
|
|
28
|
+
export default createNextConfig({
|
|
29
|
+
ignores: ["services/graphql/**"],
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Tailwind CSS
|
|
34
|
+
|
|
35
|
+
`eslint-plugin-tailwindcss` is a peer dependency — you install the version that matches your project's Tailwind version.
|
|
36
|
+
|
|
37
|
+
### Tailwind v3
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install --save-dev eslint-plugin-tailwindcss
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
No additional configuration needed — the preconfigured rules work out of the box with v3.
|
|
44
|
+
|
|
45
|
+
### Tailwind v4
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install --save-dev eslint-plugin-tailwindcss@beta
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The beta version might have issues — see the [v4 branch](https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/alpha/v4) for more info.
|
|
52
|
+
|
|
53
|
+
Tailwind v4 users must include the following settings in their `eslint.config.mjs`:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
// eslint.config.mjs
|
|
57
|
+
import { dirname } from "path";
|
|
58
|
+
import { fileURLToPath } from "url";
|
|
59
|
+
import { createNextConfig } from "@bratislava/eslint-config-next";
|
|
60
|
+
|
|
61
|
+
export default [
|
|
62
|
+
...createNextConfig(),
|
|
63
|
+
{
|
|
64
|
+
settings: {
|
|
65
|
+
tailwindcss: {
|
|
66
|
+
// The absolute path pointing to your main Tailwind CSS v4 config file.
|
|
67
|
+
// It must be a `.css` file (v4), not a `.js` file (v3)
|
|
68
|
+
// REQUIRED, default value will not help
|
|
69
|
+
cssConfigPath: dirname(fileURLToPath(import.meta.url)) + "/styles/tailwind.css",
|
|
70
|
+
|
|
71
|
+
// Optional, generally not needed in bratislava FE projects:
|
|
72
|
+
|
|
73
|
+
// Attributes/props that could contain Tailwind CSS classes...
|
|
74
|
+
// Optional, default values: ["class", "className", "ngClass", "@apply"]
|
|
75
|
+
// attributes: ["..."],
|
|
76
|
+
|
|
77
|
+
// Functions/tagFunctions that will be parsed by the plugin.
|
|
78
|
+
// Optional, default values: ["classnames", "clsx", "ctl", "cva", "tv", "tw"]
|
|
79
|
+
// functions: ["..."]
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Additionally, v4 requires an empty `tailwind.config.js` at the project root, otherwise the plugin throws "Cannot resolve default tailwindcss config path" warnings. See [this issue](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/431) for details.
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
// tailwind.config.js
|
|
90
|
+
export default {};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## What's Included
|
|
94
|
+
|
|
95
|
+
Everything from `@bratislava/eslint-config` (base), plus:
|
|
96
|
+
|
|
97
|
+
- **Next.js** plugin with recommended and Core Web Vitals rules
|
|
98
|
+
- **React** plugin with recommended rules
|
|
99
|
+
- **React Hooks** plugin
|
|
100
|
+
- **JSX A11y** accessibility rules
|
|
101
|
+
- **TanStack Query** plugin
|
|
102
|
+
- **Tailwind CSS** class linting
|
|
103
|
+
- **i18next** internationalization rules
|
|
104
|
+
- Browser and Node.js globals
|
|
105
|
+
|
|
106
|
+
## Peer Dependencies
|
|
107
|
+
|
|
108
|
+
- `eslint` >= 9
|
|
109
|
+
- `eslint-plugin-tailwindcss` >= 3.18.3 or >= 4.0.0-0 (beta)
|
|
110
|
+
- `typescript` >= 5
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
EUPL-1.2
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bratislava/eslint-config-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "ESLint configuration for Next.js frontend projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"eslint": ">= 9",
|
|
31
|
+
"eslint-plugin-tailwindcss": ">= 3.18.3 || >= 4.0.0-0",
|
|
31
32
|
"typescript": ">= 5"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@bratislava/eslint-config": "0.
|
|
35
|
+
"@bratislava/eslint-config": "0.12.0",
|
|
35
36
|
"@next/eslint-plugin-next": "15.5.2",
|
|
36
37
|
"@tanstack/eslint-plugin-query": "5.91.2",
|
|
37
38
|
"eslint-plugin-i18next": "6.1.3",
|
|
38
39
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
39
40
|
"eslint-plugin-react": "7.37.5",
|
|
40
41
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
41
|
-
"eslint-plugin-tailwindcss": "3.18.2",
|
|
42
42
|
"globals": "16.5.0"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|