@truenine/eslint9-config
Version:
ESLint 9 configuration package for Compose Client projects with TypeScript, Vue, and modern JavaScript support
118 lines (116 loc) • 2.47 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
//#region src/configs/vue.ts
const attributeHyphenationIgnoreTags = [
"i-",
"v-",
"v-bind"
];
const componentNameInTemplateCasingOptions = {
ignores: [
"router-view",
"router-link",
"scroll-view",
"custom-tabbar",
"custom-navbar"
],
registeredComponentsOnly: false
};
const uniappVueOverrides = {
"vue/attribute-hyphenation": [
"error",
"always",
{ ignoreTags: attributeHyphenationIgnoreTags }
],
"vue/component-name-in-template-casing": [
"error",
"kebab-case",
componentNameInTemplateCasingOptions
]
};
/** Vue 默认配置 */
const vueConfig = {
vueVersion: 3,
overrides: {
"vue/html-self-closing": ["error", { html: {
void: "always",
normal: "always",
component: "always"
} }],
"vue/html-comment-content-spacing": [
"error",
"always",
{ exceptions: [] }
],
"vue/html-comment-indent": ["error", 2],
"vue/html-indent": [
"error",
2,
{
baseIndent: 0,
alignAttributesVertically: true
}
],
"vue/define-emits-declaration": ["error", "type-literal"],
"vue/define-props-declaration": ["error", "type-based"],
"vue/define-macros-order": ["error", {
order: [
"defineProps",
"defineEmits",
"defineModel",
"defineSlots"
],
defineExposeLast: true
}],
"vue/block-order": ["error", { order: [
"script",
"template",
"style"
] }],
"vue/attributes-order": ["error", { order: [
"DEFINITION",
"LIST_RENDERING",
"CONDITIONALS",
"RENDER_MODIFIERS",
"GLOBAL",
"UNIQUE",
"TWO_WAY_BINDING",
"OTHER_DIRECTIVES",
"OTHER_ATTR",
"EVENTS",
"CONTENT"
] }],
"vue/v-on-event-hyphenation": [
"error",
"never",
{ autofix: true }
],
"vue/attribute-hyphenation": [
"error",
"never",
{ ignoreTags: attributeHyphenationIgnoreTags }
],
"vue/prop-name-casing": ["error", "camelCase"],
"vue/component-name-in-template-casing": [
"error",
"PascalCase",
componentNameInTemplateCasingOptions
]
}
};
function applyUniappVueConfig(config) {
const overrides = config.overrides ?? {};
return {
...config,
overrides: {
...overrides,
...uniappVueOverrides
}
};
}
/** @deprecated 使用 vueConfig 代替 */
const defaultVueConfig = vueConfig;
//#endregion
exports.applyUniappVueConfig = applyUniappVueConfig;
exports.defaultVueConfig = defaultVueConfig;
exports.vueConfig = vueConfig;
//# sourceMappingURL=vue.cjs.map