Update eslint setup and fix some errors

Still has a bunch of errors that can't be auto-fixed though.
This commit is contained in:
arkon 2023-11-11 10:18:20 -05:00
parent ef61c80230
commit e0da86ca0c
12 changed files with 230 additions and 232 deletions

View File

@ -1,12 +0,0 @@
*.sh
*.md
*.woff
*.ttf
.vscode
.idea
.husky
.local
dist
node_modules
!docs/.vitepress
docs/.vitepress/cache

View File

@ -1,39 +0,0 @@
module.exports = {
root: true,
extends: ["@antfu"],
rules: {
"comma-dangle": ["error", "only-multiline"],
"quotes": "off",
"no-tabs": "off",
"arrow-parens": ["error", "always"],
"@typescript-eslint/quotes": ["error", "double", { avoidEscape: true }],
"indent": "off",
"semi": ["error", "never"],
"@typescript-eslint/indent": ["error", "tab"],
"@typescript-eslint/brace-style": ["error", "1tbs"],
"@typescript-eslint/semi": ["error", "never"],
"vue/no-extra-parens": "off",
"vue/html-indent": ["error", "tab"],
"curly": ["error", "all"],
"brace-style": ["error", "1tbs"],
"no-console": "off",
"no-debugger": "off",
"vue/multi-word-component-names": "off",
"vue/comment-directive": "off",
"no-unused-vars": "off",
"vue/no-parsing-error": [
2,
{
"x-invalid-end-tag": false,
"missing-semicolon-after-character-reference": false,
},
],
/* --ECMAScript 6 ES6-- */
"no-useless-escape": "off",
"no-unused-expressions": [
"error",
{ allowShortCircuit: true, allowTernary: true },
],
},
}

View File

@ -1,3 +1,3 @@
{
"extends": "markdownlint/style/prettier"
"extends": "markdownlint/style/prettier"
}

View File

@ -1,25 +1,25 @@
module.exports = {
plugins: ["stylelint-stylus"],
rules: {
"stylus/pythonic": "never",
"stylus/declaration-colon": "always",
"stylus/semicolon": "never",
"stylus/single-line-comment-double-slash-space-after": "always",
"stylus/property-no-unknown": null,
"stylus/selector-type-no-unknown": null,
"stylus/selector-list-comma": "always",
"stylus/indentation": [
"tab",
{
indentInsideParens: "twice",
},
],
"rule-empty-line-before": [
"always",
{
except: ["first-nested"],
},
],
},
extends: ["stylelint-stylus/standard"],
plugins: ['stylelint-stylus'],
rules: {
'stylus/pythonic': 'never',
'stylus/declaration-colon': 'always',
'stylus/semicolon': 'never',
'stylus/single-line-comment-double-slash-space-after': 'always',
'stylus/property-no-unknown': null,
'stylus/selector-type-no-unknown': null,
'stylus/selector-list-comma': 'always',
'stylus/indentation': [
'tab',
{
indentInsideParens: 'twice',
},
],
'rule-empty-line-before': [
'always',
{
except: ['first-nested'],
},
],
},
extends: ['stylelint-stylus/standard'],
}

63
website/eslint.config.js Normal file
View File

