62 lines
1.7 KiB
JavaScript
62 lines
1.7 KiB
JavaScript
import js from "@eslint/js";
|
|
import globals from "globals";
|
|
import ts from "typescript-eslint";
|
|
import vue from "eslint-plugin-vue";
|
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
import vueParser from "vue-eslint-parser";
|
|
|
|
export default defineConfig([
|
|
globalIgnores(["dist"]),
|
|
{
|
|
extends: [
|
|
js.configs.recommended,
|
|
ts.configs.strictTypeChecked,
|
|
...vue.configs["flat/essential"],
|
|
],
|
|
files: ["./src/**/*.{js,ts,vue}"],
|
|
plugins: { vue },
|
|
languageOptions: {
|
|
ecmaVersion: "latest",
|
|
sourceType: "module",
|
|
globals: globals.browser,
|
|
parser: vueParser,
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: import.meta.dirname,
|
|
parser: ts.parser,
|
|
extraFileExtensions: [".vue"],
|
|
},
|
|
},
|
|
rules: {
|
|
"vue/no-restricted-html-elements": [
|
|
"error",
|
|
{
|
|
element: ["a", "RouterLink"],
|
|
message: "Use <SmartLink> instead.",
|
|
},
|
|
{ element: ["i18n-t"], message: "Use <RichTemplate> instead." },
|
|
{
|
|
element: ["RichTemplateParts"],
|
|
message:
|
|
"Do not use the internal <RichTemplateParts> component. Use <RichTemplate> instead.",
|
|
},
|
|
],
|
|
// allow interfaces to only extend another interface without adding properties
|
|
// good for aliasing more complex types
|
|
"@typescript-eslint/no-empty-object-type": [
|
|
"error",
|
|
{ allowInterfaces: "with-single-extends" },
|
|
],
|
|
"vue/no-ref-object-reactivity-loss": ["error"],
|
|
"@typescript/no-unnecessary-conditions": [
|
|
"error",
|
|
{ allowConstantLoopConditions: "only-allowed-literals" },
|
|
],
|
|
},
|
|
},
|
|
// disable multi-word-component-names for unplugin-vue-router
|
|
{
|
|
files: ["src/pages/**/*.vue"],
|
|
rules: { "vue/multi-word-component-names": "off" },
|
|
},
|
|
]);
|