Skip to content

Commit

Permalink
Merge remote-tracking branch 'zjutjh/master' into refactor/state-mana…
Browse files Browse the repository at this point in the history
…ge-hookify
  • Loading branch information
j10ccc committed Oct 12, 2024
2 parents 5c0b36d + 901bd0d commit 7757ca9
Show file tree
Hide file tree
Showing 123 changed files with 2,943 additions and 1,559 deletions.
39 changes: 0 additions & 39 deletions .eslintrc.json

This file was deleted.

7 changes: 5 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 9
run_install: false

- name: Get pnpm store directory
Expand All @@ -43,5 +43,8 @@ jobs:
run: |
echo "${{ secrets.ENV_FILE }}" > .env
- name: Lint project
run: pnpm lint

- name: Build Taro weapp
run: pnpm build:weapp
2 changes: 1 addition & 1 deletion config/dev.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
env: {
NODE_ENV: "\"development\"",
NODE_ENV: "\"development\""
},
defineConstants: {},
mini: {},
Expand Down
2 changes: 1 addition & 1 deletion config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const config = {
}
};

module.exports = function (merge) {
module.exports = function(merge) {
const myEnvParsed = Object.keys(myEnv.parsed).reduce((acc, cur) => {
acc[cur] = JSON.stringify(myEnv.parsed[cur]);
return acc;
Expand Down
2 changes: 1 addition & 1 deletion config/prod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
env: {
NODE_ENV: "\"production\"",
NODE_ENV: "\"production\""
},
defineConstants: {},
mini: {},
Expand Down
98 changes: 98 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import js from "@eslint/js";
import vueEslintPlugin from "eslint-plugin-vue";
import importPlugin from "eslint-plugin-import";
import stylisticEslintPlugin from "@stylistic/eslint-plugin";
import vueTsEslintConfig from "@vue/eslint-config-typescript";
import globals from "globals";

export default [
js.configs.recommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
...vueEslintPlugin.configs["flat/recommended"],
...vueTsEslintConfig(),
{
plugins: {
"@stylistic": stylisticEslintPlugin
},
rules: {
"camelcase": "warn",
"no-warning-comments": "warn",
"no-console": ["warn", { allow: [ "warn", "error" ] }],
"no-var": "error",
"no-undef": "off", // ts 和 vue lang="ts" 中,eslint 无法识别全局类型定义,所以关闭。仅靠 ts 就能检查未定义的变量
"prefer-const": "warn",

"@stylistic/indent": ["error", 2],
"@stylistic/keyword-spacing": "error",
"@stylistic/key-spacing": "error",
"@stylistic/no-trailing-spaces": "error",
"@stylistic/linebreak-style": ["error", "unix"],
"@stylistic/quotes": ["error", "double"],
"@stylistic/function-call-spacing": "error",
"@stylistic/semi": "error",
"@stylistic/no-multiple-empty-lines": ["warn", { max: 1 }],
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/arrow-spacing": "error",
"@stylistic/block-spacing": "error",
"@stylistic/brace-style": "error",
"@stylistic/comma-dangle": "error",
"@stylistic/no-multi-spaces": "error",
"@stylistic/comma-spacing": "error",
"@stylistic/switch-colon-spacing": "error",
"@stylistic/type-annotation-spacing": "error",

"@stylistic/space-before-blocks": "error",
"@stylistic/space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"@stylistic/space-in-parens": "error",
"@stylistic/space-infix-ops": "error",
"@stylistic/spaced-comment": "error",

"@typescript-eslint/no-explicit-any": "off"
},
settings: {
"import/resolver": {
"typescript": true
}
}
},
{
files: ["**/*.vue"],
rules: {
"vue/multi-word-component-names": "off",
"vue/component-name-in-template-casing": ["error", "kebab-case", { "registeredComponentsOnly": true }],
"vue/max-attributes-per-line": ["error", { "singleline": { "max": 3 } }]
}
},
{
files: ["config/*.js"],
rules: {
"@typescript-eslint/no-require-imports": "off"
}
},
{
files: ["**/*.{js,mjs,cjs}"],
rules: {
"no-undef": "error"
}
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
ignores: [
"dist/*",
".swc/*",
".github/*"
]
}
];
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"css": "sass"
},
"scripts": {
"lint": "eslint",
"build:weapp": "taro build --type weapp",
"build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay",
Expand Down Expand Up @@ -58,25 +59,26 @@
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@stylistic/eslint-plugin": "^2.9.0",
"@tarojs/cli": "3.6.8",
"@tarojs/webpack5-runner": "3.6.8",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@vue/babel-plugin-jsx": "^1.0.6",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/eslint-config-typescript": "^14.0.0",
"babel-preset-taro": "3.6.8",
"css-loader": "3.4.2",
"dotenv": "^16.0.3",
"eslint": "^8.12.0",
"eslint-config-taro": "3.6.8",
"eslint-plugin-vue": "^8.0.0",
"eslint": "^9.12.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-vue": "^9.28.0",
"globals": "^15.11.0",
"postcss": "^8.4.18",
"style-loader": "1.3.0",
"stylelint": "^14.4.0",
"typescript": "^4.1.0",
"vue-loader": "^17.0.0",
"webpack": "5.69.0"
}
}
}
Loading

0 comments on commit 7757ca9

Please sign in to comment.