@ -0,0 +1,63 @@
import antfu from '@antfu/eslint-config'
import { FlatCompat } from '@eslint/eslintrc'
const compat = new FlatCompat()
export default antfu({
ignores: [
'*.sh',
'*.md',
'*.woff',
'*.ttf',
'.vscode/**',
'.idea/**',
'.husky/**',
'.local/**',
'dist/**',
'node_modules/**',
'!docs/.vitepress/**',
'docs/.vitepress/cache/**',
],
...compat.config({
rules: {
'comma-dangle': ['error', 'only-multiline'],
'quotes': 'off',
'no-tabs': 'off',
'arrow-parens': ['error', 'always'],
'@typescript-eslint/quotes': [
'error',
'double',
{ avoidEscape: true },
],
'indent': 'off',
'semi': ['error', 'never'],
'@typescript-eslint/indent': ['error', 'tab'],
'@typescript-eslint/brace-style': ['error', '1tbs'],
'@typescript-eslint/semi': ['error', 'never'],
'vue/no-extra-parens': 'off',
'vue/html-indent': ['error', 'tab'],
'curly': ['error', 'all'],
'brace-style': ['error', '1tbs'],
'no-console': 'off',
'no-debugger': 'off',
'vue/multi-word-component-names': 'off',
'vue/comment-directive': 'off',
'no-unused-vars': 'off',
'vue/no-parsing-error': [
2,
{
'x-invalid-end-tag': false,
'missing-semicolon-after-character-reference': false,
},
],
/* --ECMAScript 6 ES6-- */
'no-useless-escape': 'off',
'no-unused-expressions': [
'error',
{ allowShortCircuit: true, allowTernary: true },
],
},
}),
})

View File

