@dauphaihau/eslint-config 0.3.0 → 0.3.2
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 +8 -19
- package/dist/index.js +24 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,25 +11,20 @@
|
|
|
11
11
|
npm i -D @dauphaihau/eslint-config
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
|
|
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
|
-
|
|
20
|
+
# Vue
|
|
23
21
|
npm i -D eslint-plugin-vue vue-eslint-parser
|
|
24
|
-
```
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```bash
|
|
23
|
+
# Tailwind CSS
|
|
29
24
|
npm i -D eslint-plugin-tailwindcss
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
|
|
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
|
|
55
|
+
Normally the default preset is enough:
|
|
61
56
|
|
|
62
57
|
```js
|
|
63
|
-
|
|
64
|
-
|
|
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
|
@@ -297,7 +297,8 @@ function baseConfig(options = {}) {
|
|
|
297
297
|
"?": "before",
|
|
298
298
|
"|": "before",
|
|
299
299
|
":": "before",
|
|
300
|
-
"||": "before"
|
|
300
|
+
"||": "before",
|
|
301
|
+
"&&": "before"
|
|
301
302
|
}
|
|
302
303
|
}],
|
|
303
304
|
"@stylistic/dot-location": ["error", "property"],
|
|
@@ -818,38 +819,37 @@ import checkFile from "eslint-plugin-check-file";
|
|
|
818
819
|
function fileNamesConfig(options = {}) {
|
|
819
820
|
const allFiles = strategyManager.getSourceFiles(options);
|
|
820
821
|
const tsxFiles = strategyManager.getComponentFiles(options);
|
|
821
|
-
|
|
822
|
+
const vueFiles = strategyManager.getVueFiles(options);
|
|
823
|
+
const kebabCaseRule = {
|
|
824
|
+
"check-file/filename-naming-convention": [
|
|
825
|
+
"error",
|
|
826
|
+
{ "**/*": "KEBAB_CASE" },
|
|
827
|
+
{ ignoreMiddleExtensions: true }
|
|
828
|
+
]
|
|
829
|
+
};
|
|
830
|
+
const configs = [
|
|
822
831
|
{
|
|
823
832
|
name: "dauphaihau/file-names",
|
|
824
833
|
files: allFiles,
|
|
825
|
-
plugins: {
|
|
826
|
-
|
|
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
|
-
}
|
|
834
|
+
plugins: { "check-file": checkFile },
|
|
835
|
+
rules: kebabCaseRule
|
|
836
836
|
},
|
|
837
|
-
// TSX/JSX files: Allow PascalCase for React components (e.g., MyComponent.tsx)
|
|
838
837
|
{
|
|
839
838
|
name: "dauphaihau/file-names-tsx",
|
|
840
839
|
files: tsxFiles,
|
|
841
|
-
plugins: {
|
|
842
|
-
|
|
843
|
-
},
|
|
844
|
-
rules: {
|
|
845
|
-
"check-file/filename-naming-convention": [
|
|
846
|
-
"error",
|
|
847
|
-
{ "**/*": "PASCAL_CASE" },
|
|
848
|
-
{ ignoreMiddleExtensions: true }
|
|
849
|
-
]
|
|
850
|
-
}
|
|
840
|
+
plugins: { "check-file": checkFile },
|
|
841
|
+
rules: kebabCaseRule
|
|
851
842
|
}
|
|
852
843
|
];
|
|
844
|
+
if (vueFiles.length > 0) {
|
|
845
|
+
configs.push({
|
|
846
|
+
name: "dauphaihau/file-names-vue",
|
|
847
|
+
files: vueFiles,
|
|
848
|
+
plugins: { "check-file": checkFile },
|
|
849
|
+
rules: kebabCaseRule
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
return configs;
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
// src/builder.ts
|