feat(config): share linter configs via lib

This commit is contained in:
MiniDigger | Martin 2022-12-09 15:53:47 +01:00
parent 9956c5d20b
commit 2dad8d5967
8 changed files with 12 additions and 228 deletions

View File

@ -1,97 +0,0 @@
module.exports = {
root: true,
env: {
node: true,
browser: true,
"vue/setup-compiler-macros": true,
},
parser: "vue-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
},
extends: [
"plugin:vue/vue3-recommended",
"eslint:recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"@vue/typescript/recommended",
"plugin:eslint-comments/recommended",
"prettier",
],
plugins: ["unicorn"],
settings: {
"import/resolver": {
node: {
extensions: [".js", ".ts", ".d.ts"],
},
alias: {
map: [["~", "./src/"]],
extensions: [".js", ".ts", ".d.ts", ".vue"],
},
},
"import/core-modules": ["windi.css", "virtual:generated-layouts", "virtual:generated-pages"],
},
rules: {
"eol-last": ["error", "always"],
"vue/multi-word-component-names": "off",
// TS
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-unused-vars": "off",
// unicorn
"unicorn/better-regex": "error",
"unicorn/empty-brace-spaces": "error",
"unicorn/escape-case": "error",
"unicorn/new-for-builtins": "error",
"unicorn/no-array-for-each": "error",
"unicorn/no-array-push-push": "error",
"unicorn/no-console-spaces": "error",
"unicorn/no-instanceof-array": "error",
"unicorn/no-new-buffer": "error",
"unicorn/no-unsafe-regex": "error",
"unicorn/no-useless-promise-resolve-reject": "error",
"unicorn/prefer-array-find": "error",
"unicorn/prefer-array-flat": "error",
"unicorn/prefer-array-flat-map": "error",
"unicorn/prefer-array-index-of": "error",
"unicorn/prefer-array-some": "error",
"unicorn/prefer-at": "error",
"unicorn/prefer-date-now": "error",
"unicorn/prefer-default-parameters": "error",
"unicorn/prefer-dom-node-append": "error",
"unicorn/prefer-export-from": "error",
"unicorn/prefer-includes": "error",
"unicorn/prefer-modern-dom-apis": "error",
"unicorn/prefer-set-has": "error",
"unicorn/prefer-spread": "error",
"unicorn/prefer-string-replace-all": "error",
"unicorn/prefer-switch": "error",
"unicorn/prefer-ternary": "error",
"unicorn/relative-url-style": "error",
"unicorn/throw-new-error": "error",
"import/no-unresolved": [
"error",
{
ignore: ["^~icons/mdi/.*", ".*\\.svg$", "hangar-internal", "hangar-api"],
},
],
},
overrides: [
{
files: ".eslintrc.js",
rules: {
"unicorn/prefer-module": "off",
},
},
{
files: ["*.html"],
rules: {
"vue/comment-directive": "off",
},
},
],
};

View File

@ -1,8 +0,0 @@
{
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"printWidth": 160,
"arrowParens": "always",
"trailingComma": "es5"
}

3
frontend/.prettierrc.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
...require("./src/lib/config/prettier.config"),
};

View File

