@eslint-sets/eslint-config-vue3
Version:
Eslint config sets for vue3.0
111 lines (108 loc) • 3.27 kB
JavaScript
/*!
* @eslint-sets/eslint-config-vue3 v5.14.0
* Eslint config sets for vue3.0
* (c) 2021-2024 saqqdy<https://github.com/saqqdy>
* Released under the MIT License.
*/
import { isPackageExists } from 'local-pkg';
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
const tsExits = isPackageExists("typescript");
if (!tsExits)
console.warn("[@eslint-sets/eslint-config] TypeScript is not installed, fallback to JS only.");
const config = {
plugins: [
tsExits ? "tsdoc" : "jsdoc",
"prettier"
// 'import'
],
extends: [
tsExits ? "plugin:@typescript-eslint/recommended" : "plugin:jsdoc/recommended",
"plugin:vue-scoped-css/vue3-recommended",
"plugin:vue/vue3-recommended",
tsExits ? "@eslint-sets/eslint-config-ts" : "@eslint-sets/eslint-config-basic",
"plugin:vitest-globals/recommended",
"prettier"
],
rules: {
"vue/max-attributes-per-line": "off",
"vue/no-v-html": "off",
"vue/require-default-prop": "off",
"vue/require-explicit-emits": "off",
"vue/multi-word-component-names": "off",
// 'prettier/prettier': 'error',
"vue/component-tags-order": [
"error",
{
order: ["template", "script", "style"]
}
],
"vue-scoped-css/enforce-style-type": ["error", { allows: ["scoped", "module"] }]
},
globals: {
h: true,
jest: "readonly",
defineProps: "readonly",
defineEmits: "readonly",
defineExpose: "readonly",
withDefaults: "readonly",
$ref: "readonly",
$computed: "readonly",
$shallowRef: "readonly",
$customRef: "readonly",
$toRef: "readonly"
},
overrides: [
{
files: ["**/__tests__/*.{j,t}s?(x)", "**/*.spec.{j,t}s?(x)"],
env: {
mocha: true,
jest: true,
"vitest-globals/env": true
},
rules: {
"no-console": "off",
"vue/one-component-per-file": "off"
}
},
{
files: ["*.vue"],
parser: "vue-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
experimentalObjectRestSpread: true,
experimentalDecorators: true,
jsx: true,
tsx: true
},
vueFeatures: {}
},
rules: __spreadValues({
"vue/no-v-model-argument": "off",
"vue/valid-v-model": 0,
"vue/html-indent": 0
}, tsExits ? { "@typescript-eslint/no-unused-vars": "off" } : null)
}
]
};
if (config.rules && !tsExits) {
config.rules["jsdoc/tag-lines"] = [1, "any", { startLines: 1 }];
}
export { config as default };