@viclafouch/eslint-config-viclafouch 4.22.1-beta.0 → 4.22.1-beta.1

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
@@ -18,13 +18,14 @@ These are the ESLint and Prettier settings for a Next.js project ⚡️
18
18
  - [If you want to enable imports sorting](#if-you-want-to-enable-imports-sorting)
19
19
  - [If you use Next.js](#if-you-use-nextjs)
20
20
  - [If you use React.js](#if-you-use-reactjs)
21
+ - [If you use Tailwind CSS v4](#if-you-use-tailwind-css-v4)
21
22
  - [If you want to use Prettier](#if-you-want-to-use-prettier)
22
23
  - [If you use VS Code](#if-you-use-vs-code)
23
24
 
24
25
  ## What it does
25
26
 
26
27
  * Lints JavaScript / TypeScript based on the latest standards
27
- * Multiple configs `react` `hooks` `next`..
28
+ * Multiple configs `react` `hooks` `next` `tailwindcss`..
28
29
  * Shared `tsconfig.json`
29
30
  * Fixes issues and formatting errors with Prettier
30
31
  * Check for accessibility rules on JSX elements.
@@ -195,6 +196,26 @@ export default [
195
196
  ]
196
197
  ```
197
198
 
199
+ ## If you use Tailwind CSS v4
200
+
201
+ You can add linting rules for Tailwind CSS v4 using `eslint-plugin-better-tailwindcss`. You need to provide the path to your CSS entry file via the `entryPoint` option.
202
+
203
+ ```js
204
+ import { baseConfig, betterTailwindcssConfig } from '@viclafouch/eslint-config-viclafouch'
205
+
206
+ /**
207
+ * @type {import("eslint").Linter.Config}
208
+ */
209
+ export default [
210
+ ...baseConfig,
211
+ ...betterTailwindcssConfig({
212
+ entryPoint: 'src/global.css'
213
+ }),
214
+ {
215
+ ignores: ['**/node_modules/**']
216
+ }
217
+ ]
218
+ ```
198
219
 
199
220
  ## If you want to use Prettier
200
221
 
@@ -0,0 +1,32 @@
1
+ import betterTailwindcss from 'eslint-plugin-better-tailwindcss'
2
+
3
+ /**
4
+ * @typedef {Object} BetterTailwindcssOptions
5
+ * @property {string} entryPoint - Path to the CSS entry file (Tailwind v4)
6
+ */
7
+
8
+ /**
9
+ * Creates ESLint flat config for eslint-plugin-better-tailwindcss (Tailwind v4)
10
+ * @param {BetterTailwindcssOptions} options
11
+ * @returns {import("eslint").Linter.Config[]}
12
+ */
13
+ export default function betterTailwindcssConfig({ entryPoint }) {
14
+ const recommendedRules = betterTailwindcss.configs?.recommended?.rules ?? {}
15
+
16
+ return [
17
+ {
18
+ files: ['**/*.{js,jsx,ts,tsx}'],
19
+ plugins: {
20
+ 'better-tailwindcss': betterTailwindcss
21
+ },
22
+ settings: {
23
+ 'better-tailwindcss': {
24
+ entryPoint
25
+ }
26
+ },
27
+ rules: {
28
+ ...recommendedRules
29
+ }
30
+ }
31
+ ]
32
+ }
package/index.d.ts CHANGED
@@ -7,3 +7,12 @@ export declare const nextConfig: Linter.Config[]
7
7
  export declare const prettierConfig: Linter.Config[]
8
8
  export declare const hooksConfig: Linter.Config[]
9
9
  export declare const importsConfig: Linter.Config[]
10
+
11
+ export interface BetterTailwindcssOptions {
12
+ /** Path to the CSS entry file (Tailwind v4) */
13
+ entryPoint: string
14
+ }
15
+
16
+ export declare function betterTailwindcssConfig(
17
+ options: BetterTailwindcssOptions
18
+ ): Linter.Config[]
package/index.mjs CHANGED
@@ -5,3 +5,4 @@ export { default as nextConfig } from './next.mjs'
5
5
  export { default as prettierConfig } from './prettier.mjs'
6
6
  export { default as hooksConfig } from './hooks.mjs'
7
7
  export { default as importsConfig } from './imports.mjs'
8
+ export { default as betterTailwindcssConfig } from './better-tailwindcss.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viclafouch/eslint-config-viclafouch",
3
- "version": "4.22.1-beta.0",
3
+ "version": "4.22.1-beta.1",
4
4
  "description": "ESLint and Prettier Config from Victor de la Fouchardiere",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
@@ -45,23 +45,24 @@
45
45
  "@total-typescript/ts-reset": "^0.6.1",
46
46
  "app-root-path": "^3.1.0",
47
47
  "babel-loader": "^10.0.0",
48
+ "eslint": ">= 9",
48
49
  "eslint-config-prettier": "^10.1.1",
50
+ "eslint-plugin-better-tailwindcss": "^3.8.0",
49
51
  "eslint-plugin-import": "^2.31.0",
50
52
  "eslint-plugin-jsx-a11y": "^6.10.2",
51
53
  "eslint-plugin-prettier": "^5.2.3",
52
54
  "eslint-plugin-promise": "^7.2.1",
53
55
  "eslint-plugin-react": "^7.37.4",
54
56
  "eslint-plugin-react-hooks": "^5.2.0",
55
- "eslint-plugin-unicorn": "^58.0.0",
56
57
  "eslint-plugin-simple-import-sort": "^12.1.1",
57
58
  "eslint-plugin-testing-library": "^7.1.1",
59
+ "eslint-plugin-unicorn": "^58.0.0",
58
60
  "get-tsconfig": "^4.10.0",
59
61
  "globals": "^16.0.0",
60
62
  "prettier": ">= 3",
61
63
  "prettier-plugin-curly": "^0.3.1",
62
64
  "typescript": ">= 5",
63
- "typescript-eslint": "^8.26.0",
64
- "eslint": ">= 9"
65
+ "typescript-eslint": "^8.26.0"
65
66
  },
66
67
  "scripts": {
67
68
  "lint": "eslint .",