@dauphaihau/eslint-config 0.2.2 → 0.2.3
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 +12 -1
- package/dist/index.js +11 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,6 +11,18 @@
|
|
|
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:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm i -D eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-refresh
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If your project uses Tailwind CSS, install the Tailwind ESLint plugin as well:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm i -D eslint-plugin-tailwindcss
|
|
24
|
+
```
|
|
25
|
+
|
|
14
26
|
And create `eslint.config.mjs` in your project root:
|
|
15
27
|
|
|
16
28
|
```js
|
|
@@ -77,4 +89,3 @@ export default defineConfig([
|
|
|
77
89
|
## License
|
|
78
90
|
|
|
79
91
|
MIT
|
|
80
|
-
|
package/dist/index.js
CHANGED
|
@@ -551,9 +551,11 @@ async function reactConfig(options = {}) {
|
|
|
551
551
|
}
|
|
552
552
|
|
|
553
553
|
// src/configs/tailwind.ts
|
|
554
|
+
import fs2 from "fs";
|
|
555
|
+
var tailwindConfigFile = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs", "tailwind.config.cjs"].find((f) => fs2.existsSync(f));
|
|
554
556
|
async function tailwindConfig(options = {}) {
|
|
555
557
|
const tailwindFiles = strategyManager.getTailwindFiles(options);
|
|
556
|
-
if (tailwindFiles.length === 0) {
|
|
558
|
+
if (tailwindFiles.length === 0 || !tailwindConfigFile) {
|
|
557
559
|
return [];
|
|
558
560
|
}
|
|
559
561
|
const { default: tailwind } = await import("eslint-plugin-tailwindcss");
|
|
@@ -564,9 +566,8 @@ async function tailwindConfig(options = {}) {
|
|
|
564
566
|
plugins: { tailwindcss: tailwind },
|
|
565
567
|
settings: {
|
|
566
568
|
tailwindcss: {
|
|
567
|
-
|
|
569
|
+
config: tailwindConfigFile,
|
|
568
570
|
callees: ["classnames", "clsx", "ctl", "cva", "cx", "cn"],
|
|
569
|
-
// Support tagged template literals: tw`bg-blue-500`
|
|
570
571
|
tags: ["tw"]
|
|
571
572
|
}
|
|
572
573
|
},
|
|
@@ -989,13 +990,13 @@ var ESLintConfigBuilder = class {
|
|
|
989
990
|
};
|
|
990
991
|
|
|
991
992
|
// src/index.ts
|
|
992
|
-
import
|
|
993
|
-
var hasTsConfig =
|
|
993
|
+
import fs3 from "fs";
|
|
994
|
+
var hasTsConfig = fs3.existsSync("tsconfig.json") || fs3.existsSync("tsconfig.base.json");
|
|
994
995
|
var hasReact = () => {
|
|
995
996
|
try {
|
|
996
997
|
const packageJsonPath = "package.json";
|
|
997
|
-
if (
|
|
998
|
-
const packageJson = JSON.parse(
|
|
998
|
+
if (fs3.existsSync(packageJsonPath)) {
|
|
999
|
+
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
|
|
999
1000
|
const deps = {
|
|
1000
1001
|
...packageJson.dependencies,
|
|
1001
1002
|
...packageJson.devDependencies,
|
|
@@ -1010,8 +1011,8 @@ var hasReact = () => {
|
|
|
1010
1011
|
var hasTailwind = () => {
|
|
1011
1012
|
try {
|
|
1012
1013
|
const packageJsonPath = "package.json";
|
|
1013
|
-
if (
|
|
1014
|
-
const packageJson = JSON.parse(
|
|
1014
|
+
if (fs3.existsSync(packageJsonPath)) {
|
|
1015
|
+
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
|
|
1015
1016
|
const deps = {
|
|
1016
1017
|
...packageJson.dependencies,
|
|
1017
1018
|
...packageJson.devDependencies,
|
|
@@ -1021,7 +1022,7 @@ var hasTailwind = () => {
|
|
|
1021
1022
|
}
|
|
1022
1023
|
} catch {
|
|
1023
1024
|
}
|
|
1024
|
-
return
|
|
1025
|
+
return fs3.existsSync("tailwind.config.js") || fs3.existsSync("tailwind.config.ts") || fs3.existsSync("tailwind.config.mjs") || fs3.existsSync("tailwind.config.cjs");
|
|
1025
1026
|
};
|
|
1026
1027
|
function eslintConfig(options = {}) {
|
|
1027
1028
|
const finalOptions = {
|