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,25 +1,25 @@
module.exports = { module.exports = {
plugins: ["stylelint-stylus"], plugins: ['stylelint-stylus'],
rules: { rules: {
"stylus/pythonic": "never", 'stylus/pythonic': 'never',
"stylus/declaration-colon": "always", 'stylus/declaration-colon': 'always',
"stylus/semicolon": "never", 'stylus/semicolon': 'never',
"stylus/single-line-comment-double-slash-space-after": "always", 'stylus/single-line-comment-double-slash-space-after': 'always',
"stylus/property-no-unknown": null, 'stylus/property-no-unknown': null,
"stylus/selector-type-no-unknown": null, 'stylus/selector-type-no-unknown': null,
"stylus/selector-list-comma": "always", 'stylus/selector-list-comma': 'always',
"stylus/indentation": [ 'stylus/indentation': [
"tab", 'tab',
{ {
indentInsideParens: "twice", indentInsideParens: 'twice',
}, },
], ],
"rule-empty-line-before": [ 'rule-empty-line-before': [
"always", 'always',
{ {
except: ["first-nested"], except: ['first-nested'],
}, },
], ],
}, },
extends: ["stylelint-stylus/standard"], 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,14 +1,10 @@
{ {
"name": "tachiyomi-website", "name": "tachiyomi-website",
"type": "module",
"version": "3.0.0", "version": "3.0.0",
"private": true,
"description": "Official website for the Tachiyomi app.", "description": "Official website for the Tachiyomi app.",
"license": "MPL-2.0", "license": "MPL-2.0",
"private": true,
"type": "module",
"engines": {
"node": ">=20",
"pnpm": ">=8"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/tachiyomiorg/website.git" "url": "git+https://github.com/tachiyomiorg/website.git"
@ -16,6 +12,10 @@
"bugs": { "bugs": {
"url": "https://github.com/tachiyomiorg/website/issues" "url": "https://github.com/tachiyomiorg/website/issues"
}, },
"engines": {
"node": ">=20",
"pnpm": ">=8"
},
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",
"test": "pnpm lint && pnpm build && pnpm preview", "test": "pnpm lint && pnpm build && pnpm preview",
@ -24,8 +24,8 @@
"preview": "vitepress preview src", "preview": "vitepress preview src",
"lint": "pnpm lint:es && pnpm lint:mdl && pnpm lint:style", "lint": "pnpm lint:es && pnpm lint:mdl && pnpm lint:style",
"lint:fix": "pnpm lint:es:fix && pnpm lint:style:fix", "lint:fix": "pnpm lint:es:fix && pnpm lint:style:fix",
"lint:es": "eslint . --ext .vue,.js,.ts,.cjs,.mjs,.jsx,.tsx", "lint:es": "eslint . ",
"lint:es:fix": "eslint . --ext .vue,.js,.ts,.cjs,.mjs,.jsx,.tsx --fix", "lint:es:fix": "eslint . --fix",
"lint:mdl": "markdownlint \"**/*.md\" \".github/**/*.md\" --enable sentences-per-line --disable MD025 MD033", "lint:mdl": "markdownlint \"**/*.md\" \".github/**/*.md\" --enable sentences-per-line --disable MD025 MD033",
"lint:style": "stylelint \"**/*.{styl,vue}\" \"src/.vitepress/**/*.{styl,vue}\"", "lint:style": "stylelint \"**/*.{styl,vue}\" \"src/.vitepress/**/*.{styl,vue}\"",
"lint:style:fix": "stylelint --fix \"**/*.{styl,vue}\" \"src/.vitepress/**/*.{styl,vue}\"" "lint:style:fix": "stylelint --fix \"**/*.{styl,vue}\" \"src/.vitepress/**/*.{styl,vue}\""
@ -44,7 +44,8 @@
"moment": "2.29.4" "moment": "2.29.4"
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "1.1.1", "@antfu/eslint-config": "^1.1.1",
"@eslint/eslintrc": "^2.1.3",
"@mdit/plugin-attrs": "0.6.5", "@mdit/plugin-attrs": "0.6.5",
"@mdit/plugin-figure": "0.6.5", "@mdit/plugin-figure": "0.6.5",
"@mdit/plugin-img-lazyload": "0.6.5", "@mdit/plugin-img-lazyload": "0.6.5",

View File

@ -41,8 +41,11 @@ dependencies:
devDependencies: devDependencies:
'@antfu/eslint-config': '@antfu/eslint-config':
specifier: 1.1.1 specifier: ^1.1.1
version: 1.1.1(eslint@8.53.0)(typescript@5.2.2) 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': '@mdit/plugin-attrs':
specifier: 0.6.5 specifier: 0.6.5
version: 0.6.5(markdown-it@13.0.2) version: 0.6.5(markdown-it@13.0.2)
@ -87,7 +90,7 @@ devDependencies:
version: 8.53.0 version: 8.53.0
eslint-config-standard: eslint-config-standard:
specifier: 17.1.0 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: eslint-plugin-vue:
specifier: 9.18.1 specifier: 9.18.1
version: 9.18.1(eslint@8.53.0) version: 9.18.1(eslint@8.53.0)
@ -693,7 +696,7 @@ packages:
ajv: 6.12.6 ajv: 6.12.6
debug: 4.3.4 debug: 4.3.4
espree: 9.6.1 espree: 9.6.1
globals: 13.21.0 globals: 13.23.0
ignore: 5.2.4 ignore: 5.2.4
import-fresh: 3.3.0 import-fresh: 3.3.0
js-yaml: 4.1.0 js-yaml: 4.1.0
@ -2663,7 +2666,7 @@ packages:
parse-gitignore: 2.0.0 parse-gitignore: 2.0.0
dev: true 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==} resolution: {integrity: sha512-IwHwmaBNtDK4zDHQukFDW5u/aTb8+meQWZvNFWkiGmbWjD6bqyuSSBxxXKkCftCUzc1zwCH2m/baCNDLGmuO5Q==}
engines: {node: '>=12.0.0'} engines: {node: '>=12.0.0'}
peerDependencies: peerDependencies:
@ -2674,7 +2677,7 @@ packages:
dependencies: dependencies:
eslint: 8.53.0 eslint: 8.53.0
eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.10.0)(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) eslint-plugin-promise: 6.1.1(eslint@8.53.0)
dev: true dev: true
@ -2850,24 +2853,6 @@ packages:
- supports-color - supports-color
dev: true 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): /eslint-plugin-n@16.3.1(eslint@8.53.0):
resolution: {integrity: sha512-w46eDIkxQ2FaTHcey7G40eD+FhTXOdKudDXPUO2n9WNcslze/i/HT2qJ3GXjHngYSGDISIgPNhwGtgoix4zeOw==} resolution: {integrity: sha512-w46eDIkxQ2FaTHcey7G40eD+FhTXOdKudDXPUO2n9WNcslze/i/HT2qJ3GXjHngYSGDISIgPNhwGtgoix4zeOw==}
engines: {node: '>=16.0.0'} engines: {node: '>=16.0.0'}

View File

@ -1,21 +1,21 @@
<script setup lang="ts"> <script setup lang="ts">
import { inject, onMounted, ref } from "vue" import { inject, onMounted, ref } from 'vue'
import { useData } from "vitepress" import { useData } from 'vitepress'
import VPIconMoon from "vitepress/dist/client/theme-default/components/icons/VPIconMoon.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" import VPIconSun from 'vitepress/dist/client/theme-default/components/icons/VPIconSun.vue'
const { isDark } = useData() const { isDark } = useData()
const toggleAppearance = inject("toggle-appearance", () => { const toggleAppearance = inject('toggle-appearance', () => {
isDark.value = !isDark.value isDark.value = !isDark.value
}) })
const supportsViewTransition = ref(false) const supportsViewTransition = ref(false)
onMounted(() => { onMounted(() => {
supportsViewTransition.value = "startViewTransition" in document supportsViewTransition.value = 'startViewTransition' in document
&& window.matchMedia("(prefers-reduced-motion: no-preference)").matches && window.matchMedia('(prefers-reduced-motion: no-preference)').matches
}) })
</script> </script>

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { IconRssBox } from "@iconify-prerendered/vue-mdi" import { IconRssBox } from '@iconify-prerendered/vue-mdi'
</script> </script>
<template> <template>

View File

@ -1,22 +1,23 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "esnext", "target": "esnext",
"jsx": "preserve",
"lib": ["esnext", "dom"],
"useDefineForClassFields": true, "useDefineForClassFields": true,
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "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": { "paths": {
"@/*": ["./docs/.vitepress/*"] "@/*": ["./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": [ "include": [
"typings/**/*.d.ts", "typings/**/*.d.ts",
"docs/**/*.vue", "docs/**/*.vue",
@ -28,6 +29,5 @@
], ],
"exclude": ["**/node_modules/**", "dist/**"], "exclude": ["**/node_modules/**", "dist/**"],
"extensions": [".js", ".ts", ".tsx", ".jsx", ".vue"], "extensions": [".js", ".ts", ".tsx", ".jsx", ".vue"],
"references": [{ "path": "./tsconfig.node.json" }],
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true
} }

View File

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