@dauphaihau/eslint-config 0.3.0 → 0.3.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.
Files changed (3) hide show
  1. package/README.md +8 -19
  2. package/dist/index.js +22 -23
  3. package/package.json +15 -14
package/README.md CHANGED
@@ -11,25 +11,20 @@
11
11
  npm i -D @dauphaihau/eslint-config
12
12
  ```
13
13
 
14
- If your project uses React, install the React ESLint plugins as well:
14
+ Install extra plugins only if your project uses them:
15
15
 
16
16
  ```bash
17
+ # React
17
18
  npm i -D eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-refresh
18
- ```
19
-
20
- If your project uses Vue, install the Vue ESLint plugins as well:
21
19
 
22
- ```bash
20
+ # Vue
23
21
  npm i -D eslint-plugin-vue vue-eslint-parser
24
- ```
25
22
 
26
- If your project uses Tailwind CSS, install the Tailwind ESLint plugin as well:
27
-
28
- ```bash
23
+ # Tailwind CSS
29
24
  npm i -D eslint-plugin-tailwindcss
30
25
  ```
31
26
 
32
- And create `eslint.config.mjs` in your project root:
27
+ Create `eslint.config.mjs` in your project root:
33
28
 
34
29
  ```js
35
30
  // eslint.config.mjs
@@ -57,17 +52,11 @@ For example:
57
52
  ## Usage
58
53
 
59
54
  ### Basic
60
- Normally you only need to import the dauphaihauConfig preset:
55
+ Normally the default preset is enough:
61
56
 
62
57
  ```js
63
- // eslint.config.js
64
- import dauphaihauConfig from '@dauphaihau/eslint-config'
65
- import { defineConfig } from 'eslint/config'
66
-
67
- export default defineConfig([
68
- ...(await dauphaihauConfig())
69
- ])
70
- ```
58
+ export default defineConfig([...(await dauphaihauConfig())])
59
+ ```
71
60
 
72
61
  ### Customize
73
62
 
package/dist/index.js CHANGED
@@ -818,38 +818,37 @@ import checkFile from "eslint-plugin-check-file";
818
818
  function fileNamesConfig(options = {}) {
819
819
  const allFiles = strategyManager.getSourceFiles(options);
820
820
  const tsxFiles = strategyManager.getComponentFiles(options);
821
- return [
821
+ const vueFiles = strategyManager.getVueFiles(options);
822
+ const kebabCaseRule = {
823
+ "check-file/filename-naming-convention": [
824
+ "error",
825
+ { "**/*": "KEBAB_CASE" },
826
+ { ignoreMiddleExtensions: true }
827
+ ]
828
+ };
829
+ const configs = [
822
830
  {
823
831
  name: "dauphaihau/file-names",
824
832
  files: allFiles,
825
- plugins: {
826
- "check-file": checkFile
827
- },
828
- rules: {
829
- // Enforce kebab-case for regular files
830
- "check-file/filename-naming-convention": [
831
- "error",
832
- { "**/*": "KEBAB_CASE" },
833
- { ignoreMiddleExtensions: true }
834
- ]
835
- }
833
+ plugins: { "check-file": checkFile },
834
+ rules: kebabCaseRule
836
835
  },
837
- // TSX/JSX files: Allow PascalCase for React components (e.g., MyComponent.tsx)
838
836
  {
839
837
  name: "dauphaihau/file-names-tsx",
840
838
  files: tsxFiles,
841
- plugins: {
842
- "check-file": checkFile
843
- },
844
- rules: {
845
- "check-file/filename-naming-convention": [
846
- "error",
847
- { "**/*": "PASCAL_CASE" },
848
- { ignoreMiddleExtensions: true }
849
- ]
850
- }
839
+ plugins: { "check-file": checkFile },
840
+ rules: kebabCaseRule
851
841
  }
852
842
  ];
843
+ if (vueFiles.length > 0) {
844
+ configs.push({
845
+ name: "dauphaihau/file-names-vue",
846
+ files: vueFiles,
847
+ plugins: { "check-file": checkFile },
848
+ rules: kebabCaseRule
849
+ });
850
+ }
851
+ return configs;
853
852
  }
854
853
 
855
854
  // src/builder.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dauphaihau/eslint-config",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,6 +11,19 @@
11
11
  "dist",
12
12
  "README.md"
13
13
  ],
14
+ "scripts": {
15
+ "build": "pnpm exec tsup src/index.ts --dts --format esm --external @eslint/js --external @stylistic/eslint-plugin --external typescript-eslint --external eslint-plugin-check-file --external eslint-plugin-react --external eslint-plugin-react-hooks --external eslint-plugin-react-refresh --external eslint-plugin-tailwindcss --external eslint-plugin-vue --external vue-eslint-parser",
16
+ "prepublishOnly": "pnpm build",
17
+ "lint": "eslint .",
18
+ "lint:fix": "eslint . --fix",
19
+ "test": "vitest run",
20
+ "typecheck": "tsc --noEmit",
21
+ "version:patch": "pnpm build && pnpm version patch",
22
+ "version:minor": "pnpm build && pnpm version minor",
23
+ "version:major": "pnpm build && pnpm version major",
24
+ "push:tags": "git push --follow-tags",
25
+ "ship": "pnpm publish --no-git-checks"
26
+ },
14
27
  "dependencies": {
15
28
  "@eslint/js": "^10.0.0",
16
29
  "@stylistic/eslint-plugin": "^5.9.0",
@@ -55,17 +68,5 @@
55
68
  "tsup": "^8.0.0",
56
69
  "typescript": "^5.4.0",
57
70
  "vitest": "^3.2.4"
58
- },
59
- "scripts": {
60
- "build": "pnpm exec tsup src/index.ts --dts --format esm --external @eslint/js --external @stylistic/eslint-plugin --external typescript-eslint --external eslint-plugin-check-file --external eslint-plugin-react --external eslint-plugin-react-hooks --external eslint-plugin-react-refresh --external eslint-plugin-tailwindcss --external eslint-plugin-vue --external vue-eslint-parser",
61
- "lint": "eslint .",
62
- "lint:fix": "eslint . --fix",
63
- "test": "vitest run",
64
- "typecheck": "tsc --noEmit",
65
- "version:patch": "pnpm build && pnpm version patch",
66
- "version:minor": "pnpm build && pnpm version minor",
67
- "version:major": "pnpm build && pnpm version major",
68
- "push:tags": "git push --follow-tags",
69
- "ship": "pnpm publish --no-git-checks"
70
71
  }
71
- }
72
+ }