@zjutjh/eslint-config 0.1.0 → 0.1.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/dist/index.js +11 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,7 +36,6 @@ function javascript() {
|
|
|
36
36
|
"no-warning-comments": "warn",
|
|
37
37
|
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
38
38
|
"no-var": "error",
|
|
39
|
-
// TODO:
|
|
40
39
|
"no-undef": "off",
|
|
41
40
|
"prefer-const": "warn"
|
|
42
41
|
}
|
|
@@ -95,9 +94,20 @@ async function interopDefault(m) {
|
|
|
95
94
|
const resolved = await m;
|
|
96
95
|
return resolved.default || resolved;
|
|
97
96
|
}
|
|
97
|
+
async function ensurePackages(packages) {
|
|
98
|
+
const nonExistingPackages = packages.filter((i) => i && !isPackageExists(i));
|
|
99
|
+
if (nonExistingPackages.length !== 0) {
|
|
100
|
+
const message = `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}.`;
|
|
101
|
+
throw new Error(message);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
98
104
|
|
|
99
105
|
// src/configs/vue.ts
|
|
100
106
|
async function vue(options) {
|
|
107
|
+
await ensurePackages([
|
|
108
|
+
"eslint-plugin-vue",
|
|
109
|
+
"vue-eslint-parser"
|
|
110
|
+
]);
|
|
101
111
|
const [
|
|
102
112
|
pluginVue,
|
|
103
113
|
parserVue
|