@ -1,87 +1,88 @@
{
"name": "tachiyomi-website",
"version": "3.0.0",
"description": "Official website for the Tachiyomi app.",
"license": "MPL-2.0",
"private": true,
"type": "module",
"engines": {
"node": ">=20",
"pnpm": ">=8"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tachiyomiorg/website.git"
},
"bugs": {
"url": "https://github.com/tachiyomiorg/website/issues"
},
"scripts": {
"preinstall": "npx only-allow pnpm",
"test": "pnpm lint && pnpm build && pnpm preview",
"dev": "vitepress dev src",
"build": "vitepress build src",
"preview": "vitepress preview src",
"lint": "pnpm lint:es && pnpm lint:mdl && pnpm lint:style",
"lint:fix": "pnpm lint:es:fix && pnpm lint:style:fix",
"lint:es": "eslint . --ext .vue,.js,.ts,.cjs,.mjs,.jsx,.tsx",
"lint:es:fix": "eslint . --ext .vue,.js,.ts,.cjs,.mjs,.jsx,.tsx --fix",
"lint:mdl": "markdownlint \"**/*.md\" \".github/**/*.md\" --enable sentences-per-line --disable MD025 MD033",
"lint:style": "stylelint \"**/*.{styl,vue}\" \"src/.vitepress/**/*.{styl,vue}\"",
"lint:style:fix": "stylelint --fix \"**/*.{styl,vue}\" \"src/.vitepress/**/*.{styl,vue}\""
},
"dependencies": {
"@iconify-prerendered/vue-mdi": "0.23.1698215149",
"@octokit/rest": "20.0.2",
"@octokit/types": "12.2.0",
"@tanstack/vue-query": "5.8.1",
"@vueuse/core": "10.6.0",
"axios": "1.6.1",
"element-plus": "2.4.2",
"lodash.groupby": "4.6.0",
"markdown-it": "13.0.2",
"markdown-it-shortcode-tag": "1.1.0",
"moment": "2.29.4"
},
"devDependencies": {
"@antfu/eslint-config": "1.1.1",
"@mdit/plugin-attrs": "0.6.5",
"@mdit/plugin-figure": "0.6.5",
"@mdit/plugin-img-lazyload": "0.6.5",
"@mdit/plugin-img-mark": "0.6.5",
"@mdit/plugin-img-size": "0.6.5",
"@mdit/plugin-include": "0.6.5",
"@resvg/resvg-js": "2.6.0",
"@types/gtag.js": "0.0.18",
"@types/lodash.groupby": "4.6.9",
"@types/markdown-it": "13.0.6",
"@types/node": "20.9.0",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"eslint": "8.53.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-vue": "9.18.1",
"feed": "4.2.2",
"lint-staged": "15.0.2",
"markdownlint": "0.31.1",
"markdownlint-cli": "0.37.0",
"sentences-per-line": "0.2.1",
"stylelint": "15.11.0",
"stylelint-stylus": "0.18.0",
"stylus": "0.61.0",
"unplugin-element-plus": "0.8.0",
"vite-plugin-eslint": "1.8.1",
"vitepress": "1.0.0-rc.25",
"vitepress-plugin-tabs": "0.4.1",
"vue": "3.3.8",
"vue-eslint-parser": "9.3.2",
"x-satori": "0.1.5"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*.{styl,vue}": "stylelint --fix",
"*.{html,json}": "prettier --write"
}
"name": "tachiyomi-website",
"type": "module",
"version": "3.0.0",
"private": true,
"description": "Official website for the Tachiyomi app.",
"license": "MPL-2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/tachiyomiorg/website.git"
},
"bugs": {
"url": "https://github.com/tachiyomiorg/website/issues"
},
"engines": {
"node": ">=20",
"pnpm": ">=8"
},
"scripts": {
"preinstall": "npx only-allow pnpm",
"test": "pnpm lint && pnpm build && pnpm preview",
"dev": "vitepress dev src",
"build": "vitepress build src",
"preview": "vitepress preview src",
"lint": "pnpm lint:es && pnpm lint:mdl && pnpm lint:style",
"lint:fix": "pnpm lint:es:fix && pnpm lint:style:fix",
"lint:es": "eslint . ",
"lint:es:fix": "eslint . --fix",
"lint:mdl": "markdownlint \"**/*.md\" \".github/**/*.md\" --enable sentences-per-line --disable MD025 MD033",
"lint:style": "stylelint \"**/*.{styl,vue}\" \"src/.vitepress/**/*.{styl,vue}\"",
"lint:style:fix": "stylelint --fix \"**/*.{styl,vue}\" \"src/.vitepress/**/*.{styl,vue}\""
},
"dependencies": {
"@iconify-prerendered/vue-mdi": "0.23.1698215149",
"@octokit/rest": "20.0.2",
"@octokit/types": "12.2.0",
"@tanstack/vue-query": "5.8.1",
"@vueuse/core": "10.6.0",
"axios": "1.6.1",
"element-plus": "2.4.2",
"lodash.groupby": "4.6.0",
"markdown-it": "13.0.2",
"markdown-it-shortcode-tag": "1.1.0",
"moment": "2.29.4"
},
"devDependencies": {
"@antfu/eslint-config": "^1.1.1",
"@eslint/eslintrc": "^2.1.3",
"@mdit/plugin-attrs": "0.6.5",
"@mdit/plugin-figure": "0.6.5",
"@mdit/plugin-img-lazyload": "0.6.5",
"@mdit/plugin-img-mark": "0.6.5",
"@mdit/plugin-img-size": "0.6.5",
"@mdit/plugin-include": "0.6.5",
"@resvg/resvg-js": "2.6.0",
"@types/gtag.js": "0.0.18",
"@types/lodash.groupby": "4.6.9",
"@types/markdown-it": "13.0.6",
"@types/node": "20.9.0",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"eslint": "8.53.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-vue": "9.18.1",
"feed": "4.2.2",
"lint-staged": "15.0.2",
"markdownlint": "0.31.1",
"markdownlint-cli": "0.37.0",
"sentences-per-line": "0.2.1",
"stylelint": "15.11.0",
"stylelint-stylus": "0.18.0",
"stylus": "0.61.0",
"unplugin-element-plus": "0.8.0",
"vite-plugin-eslint": "1.8.1",
"vitepress": "1.0.0-rc.25",
"vitepress-plugin-tabs": "0.4.1",
"vue": "3.3.8",
"vue-eslint-parser": "9.3.2",
"x-satori": "0.1.5"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*.{styl,vue}": "stylelint --fix",
"*.{html,json}": "prettier --write"
}
}

View File

