@bratislava/eslint-config-next 0.12.0 → 0.14.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 +17 -50
- package/index.js +6 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Part of a monorepo of shareable ESLint configurations — see the [full repo](ht
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install --save-dev @bratislava/eslint-config-next eslint typescript eslint-plugin-tailwindcss
|
|
10
|
+
npm install --save-dev @bratislava/eslint-config-next eslint typescript eslint-plugin-better-tailwindcss
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
@@ -32,62 +32,29 @@ export default createNextConfig({
|
|
|
32
32
|
|
|
33
33
|
## Tailwind CSS
|
|
34
34
|
|
|
35
|
-
`eslint-plugin-tailwindcss` is a peer dependency
|
|
36
|
-
|
|
37
|
-
### Tailwind v3
|
|
35
|
+
`eslint-plugin-better-tailwindcss` is a peer dependency. It supports both Tailwind v3 and v4 without separate beta versions.
|
|
38
36
|
|
|
39
37
|
```bash
|
|
40
|
-
npm install --save-dev eslint-plugin-tailwindcss
|
|
38
|
+
npm install --save-dev eslint-plugin-better-tailwindcss
|
|
41
39
|
```
|
|
42
40
|
|
|
43
|
-
No additional configuration needed — the
|
|
44
|
-
|
|
45
|
-
### Tailwind v4
|
|
41
|
+
No additional configuration needed — the recommended ruleset works out of the box.
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
npm install --save-dev eslint-plugin-tailwindcss@beta
|
|
49
|
-
```
|
|
43
|
+
## Prettier
|
|
50
44
|
|
|
51
|
-
|
|
45
|
+
`prettierBase` is re-exported from this package. Spread it in your `prettier.config.mjs` and add project-specific options:
|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
```js
|
|
48
|
+
// prettier.config.mjs
|
|
49
|
+
import { prettierBase } from '@bratislava/eslint-config-next'
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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 {};
|
|
51
|
+
export default {
|
|
52
|
+
...prettierBase,
|
|
53
|
+
plugins: ['prettier-plugin-tailwindcss'],
|
|
54
|
+
tailwindFunctions: ['clsx', 'cn'],
|
|
55
|
+
// project-specific:
|
|
56
|
+
tailwindStylesheet: './src/pages/globals.css',
|
|
57
|
+
}
|
|
91
58
|
```
|
|
92
59
|
|
|
93
60
|
## What's Included
|
|
@@ -106,7 +73,7 @@ Everything from `@bratislava/eslint-config` (base), plus:
|
|
|
106
73
|
## Peer Dependencies
|
|
107
74
|
|
|
108
75
|
- `eslint` >= 9
|
|
109
|
-
- `eslint-plugin-tailwindcss` >=
|
|
76
|
+
- `eslint-plugin-better-tailwindcss` >= 4.0.0
|
|
110
77
|
- `typescript` >= 5
|
|
111
78
|
|
|
112
79
|
## License
|
package/index.js
CHANGED
|
@@ -5,16 +5,18 @@
|
|
|
5
5
|
* Extends base config with Next.js, React, and i18n-specific rules.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { baseConfig } from "@bratislava/eslint-config";
|
|
8
|
+
import { baseConfig, prettierBase } from "@bratislava/eslint-config";
|
|
9
9
|
import nextPlugin from "@next/eslint-plugin-next";
|
|
10
10
|
import tanstackQuery from "@tanstack/eslint-plugin-query";
|
|
11
11
|
import i18next from "eslint-plugin-i18next";
|
|
12
12
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
13
13
|
import react from "eslint-plugin-react";
|
|
14
14
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
15
|
-
import
|
|
15
|
+
import betterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
16
16
|
import globals from "globals";
|
|
17
17
|
|
|
18
|
+
export { prettierBase };
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* React-specific rules overrides
|
|
20
22
|
*/
|
|
@@ -139,7 +141,7 @@ export function createNextConfig(options = {}) {
|
|
|
139
141
|
// Next.js specific configs
|
|
140
142
|
i18next.configs["flat/recommended"],
|
|
141
143
|
...tanstackQuery.configs["flat/recommended"],
|
|
142
|
-
|
|
144
|
+
betterTailwindcss.configs.recommended,
|
|
143
145
|
|
|
144
146
|
// Frontend rules and overrides
|
|
145
147
|
{
|
|
@@ -147,7 +149,7 @@ export function createNextConfig(options = {}) {
|
|
|
147
149
|
...frontendRules,
|
|
148
150
|
...reactRules,
|
|
149
151
|
...nextRules,
|
|
150
|
-
|
|
152
|
+
|
|
151
153
|
"sonarjs/different-types-comparison": "off", // TODO consider removing
|
|
152
154
|
},
|
|
153
155
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bratislava/eslint-config-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "ESLint configuration for Next.js frontend projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"eslint": ">= 9",
|
|
31
|
-
"eslint-plugin-tailwindcss": ">=
|
|
31
|
+
"eslint-plugin-better-tailwindcss": ">= 4.0.0",
|
|
32
32
|
"typescript": ">= 5"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@bratislava/eslint-config": "0.
|
|
35
|
+
"@bratislava/eslint-config": "0.14.0",
|
|
36
36
|
"@next/eslint-plugin-next": "15.5.2",
|
|
37
37
|
"@tanstack/eslint-plugin-query": "5.91.2",
|
|
38
38
|
"eslint-plugin-i18next": "6.1.3",
|