From 2487961a2ccadd62fc463e60200bf71a785e0716 Mon Sep 17 00:00:00 2001 From: ocean_gao Date: Tue, 23 Apr 2024 10:49:20 +0800 Subject: [PATCH] =?UTF-8?q?build:=20eslint=20=E7=9B=B8=E5=85=B3=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9=20(#758)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * eslint相关配置同步修改 * eslint相关配置完善 --- .eslintrc.js => .eslintrc.cjs | 2 +- .prettierrc.js => .prettierrc.cjs | 2 +- .stylelintrc.js => .stylelintrc.cjs | 0 babel.config.js => babel.config.cjs | 2 +- commitlint.config.cjs | 1 + commitlint.config.js | 1 - package.json | 2 +- tsconfig.eslint.json | 9 +++++---- 8 files changed, 10 insertions(+), 9 deletions(-) rename .eslintrc.js => .eslintrc.cjs (99%) rename .prettierrc.js => .prettierrc.cjs (86%) rename .stylelintrc.js => .stylelintrc.cjs (100%) rename babel.config.js => babel.config.cjs (86%) create mode 100644 commitlint.config.cjs delete mode 100644 commitlint.config.js diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 99% rename from .eslintrc.js rename to .eslintrc.cjs index 25991c45..8c040b15 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -1,4 +1,4 @@ -export default { +module.exports = { extends: ['@webank/eslint-config-ts/vue'], parserOptions: { diff --git a/.prettierrc.js b/.prettierrc.cjs similarity index 86% rename from .prettierrc.js rename to .prettierrc.cjs index f704e198..5f5d0dda 100644 --- a/.prettierrc.js +++ b/.prettierrc.cjs @@ -1,4 +1,4 @@ -export default { +module.exports = { semi: true, trailingComma: 'all', singleQuote: true, diff --git a/.stylelintrc.js b/.stylelintrc.cjs similarity index 100% rename from .stylelintrc.js rename to .stylelintrc.cjs diff --git a/babel.config.js b/babel.config.cjs similarity index 86% rename from babel.config.js rename to babel.config.cjs index fe728cfe..58306db1 100644 --- a/babel.config.js +++ b/babel.config.cjs @@ -1,5 +1,5 @@ // for jest -export default { +module.exports = { presets: [['@babel/preset-env', { targets: { node: 'current' } }]], plugins: ['@vue/babel-plugin-jsx'], }; diff --git a/commitlint.config.cjs b/commitlint.config.cjs new file mode 100644 index 00000000..422b1944 --- /dev/null +++ b/commitlint.config.cjs @@ -0,0 +1 @@ +module.exports = { extends: ['@commitlint/config-conventional'] }; diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index 3f5e287f..00000000 --- a/commitlint.config.js +++ /dev/null @@ -1 +0,0 @@ -export default { extends: ['@commitlint/config-conventional'] }; diff --git a/package.json b/package.json index 80813458..b3d8edab 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "build": "npm run build:version && npm run build:esm && npm run build:type && cp -rf es/icon . && npm run build:esm-browser && npm run build:umd && npm run build:style && npm run build:icon", "release": "node scripts/release.js", "lint-staged": "lint-staged --allow-empty", - "commitlint": "commitlint --config commitlint.config.js -e -V", + "commitlint": "commitlint --config commitlint.config.cjs -e -V", "lint:script": "eslint --ext .js,.ts,.vue,.tsx ./components --fix", "lint:style": "stylelint 'components/**/*.less' --fix", "lint:docs-script": "eslint --ext .js,.ts,.vue,.tsx ./docs/.vitepress/components --fix", diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index f5632aeb..bdd7adbd 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -17,10 +17,11 @@ "docs/.vitepress/**/*.vue", /* 与 tsconfig.json 保持一致 End */ "scripts/**/*.js", - "./.eslintrc.js", - "./.prettierrc.js", - "./babel.config.js", - "./commitlint.config.js", + "./.eslintrc.cjs", + "./.prettierrc.cjs", + "./.stylelintrc.cjs", + "./babel.config.cjs", + "./commitlint.config.cjs", "./jest.config.cjs", "./jest.setup.cjs" ],