@ -41,8 +41,11 @@ dependencies:
devDependencies:
'@antfu/eslint-config':
specifier: 1.1.1
specifier: ^1.1.1
version: 1.1.1(eslint@8.53.0)(typescript@5.2.2)
'@eslint/eslintrc':
specifier: ^2.1.3
version: 2.1.3
'@mdit/plugin-attrs':
specifier: 0.6.5
version: 0.6.5(markdown-it@13.0.2)
@ -87,7 +90,7 @@ devDependencies:
version: 8.53.0
eslint-config-standard:
specifier: 17.1.0
version: 17.1.0(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.2.0)(eslint-plugin-promise@6.1.1)(eslint@8.53.0)
version: 17.1.0(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.3.1)(eslint-plugin-promise@6.1.1)(eslint@8.53.0)
eslint-plugin-vue:
specifier: 9.18.1
version: 9.18.1(eslint@8.53.0)
@ -693,7 +696,7 @@ packages:
ajv: 6.12.6
debug: 4.3.4
espree: 9.6.1
globals: 13.21.0
globals: 13.23.0
ignore: 5.2.4
import-fresh: 3.3.0
js-yaml: 4.1.0
@ -2663,7 +2666,7 @@ packages:
parse-gitignore: 2.0.0
dev: true
/eslint-config-standard@17.1.0(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.2.0)(eslint-plugin-promise@6.1.1)(eslint@8.53.0):
/eslint-config-standard@17.1.0(eslint-plugin-import@2.28.1)(eslint-plugin-n@16.3.1)(eslint-plugin-promise@6.1.1)(eslint@8.53.0):
resolution: {integrity: sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==}
engines: {node: '>=12.0.0'}
peerDependencies:
@ -2674,7 +2677,7 @@ packages:
dependencies:
eslint: 8.53.0
eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.10.0)(eslint@8.53.0)
eslint-plugin-n: 16.2.0(eslint@8.53.0)
eslint-plugin-n: 16.3.1(eslint@8.53.0)
eslint-plugin-promise: 6.1.1(eslint@8.53.0)
dev: true
@ -2850,24 +2853,6 @@ packages:
- supports-color
dev: true
/eslint-plugin-n@16.2.0(eslint@8.53.0):
resolution: {integrity: sha512-AQER2jEyQOt1LG6JkGJCCIFotzmlcCZFur2wdKrp1JX2cNotC7Ae0BcD/4lLv3lUAArM9uNS8z/fsvXTd0L71g==}
engines: {node: '>=16.0.0'}
peerDependencies:
eslint: '>=7.0.0'
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.53.0)
builtins: 5.0.1
eslint: 8.53.0
eslint-plugin-es-x: 7.2.0(eslint@8.53.0)
get-tsconfig: 4.7.0
ignore: 5.2.4
is-core-module: 2.13.0
minimatch: 3.1.2
resolve: 1.22.6
semver: 7.5.4
dev: true
/eslint-plugin-n@16.3.1(eslint@8.53.0):
resolution: {integrity: sha512-w46eDIkxQ2FaTHcey7G40eD+FhTXOdKudDXPUO2n9WNcslze/i/HT2qJ3GXjHngYSGDISIgPNhwGtgoix4zeOw==}
engines: {node: '>=16.0.0'}

View File

