mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-15 03:53:16 +08:00
🔧 Eslint v9
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
# Build
|
||||
dist
|
||||
src-tauri/target
|
||||
# Package files
|
||||
pnpm-lock.yaml
|
||||
# data
|
||||
src/data/**/*.json
|
||||
# lint files
|
||||
!.prettierrc.yml
|
||||
!.stylelintrc.yml
|
||||
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -44,7 +44,7 @@ jobs:
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8.15.6
|
||||
version: 9.0.4
|
||||
- name: remove lockfile
|
||||
run: rm pnpm-lock.yaml
|
||||
- name: Install frontend dependencies
|
||||
|
||||
2
.github/workflows/qodana_code_quality.yml
vendored
2
.github/workflows/qodana_code_quality.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
||||
- name: setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8.15.6
|
||||
version: 9.0.4
|
||||
- name: remove lockfile
|
||||
run: rm -f pnpm-lock.yaml
|
||||
- name: Install dependencies
|
||||
|
||||
12
eslint.config.js
Normal file
12
eslint.config.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { jsonEslintConfig } from "./eslint/jsonEslint.js";
|
||||
import ymlEslintConfig from "./eslint/ymlEslint.js";
|
||||
import { vueEslintConfig } from "./eslint/vueEslint.js";
|
||||
|
||||
export default [
|
||||
...jsonEslintConfig,
|
||||
ymlEslintConfig,
|
||||
...vueEslintConfig,
|
||||
{
|
||||
ignores: ["dist", "src-tauri/target", "pnpm-lock.yaml", "src/data/**/*.json"],
|
||||
},
|
||||
];
|
||||
95
eslint/jsonEslint.js
Normal file
95
eslint/jsonEslint.js
Normal file
@@ -0,0 +1,95 @@
|
||||
import eslint_jsonc from "eslint-plugin-jsonc";
|
||||
import jsonc_parser from "jsonc-eslint-parser";
|
||||
|
||||
const pkgJsonConfig = {
|
||||
files: ["package.json"],
|
||||
plugins: {
|
||||
jsonc: eslint_jsonc,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: jsonc_parser,
|
||||
},
|
||||
rules: {
|
||||
"jsonc/comma-dangle": ["error", "never"],
|
||||
"jsonc/sort-keys": [
|
||||
"error",
|
||||
{
|
||||
pathPattern: "^$",
|
||||
order: [
|
||||
"name",
|
||||
"version",
|
||||
"description",
|
||||
"type",
|
||||
"packageManager",
|
||||
"scripts",
|
||||
"lint-staged",
|
||||
"keywords",
|
||||
"author",
|
||||
"license",
|
||||
"respository",
|
||||
"homepage",
|
||||
"bugs",
|
||||
"dependencies",
|
||||
"devDependencies",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const tscJsonConfig = {
|
||||
files: ["tsconfig.json"],
|
||||
plugins: {
|
||||
jsonc: eslint_jsonc,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: jsonc_parser,
|
||||
},
|
||||
rules: {
|
||||
"jsonc/comma-dangle": ["error", "never"],
|
||||
"jsonc/sort-keys": [
|
||||
"error",
|
||||
{
|
||||
pathPattern: "^$",
|
||||
order: [
|
||||
"compilerOptions",
|
||||
"include",
|
||||
"exclude",
|
||||
"extends",
|
||||
"files",
|
||||
"references",
|
||||
"typeAcquisition",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const jsoncConfig = {
|
||||
files: ["source/data/out/**/*.json"],
|
||||
plugins: {
|
||||
jsonc: eslint_jsonc,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: jsonc_parser,
|
||||
},
|
||||
rules: {
|
||||
"jsonc/comma-dangle": ["error", "never"],
|
||||
"jsonc/sort-keys": [
|
||||
"error",
|
||||
{
|
||||
pathPattern: "^$",
|
||||
order: {
|
||||
type: "asc",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export const jsonEslintConfig = [
|
||||
...eslint_jsonc.configs["flat/recommended-with-json"],
|
||||
pkgJsonConfig,
|
||||
tscJsonConfig,
|
||||
jsoncConfig,
|
||||
];
|
||||
86
eslint/vueEslint.js
Normal file
86
eslint/vueEslint.js
Normal file
@@ -0,0 +1,86 @@
|
||||
import eslint_js from "@eslint/js";
|
||||
import eslint_ts from "typescript-eslint";
|
||||
import eslint_vue from "eslint-plugin-vue";
|
||||
import eslint_prettier from "eslint-plugin-prettier";
|
||||
import eslint_import from "eslint-plugin-import";
|
||||
import vue_parser from "vue-eslint-parser";
|
||||
import pluginVue from "eslint-plugin-vue";
|
||||
import globals from "globals";
|
||||
|
||||
const tsConfigRules = {
|
||||
"@typescript-eslint/consistent-type-assertions": [
|
||||
"error",
|
||||
{
|
||||
assertionStyle: "angle-bracket",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-import-type-side-effects": "error",
|
||||
"@typescript-eslint/strict-boolean-expressions": "error",
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
groups: ["builtin", "external", "internal", "parent", "sibling", "index", "unknown"],
|
||||
"newlines-between": "always",
|
||||
alphabetize: {
|
||||
order: "asc",
|
||||
caseInsensitive: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
"prettier/prettier": "error",
|
||||
};
|
||||
|
||||
const tsConfig = {
|
||||
files: ["*.ts"],
|
||||
plugins: {
|
||||
typescript: eslint_ts,
|
||||
import: eslint_import,
|
||||
prettier: eslint_prettier,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: eslint_ts.parser,
|
||||
parserOptions: {
|
||||
project: "tsconfig.json",
|
||||
tsconfigRootDir: ".",
|
||||
},
|
||||
},
|
||||
rules: tsConfigRules,
|
||||
};
|
||||
|
||||
const vueConfig = {
|
||||
plugins: {
|
||||
vue: eslint_vue,
|
||||
import: eslint_import,
|
||||
prettier: eslint_prettier,
|
||||
},
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.es2021,
|
||||
TGApp: "readonly",
|
||||
window: "readonly",
|
||||
},
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
parser: vue_parser,
|
||||
parserOptions: {
|
||||
project: "tsconfig.json",
|
||||
parser: eslint_ts.parser,
|
||||
extraFileExtensions: [".vue"],
|
||||
tsconfigRootDir: ".",
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
...tsConfigRules,
|
||||
"vue/multi-word-component-names": "off",
|
||||
},
|
||||
};
|
||||
|
||||
export const vueEslintConfig = [
|
||||
eslint_js.configs.recommended,
|
||||
...eslint_ts.configs.recommended,
|
||||
...eslint_vue.configs["flat/essential"],
|
||||
...pluginVue.configs["flat/essential"],
|
||||
tsConfig,
|
||||
vueConfig,
|
||||
];
|
||||
33
eslint/ymlEslint.js
Normal file
33
eslint/ymlEslint.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import eslint_yml from "eslint-plugin-yml";
|
||||
import yml_parser from "yaml-eslint-parser";
|
||||
import eslint_import from "eslint-plugin-import";
|
||||
|
||||
const ymlEslintConfig = {
|
||||
files: ["*.yaml", "*.yml"],
|
||||
plugins: {
|
||||
yml: eslint_yml,
|
||||
import: eslint_import,
|
||||
},
|
||||
languageOptions: {
|
||||
parser: yml_parser,
|
||||
parserOptions: {
|
||||
defaultYAMLVersion: "1.2",
|
||||
project: "./tsconfig.json",
|
||||
extraFileExtensions: [".yaml", ".yml"],
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"yml/indent": ["error", 2],
|
||||
"yml/key-spacing": ["error"],
|
||||
"yml/quotes": [
|
||||
"error",
|
||||
{
|
||||
prefer: "double",
|
||||
avoidEscape: true,
|
||||
},
|
||||
],
|
||||
"yml/sort-keys": ["error", "asc"],
|
||||
},
|
||||
};
|
||||
|
||||
export default ymlEslintConfig;
|
||||
39
package.json
39
package.json
@@ -3,7 +3,8 @@
|
||||
"version": "0.4.5",
|
||||
"description": "Game Tool for Genshin Impact player",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@9.0.1",
|
||||
"packageManager": "pnpm@9.0.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "tauri build",
|
||||
"debug": "tauri build --debug",
|
||||
@@ -66,7 +67,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "7.4.47",
|
||||
"@tauri-apps/api": "^1.5.3",
|
||||
"@tauri-apps/api": "^1.5.4",
|
||||
"artplayer": "^5.1.1",
|
||||
"clipboard": "^2.0.11",
|
||||
"color-convert": "^2.0.1",
|
||||
@@ -79,38 +80,40 @@
|
||||
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log#v1",
|
||||
"tauri-plugin-sql-api": "github:tauri-apps/tauri-plugin-sql#v1",
|
||||
"uuid": "^9.0.1",
|
||||
"vue": "^3.4.21",
|
||||
"vue-echarts": "^6.6.9",
|
||||
"vue": "^3.4.24",
|
||||
"vue-echarts": "^6.7.0",
|
||||
"vue-json-viewer": "^3.0.4",
|
||||
"vue-router": "^4.3.0",
|
||||
"vuetify": "^3.5.14",
|
||||
"vue-router": "^4.3.2",
|
||||
"vuetify": "^3.5.16",
|
||||
"wcag-color": "^1.1.1",
|
||||
"xml-js": "^1.6.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3.0.2",
|
||||
"@eslint/js": "^9.1.1",
|
||||
"@tauri-apps/cli": "^1.5.11",
|
||||
"@types/color-convert": "^2.0.3",
|
||||
"@types/js-md5": "^0.7.2",
|
||||
"@types/node": "^20.12.4",
|
||||
"@types/node": "^20.12.7",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
||||
"@typescript-eslint/parser": "^7.5.0",
|
||||
"@typescript-eslint/parser": "^7.7.1",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"concurrently": "^8.2.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint": "^9.1.1",
|
||||
"eslint-config-love": "^47.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jsonc": "^2.15.0",
|
||||
"eslint-plugin-n": "^16.6.2",
|
||||
"eslint-plugin-jsonc": "^2.15.1",
|
||||
"eslint-plugin-n": "^17.2.1",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-vue": "^9.24.0",
|
||||
"eslint-plugin-vue": "^9.25.0",
|
||||
"eslint-plugin-yml": "^1.14.0",
|
||||
"globals": "^15.0.0",
|
||||
"husky": "^9.0.11",
|
||||
"jsonc-eslint-parser": "^2.4.0",
|
||||
"lint-staged": "^15.2.2",
|
||||
"oxlint": "^0.2.15",
|
||||
"oxlint": "^0.3.1",
|
||||
"prettier": "3.2.5",
|
||||
"stylelint": "^16.3.1",
|
||||
"stylelint-config-idiomatic-order": "^10.0.0",
|
||||
@@ -119,10 +122,12 @@
|
||||
"stylelint-high-performance-animation": "^1.10.0",
|
||||
"stylelint-order": "^6.0.4",
|
||||
"stylelint-prettier": "^5.0.0",
|
||||
"typescript": "^5.4.4",
|
||||
"vite": "^5.2.8",
|
||||
"vite-plugin-vue-devtools": "^7.0.25",
|
||||
"typescript": "^5.4.5",
|
||||
"typescript-eslint": "^7.7.1",
|
||||
"vite": "^5.2.10",
|
||||
"vite-plugin-vue-devtools": "^7.0.27",
|
||||
"vite-plugin-vuetify": "^2.0.3",
|
||||
"vue-eslint-parser": "^9.4.2",
|
||||
"yaml-eslint-parser": "^1.2.2"
|
||||
}
|
||||
}
|
||||
|
||||
848
pnpm-lock.yaml
generated
848
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"moduleResolution": "NodeNext",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"sourceMap": true,
|
||||
@@ -16,13 +16,16 @@
|
||||
"composite": true
|
||||
},
|
||||
"include": [
|
||||
"*.yml",
|
||||
"**/*.yml",
|
||||
"**/*.yaml",
|
||||
"package.json",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.ts",
|
||||
"src/**/*.vue",
|
||||
"src/data/**/*.json",
|
||||
"tsconfig.json",
|
||||
"vite.config.ts"
|
||||
]
|
||||
"vite.config.ts",
|
||||
"eslint.config.js"
|
||||
],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user