Skip to content

Commit 27c46b3

Browse files
authoredAug 22, 2023
feat: auto JS fallback (#89)
1 parent c12e65d commit 27c46b3

File tree

5 files changed

+43
-12
lines changed

5 files changed

+43
-12
lines changed
 

Diff for: ‎packages/eslint-config-solid/index.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
// @ts-check
22
const { defineConfig } = require("eslint-define-config");
3+
const { isPackageExists } = require("local-pkg");
4+
5+
const TS = isPackageExists("typescript");
6+
7+
if (!TS) {
8+
console.warn(
9+
"[@so1ve/eslint-config-solid] TypeScript is not installed, fallback to JS only.",
10+
);
11+
}
312

413
module.exports = defineConfig({
514
extends: [
6-
"@so1ve/eslint-config-ts",
7-
"plugin:solid/typescript",
15+
...(TS
16+
? ["@so1ve/eslint-config-ts", "plugin:solid/typescript"]
17+
: ["@so1ve/eslint-config-basic"]),
818
"plugin:solid/recommended",
919
],
1020
});

Diff for: ‎packages/eslint-config-solid/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@
2929
"lint": "eslint . --config=index.js"
3030
},
3131
"dependencies": {
32+
"@so1ve/eslint-config-basic": "workspace:*",
3233
"@so1ve/eslint-config-ts": "workspace:*",
3334
"eslint-define-config": "^1.21.0",
34-
"eslint-plugin-solid": "^0.12.1"
35-
},
36-
"devDependencies": {
37-
"typescript": "^5.1.6"
35+
"eslint-plugin-solid": "^0.12.1",
36+
"local-pkg": "^0.4.3"
3837
},
3938
"peerDependencies": {
4039
"eslint": ">=8.40.0",

Diff for: ‎packages/eslint-config-vue/index.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
// @ts-check
22
const { defineConfig } = require("eslint-define-config");
3+
const { isPackageExists } = require("local-pkg");
4+
5+
const TS = isPackageExists("typescript");
6+
7+
if (!TS) {
8+
console.warn(
9+
"[@so1ve/eslint-config] TypeScript is not installed, fallback to JS only.",
10+
);
11+
}
312

413
module.exports = defineConfig({
514
overrides: [
@@ -16,7 +25,10 @@ module.exports = defineConfig({
1625
},
1726
},
1827
],
19-
extends: ["plugin:vue/recommended", "@so1ve/eslint-config-ts"],
28+
extends: [
29+
"plugin:vue/recommended",
30+
TS ? "@so1ve/eslint-config-ts" : "@so1ve/eslint-config-basic",
31+
],
2032
rules: {
2133
"vue/no-v-html": "off",
2234
"vue/require-prop-types": "off",

Diff for: ‎packages/eslint-config-vue/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
"access": "public"
2727
},
2828
"dependencies": {
29+
"@so1ve/eslint-config-basic": "workspace:*",
2930
"@so1ve/eslint-config-ts": "workspace:*",
3031
"eslint-define-config": "^1.21.0",
31-
"eslint-plugin-vue": "^9.16.0"
32+
"eslint-plugin-vue": "^9.16.0",
33+
"local-pkg": "^0.4.3"
3234
},
3335
"peerDependencies": {
3436
"eslint": ">=8.40.0",

Diff for: ‎pnpm-lock.yaml

+12-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.