@bratislava/eslint-config-next 0.11.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 +81 -0
- package/index.js +6 -3
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
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-better-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-better-tailwindcss` is a peer dependency. It supports both Tailwind v3 and v4 without separate beta versions.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install --save-dev eslint-plugin-better-tailwindcss
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
No additional configuration needed — the recommended ruleset works out of the box.
|
|
42
|
+
|
|
43
|
+
## Prettier
|
|
44
|
+
|
|
45
|
+
`prettierBase` is re-exported from this package. Spread it in your `prettier.config.mjs` and add project-specific options:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// prettier.config.mjs
|
|
49
|
+
import { prettierBase } from '@bratislava/eslint-config-next'
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
...prettierBase,
|
|
53
|
+
plugins: ['prettier-plugin-tailwindcss'],
|
|
54
|
+
tailwindFunctions: ['clsx', 'cn'],
|
|
55
|
+
// project-specific:
|
|
56
|
+
tailwindStylesheet: './src/pages/globals.css',
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## What's Included
|
|
61
|
+
|
|
62
|
+
Everything from `@bratislava/eslint-config` (base), plus:
|
|
63
|
+
|
|
64
|
+
- **Next.js** plugin with recommended and Core Web Vitals rules
|
|
65
|
+
- **React** plugin with recommended rules
|
|
66
|
+
- **React Hooks** plugin
|
|
67
|
+
- **JSX A11y** accessibility rules
|
|
68
|
+
- **TanStack Query** plugin
|
|
69
|
+
- **Tailwind CSS** class linting
|
|
70
|
+
- **i18next** internationalization rules
|
|
71
|
+
- Browser and Node.js globals
|
|
72
|
+
|
|
73
|
+
## Peer Dependencies
|
|
74
|
+
|
|
75
|
+
- `eslint` >= 9
|
|
76
|
+
- `eslint-plugin-better-tailwindcss` >= 4.0.0
|
|
77
|
+
- `typescript` >= 5
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
EUPL-1.2
|
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,6 +149,7 @@ export function createNextConfig(options = {}) {
|
|
|
147
149
|
...frontendRules,
|
|
148
150
|
...reactRules,
|
|
149
151
|
...nextRules,
|
|
152
|
+
|
|
150
153
|
"sonarjs/different-types-comparison": "off", // TODO consider removing
|
|
151
154
|
},
|
|
152
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,17 +28,17 @@
|
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"eslint": ">= 9",
|
|
31
|
+
"eslint-plugin-better-tailwindcss": ">= 4.0.0",
|
|
31
32
|
"typescript": ">= 5"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@bratislava/eslint-config": "0.
|
|
35
|
+
"@bratislava/eslint-config": "0.14.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": {
|