@ -1,41 +1,41 @@
<script setup lang="ts">
import { inject, onMounted, ref } from "vue"
import { useData } from "vitepress"
import { inject, onMounted, ref } from 'vue'
import { useData } from 'vitepress'
import VPIconMoon from "vitepress/dist/client/theme-default/components/icons/VPIconMoon.vue"
import VPIconSun from "vitepress/dist/client/theme-default/components/icons/VPIconSun.vue"
import VPIconMoon from 'vitepress/dist/client/theme-default/components/icons/VPIconMoon.vue'
import VPIconSun from 'vitepress/dist/client/theme-default/components/icons/VPIconSun.vue'
const { isDark } = useData()
const toggleAppearance = inject("toggle-appearance", () => {
isDark.value = !isDark.value
const toggleAppearance = inject('toggle-appearance', () => {
isDark.value = !isDark.value
})
const supportsViewTransition = ref(false)
onMounted(() => {
supportsViewTransition.value = "startViewTransition" in document
&& window.matchMedia("(prefers-reduced-motion: no-preference)").matches
supportsViewTransition.value = 'startViewTransition' in document
&& window.matchMedia('(prefers-reduced-motion: no-preference)').matches
})
</script>
<template>
<button
type="button"
role="switch"
title="Toggle dark mode"
class="CustomSwitchAppearance"
:aria-checked="isDark"
:data-view-transition="supportsViewTransition"
@click="toggleAppearance"
>
<ClientOnly>
<Transition name="fade" mode="out-in">
<VPIconSun v-if="!isDark" class="sun" />
<VPIconMoon v-else class="moon" />
</Transition>
</ClientOnly>
</button>
<button
type="button"
role="switch"
title="Toggle dark mode"
class="CustomSwitchAppearance"
:aria-checked="isDark"
:data-view-transition="supportsViewTransition"
@click="toggleAppearance"
>
<ClientOnly>
<Transition name="fade" mode="out-in">
<VPIconSun v-if="!isDark" class="sun" />
<VPIconMoon v-else class="moon" />
</Transition>
</ClientOnly>
</button>
</template>
<style lang="stylus" scoped>

View File

@ -1,12 +1,12 @@
<script setup lang="ts">
import { IconRssBox } from "@iconify-prerendered/vue-mdi"
import { IconRssBox } from '@iconify-prerendered/vue-mdi'
</script>
<template>
<a href="/feed.rss" class="rss" title="RSS feed for the news archive">
<IconRssBox />
<span>RSS feed</span>
</a>
<a href="/feed.rss" class="rss" title="RSS feed for the news archive">
<IconRssBox />
<span>RSS feed</span>
</a>
</template>
<style lang="stylus" scoped>

View File

@ -23,13 +23,13 @@ You can copy the following example and edit the details as needed:
```json
{
"title": "Example Title",
"author": "Example Author",
"artist": "Example Artist",
"description": "Example Description",
"genre": ["genre 1", "genre 2", "etc"],
"status": "0",
"_status values": ["0 = Unknown", "1 = Ongoing", "2 = Completed", "3 = Licensed", "4 = Publishing finished", "5 = Cancelled", "6 = On hiatus"]
"title": "Example Title",
"author": "Example Author",
"artist": "Example Artist",
"description": "Example Description",
"genre": ["genre 1", "genre 2", "etc"],
"status": "0",
"_status values": ["0 = Unknown", "1 = Ongoing", "2 = Completed", "3 = Licensed", "4 = Publishing finished", "5 = Cancelled", "6 = On hiatus"]
}
```
::: tip

View File

@ -1,22 +1,23 @@
{
"compilerOptions": {
"target": "esnext",
"jsx": "preserve",
"lib": ["esnext", "dom"],
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"skipLibCheck": true,
"types": ["vite/client", "@types/gtag.js"],
"paths": {
"@/*": ["./docs/.vitepress/*"]
}
},
"resolveJsonModule": true,
"types": ["vite/client", "@types/gtag.js"],
"strict": true,
"sourceMap": true,
"esModuleInterop": true,
"isolatedModules": true,
"skipLibCheck": true
},
"references": [{ "path": "./tsconfig.node.json" }],
"include": [
"typings/**/*.d.ts",
"docs/**/*.vue",
@ -28,6 +29,5 @@
],
"exclude": ["**/node_modules/**", "dist/**"],
"extensions": [".js", ".ts", ".tsx", ".jsx", ".vue"],
"references": [{ "path": "./tsconfig.node.json" }],
"allowSyntheticDefaultImports": true
}

View File

@ -3,8 +3,8 @@
"composite": true,
"module": "esnext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"types": ["vite/client"]
"types": ["vite/client"],
"allowSyntheticDefaultImports": true
},
"exclude": ["**/node_modules/**", "dist/**"]
}