feat: add eslint

This commit is contained in:
unanmed 2024-12-30 22:34:17 +08:00
parent 08f5d49e00
commit 0c399a03fe
5 changed files with 900 additions and 2 deletions

View File

@ -13,4 +13,4 @@ public/editor.html
keyCodes.ts
src/core/main/setting.ts
src/core/fx/shadow.ts
src/core/fx/shadow_upload.js
dist/

View File

@ -1,3 +1,9 @@
{
"recommendations": ["Vue.volar"]
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"vue.volar",
"slevesque.shader",
"tobermory.es6-string-html"
]
}

68
eslint.config.js Normal file
View File

@ -0,0 +1,68 @@
import eslint from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import eslintPluginVue from 'eslint-plugin-vue';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
export default tseslint.config(
{
ignores: ['node_modules', 'dist', 'public']
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...eslintPluginVue.configs['flat/recommended'],
{
files: ['**/*.{js,mjs,cjs,vue}'],
rules: {
'no-console': 'warn'
}
},
{
languageOptions: {
globals: {
...globals.browser,
wx: true
}
}
},
{
files: ['**/*.vue'],
languageOptions: {
parserOptions: {
parser: tseslint.parser,
ecmaVersion: 'latest',
ecmaFeatures: {
jsx: true
}
}
},
rules: {
'vue/no-mutating-props': [
'error',
{
shallowOnly: true
}
]
}
},
{
files: ['**/*.{ts,tsx,vue}'],
rules: {
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true
}
]
}
},
eslintPluginPrettierRecommended
);

View File

@ -53,15 +53,20 @@
"@vitejs/plugin-vue-jsx": "^3.1.0",
"chokidar": "^3.6.0",
"compressing": "^1.10.1",
"eslint": "^9.17.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-vue": "^9.32.0",
"fontmin": "^0.9.9",
"form-data": "^4.0.0",
"fs-extra": "^10.1.0",
"globals": "^15.14.0",
"less": "^4.2.0",
"postcss-preset-env": "^9.6.0",
"rollup": "^3.29.4",
"terser": "^5.31.6",
"tsx": "^4.17.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.18.2",
"unplugin-vue-components": "^0.22.12",
"vite": "^4.5.3",
"vue-tsc": "^2.1.6",

File diff suppressed because it is too large Load Diff