@ -18,6 +18,9 @@
"eslint"
]
},
"eslintConfig": {
"extends": "./src/lib/config/vitessr.eslint.config.js"
},
"dependencies": {
"@headlessui/vue": "1.7.4",
"@nuxt/devalue": "2.0.0",

View File

@ -30,7 +30,7 @@ const prettyDiff = computed(() => {
for (let x = 0; x < diffs.length; x++) {
const op = diffs[x][0]; // Operation (insert, delete, equal)
const data = diffs[x][1]; // Text of change.
const text = data.replace(patternAmp, "&amp;").replace(patternLt, "&lt;").replace(patternGt, "&gt;").replace(patternPara, "&para;<br>");
const text = data.replaceAll(patternAmp, "&amp;").replaceAll(patternLt, "&lt;").replaceAll(patternGt, "&gt;").replaceAll(patternPara, "&para;<br>");
switch (op) {
case DIFF_INSERT:
html[x] = '<ins style="background:#46954a33;">' + text + "</ins>";

@ -1 +1 @@
Subproject commit 9c62e3c72afb793dcd1aebaf45639b01ed5501fa
Subproject commit 561d10442a88e2a612ea34a7d0b48f5fb5c44fb0

View File

@ -46,7 +46,7 @@ useHead(useSeo("Hangar Version", null, route, null));
</ul>
<p mt="2">You can see a graphical display of those milestones <Link href="https://github.com/orgs/HangarMC/projects/1/insights/2">here</Link>.</p>
<Alert mt="4">
Please remember, these are estimates, not promises, they can change at any time as the team shifts focus. Although you can always speed up a particular task by
contributing!
Please remember, these are estimates, not promises, they can change at any time as the team shifts focus. Although you can always speed up a particular task
by contributing!
</Alert>
</template>

View File

@ -1,123 +1,6 @@
import { defineConfig } from "vite-plugin-windicss";
import colors from "windicss/colors";
import typography from "windicss/plugin/typography";
import plugin from "windicss/plugin";
import WindiConfig from "./src/lib/config/windi.config.js";
export default defineConfig({
darkMode: "class",
safelist: "order-last button-primary button-secondary button-red button-transparent",
attributify: true,
plugins: [
typography(),
plugin(({ addVariant }) => {
addVariant("error", ({ style }) => {
return style.parent(".error");
});
addVariant("filled", ({ style }) => {
return style.parent(".filled");
});
addVariant("input-focused", ({ style }) => {
return style.wrapSelector((s) => "input:focus ~ " + s);
});
addVariant("input-focus-visible", ({ style }) => {
return style.wrapSelector((s) => "input:focus-visible ~ " + s);
});
addVariant("select-focused", ({ style }) => {
return style.wrapSelector((s) => "select:focus ~ " + s);
});
}),
],
theme: {
colors: {
transparent: "transparent",
current: "currentColor",
primary: {
0: "#E6EDFD", // old primary-50
50: "#CCDCFB",
100: "#99B8F6", // old primary-70
200: "#6695F2",
300: "#3371ED",
400: "#004EE9", // old primary-100
500: "#003EBA",
600: "#002F8C",
700: "#001F5D",
800: "#00102F",
900: "#000817",
},
sky: colors.sky,
blue: colors.blue,
lime: colors.lime,
slate: colors.slate,
red: colors.red,
gray: colors.zinc,
secondary: colors.slate,
white: colors.zinc[50],
black: colors.zinc[900],
},
extend: {
typography: {
DEFAULT: {
css: {
maxWidth: "65ch",
color: "inherit",
lineHeight: "1.6em",
a: {
color: "inherit",
opacity: 0.75,
fontWeight: "500",
textDecoration: "underline",
"&:hover": {
opacity: 1,
color: colors.teal[600],
},
},
b: { color: "inherit" },
strong: { color: "inherit" },
em: { color: "inherit" },
h1: {
color: "inherit",
fontWeight: "600",
marginBottom: "0.6em",
},
h2: {
color: "inherit",
fontWeight: "600",
marginTop: "inherit",
marginBottom: "0.6em",
},
h3: {
color: "inherit",
marginTop: "inherit",
marginBottom: "0.6em",
},
h4: {
color: "inherit",
marginTop: "inherit",
marginBottom: "0.6em",
},
code: { color: "inherit" },
li: {
marginTop: "0.2em",
marginBottom: "0.2em",
},
},
},
},
colors: {
red: {
500: "#ff544b",
},
},
},
},
shortcuts: {
"background-body": "bg-gray-100 dark:bg-gray-900",
"background-default": "bg-gray-50 dark:bg-gray-800",
"color-primary": "text-primary-400 dark:text-primary-200",
"border-top-primary": "border-solid border-t-4 border-t-primary-400",
"button-primary": "bg-primary-400 enabled:hover:bg-primary-300",
"button-secondary": "bg-secondary-500 enabled:hover:(bg-secondary-400 dark:bg-secondary-600)",
"button-transparent": "bg-transparent enabled:hover:(bg-primary-400/15 text-primary-400 dark:text-primary-100)",
"button-red": "bg-red-500 dark:bg-red-600 enabled:hover:(bg-red-400 dark:bg-red-500)",
},
presets: [WindiConfig],
});