@gct-paas/cli 0.0.1-dev.1 → 0.0.1-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bin.d.ts +2 -0
  3. package/dist/commands/index.d.ts +5 -0
  4. package/dist/commands/index.mjs +14 -0
  5. package/dist/core/commitlint/commitlint-config/commitlint-config.d.ts +9 -0
  6. package/dist/core/commitlint/commitlint-config/commitlint-config.mjs +28 -0
  7. package/dist/core/commitlint/index.mjs +1 -0
  8. package/dist/core/constants/index.d.ts +12 -0
  9. package/dist/core/constants/index.mjs +23 -0
  10. package/dist/core/eslint/eslint-config/eslint-config.d.ts +9 -0
  11. package/dist/core/eslint/eslint-config/eslint-config.mjs +109 -0
  12. package/dist/core/eslint/index.mjs +1 -0
  13. package/dist/core/index.mjs +7 -0
  14. package/dist/core/prettier/index.mjs +1 -0
  15. package/dist/core/prettier/prettier-config/prettier-config.d.ts +22 -0
  16. package/dist/core/prettier/prettier-config/prettier-config.mjs +26 -0
  17. package/dist/core/rollup/index.mjs +2 -0
  18. package/dist/core/rollup/rollup-config/dev-config.d.ts +9 -0
  19. package/dist/core/rollup/rollup-config/dev-config.mjs +98 -0
  20. package/dist/core/rollup/rollup-plugins/copy-file.d.ts +37 -0
  21. package/dist/core/rollup/rollup-plugins/copy-file.mjs +18 -0
  22. package/dist/core/rollup/rollup-plugins/ignore-compiler-file.d.ts +8 -0
  23. package/dist/core/rollup/rollup-plugins/ignore-compiler-file.mjs +17 -0
  24. package/dist/core/rollup/rollup-plugins/index.mjs +2 -0
  25. package/dist/core/stylelint/index.mjs +1 -0
  26. package/dist/core/stylelint/stylelint-config/stylelint-config.d.ts +9 -0
  27. package/dist/core/stylelint/stylelint-config/stylelint-config.mjs +21 -0
  28. package/{src/core/util/index.ts → dist/core/util/index.d.ts} +2 -8
  29. package/dist/core/util/index.mjs +7 -0
  30. package/dist/core/util/watcher/watcher.d.ts +61 -0
  31. package/{src/core/util/watcher/watcher.ts → dist/core/util/watcher/watcher.mjs} +33 -54
  32. package/dist/core/vite/index.d.ts +2 -0
  33. package/dist/core/vite/index.mjs +2 -0
  34. package/dist/core/vite/vite-config/vite-config.d.ts +9 -0
  35. package/dist/core/vite/vite-config/vite-config.mjs +68 -0
  36. package/dist/core/vite/vite-config/vite-dev-config.d.ts +9 -0
  37. package/dist/core/vite/vite-config/vite-dev-config.mjs +19 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/interface/i-command/i-command.d.ts +28 -0
  40. package/dist/interface/i-command/i-command.mjs +0 -0
  41. package/dist/interface/index.mjs +1 -0
  42. package/dist/utils/index.d.ts +1 -0
  43. package/dist/utils/index.mjs +4 -0
  44. package/dist/utils/local-binaries/local-binaries.d.ts +3 -0
  45. package/dist/utils/local-binaries/local-binaries.mjs +11 -0
  46. package/package.json +7 -3
  47. package/src/bin.ts +0 -5
  48. package/src/commands/index.ts +0 -16
  49. package/src/core/commitlint/commitlint-config/commitlint-config.ts +0 -37
  50. package/src/core/constants/index.ts +0 -8
  51. package/src/core/eslint/eslint-config/eslint-config.ts +0 -122
  52. package/src/core/prettier/prettier-config/prettier-config.ts +0 -48
  53. package/src/core/rollup/rollup-config/dev-config.ts +0 -135
  54. package/src/core/rollup/rollup-plugins/copy-file.ts +0 -57
  55. package/src/core/rollup/rollup-plugins/ignore-compiler-file.ts +0 -25
  56. package/src/core/stylelint/stylelint-config/stylelint-config.ts +0 -28
  57. package/src/core/vite/index.ts +0 -1
  58. package/src/core/vite/vite-config/vite-config.ts +0 -59
  59. package/src/index.ts +0 -36
  60. package/src/interface/i-command/i-command.ts +0 -29
  61. package/src/utils/index.ts +0 -4
  62. package/src/utils/local-binaries/local-binaries.ts +0 -16
  63. /package/{src/core/commitlint/index.ts → dist/core/commitlint/index.d.ts} +0 -0
  64. /package/{src/core/eslint/index.ts → dist/core/eslint/index.d.ts} +0 -0
  65. /package/{src/core/index.ts → dist/core/index.d.ts} +0 -0
  66. /package/{src/core/prettier/index.ts → dist/core/prettier/index.d.ts} +0 -0
  67. /package/{src/core/rollup/index.ts → dist/core/rollup/index.d.ts} +0 -0
  68. /package/{src/core/rollup/rollup-plugins/index.ts → dist/core/rollup/rollup-plugins/index.d.ts} +0 -0
  69. /package/{src/core/stylelint/index.ts → dist/core/stylelint/index.d.ts} +0 -0
  70. /package/{src/interface/index.ts → dist/interface/index.d.ts} +0 -0
  71. /package/{src → dist}/types/index.d.ts +0 -0
@@ -1,24 +1,11 @@
1
- import * as chokidar from 'chokidar';
2
- import fs from 'fs-extra';
3
- import path from 'path';
4
- import * as rimraf from 'rimraf';
5
- import { copyFileSync } from 'copy-file';
6
- import consola from 'consola';
7
- import colors from 'picocolors';
8
- import { EventName } from 'chokidar/handler';
9
- import { merge } from 'lodash-es';
10
-
11
- /**
12
- * 文件监控类
13
- *
14
- * @author chitanda
15
- * @date 2022-05-24 14:05:22
16
- * @export
17
- * @class CopyWatch
18
- */
1
+ import * as chokidar from "chokidar";
2
+ import path from "path";
3
+ import * as rimraf from "rimraf";
4
+ import { copyFileSync } from "copy-file";
5
+ import consola from "consola";
6
+ import colors from "picocolors";
7
+ import { merge } from "lodash-es";
19
8
  export class CopyWatch {
20
- protected w: chokidar.FSWatcher;
21
-
22
9
  /**
23
10
  * Creates an instance of CopyWatch.
24
11
  *
@@ -27,26 +14,25 @@ export class CopyWatch {
27
14
  * @param {string[]} dir 需要监控的目录
28
15
  * @param {string} copyDir 需要拷贝到的目录
29
16
  */
30
- constructor(
31
- public dir: string,
32
- public copyDir: string,
33
- opts: chokidar.ChokidarOptions = {},
34
- ) {
17
+ constructor(dir, copyDir, opts = {}) {
18
+ this.dir = dir;
19
+ this.copyDir = copyDir;
35
20
  this.w = chokidar.watch(
36
21
  this.dir,
37
22
  merge(
38
23
  {
39
24
  awaitWriteFinish: {
40
- stabilityThreshold: 300, // 等待0.3秒防抖
41
- },
25
+ stabilityThreshold: 300
26
+ // 等待0.3秒防抖
27
+ }
42
28
  },
43
- opts,
44
- ),
29
+ opts
30
+ )
45
31
  );
46
- consola.debug(`拷贝监控文件夹: ${this.dir}`);
32
+ consola.debug(`\u62F7\u8D1D\u76D1\u63A7\u6587\u4EF6\u5939: ${this.dir}`);
47
33
  this.init();
48
34
  }
49
-
35
+ w;
50
36
  /**
51
37
  * 初始化
52
38
  *
@@ -54,13 +40,12 @@ export class CopyWatch {
54
40
  * @date 2022-05-24 14:05:34
55
41
  * @protected
56
42
  */
57
- protected init(): void {
43
+ init() {
58
44
  this.watchAll = this.watchAll.bind(this);
59
45
  this.watchErr = this.watchErr.bind(this);
60
- this.w.on('all', this.watchAll);
61
- this.w.on('error', this.watchErr);
46
+ this.w.on("all", this.watchAll);
47
+ this.w.on("error", this.watchErr);
62
48
  }
63
-
64
49
  /**
65
50
  * 文件监控变更
66
51
  *
@@ -71,11 +56,7 @@ export class CopyWatch {
71
56
  * @param {string} pathStr
72
57
  * @param {(fs.Stats)} [stats]
73
58
  */
74
- protected watchAll(
75
- eventName: EventName,
76
- pathStr: string,
77
- stats?: fs.Stats,
78
- ): void {
59
+ watchAll(eventName, pathStr, stats) {
79
60
  if (stats && stats.size <= 0) {
80
61
  return;
81
62
  }
@@ -83,24 +64,23 @@ export class CopyWatch {
83
64
  const source = path.resolve(cwd, pathStr);
84
65
  const target = path.resolve(this.copyDir, path.relative(this.dir, pathStr));
85
66
  switch (eventName) {
86
- case 'add':
87
- case 'change':
67
+ case "add":
68
+ case "change":
88
69
  consola.info(
89
- `拷贝文件: ${colors.cyan(source)} => ${colors.cyan(target)}`,
70
+ `\u62F7\u8D1D\u6587\u4EF6: ${colors.cyan(source)} => ${colors.cyan(target)}`
90
71
  );
91
72
  copyFileSync(source, target);
92
73
  break;
93
- case 'addDir':
74
+ case "addDir":
94
75
  break;
95
- case 'unlink':
96
- case 'unlinkDir':
97
- consola.info(`删除文件或目录: ${target}`);
76
+ case "unlink":
77
+ case "unlinkDir":
78
+ consola.info(`\u5220\u9664\u6587\u4EF6\u6216\u76EE\u5F55: ${target}`);
98
79
  rimraf.sync(target);
99
80
  break;
100
81
  default:
101
82
  }
102
83
  }
103
-
104
84
  /**
105
85
  * 文件监控异常
106
86
  *
@@ -110,19 +90,18 @@ export class CopyWatch {
110
90
  * @param {string} path
111
91
  * @param {(fs.Stats | undefined)} [stats]
112
92
  */
113
- protected watchErr(err: unknown): void {
114
- consola.error(`监控文件发生错误: ${err}`);
93
+ watchErr(err) {
94
+ consola.error(`\u76D1\u63A7\u6587\u4EF6\u53D1\u751F\u9519\u8BEF: ${err}`);
115
95
  }
116
-
117
96
  /**
118
97
  * 停止监控
119
98
  *
120
99
  * @author chitanda
121
100
  * @date 2022-05-24 14:05:06
122
101
  */
123
- unwatch(): void {
124
- this.w.off('all', this.watchAll);
125
- this.w.off('error', this.watchErr);
102
+ unwatch() {
103
+ this.w.off("all", this.watchAll);
104
+ this.w.off("error", this.watchErr);
126
105
  this.w.unwatch(this.dir);
127
106
  this.w.close();
128
107
  }
@@ -0,0 +1,2 @@
1
+ export { defineViteConfig } from './vite-config/vite-config';
2
+ export { defineDevViteConfig } from './vite-config/vite-dev-config';
@@ -0,0 +1,2 @@
1
+ export { defineViteConfig } from "./vite-config/vite-config.mjs";
2
+ export { defineDevViteConfig } from "./vite-config/vite-dev-config.mjs";
@@ -0,0 +1,9 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 构建 vite 通用配置,基于此配置构建其他 vite 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineViteConfig(opts?: UserConfig): UserConfig;
@@ -0,0 +1,68 @@
1
+ import { defineConfig, mergeConfig } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
3
+ import vueJsx from "@vitejs/plugin-vue-jsx";
4
+ import { babel } from "@rollup/plugin-babel";
5
+ import json from "@rollup/plugin-json";
6
+ import path from "path";
7
+ import * as rf from "rimraf";
8
+ import { DEFAULT_EXTERNAL } from "../../constants/index.mjs";
9
+ export function defineViteConfig(opts = {}) {
10
+ const cwd = process.cwd();
11
+ const outDir = path.resolve(cwd, "dist");
12
+ rf.sync(outDir);
13
+ return mergeConfig(
14
+ defineConfig({
15
+ css: {
16
+ preprocessorOptions: {
17
+ scss: {
18
+ additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
19
+ }
20
+ }
21
+ },
22
+ build: {
23
+ outDir,
24
+ rollupOptions: {
25
+ external: DEFAULT_EXTERNAL
26
+ },
27
+ lib: {
28
+ entry: path.resolve(cwd, "src/index.ts"),
29
+ formats: ["system", "cjs"],
30
+ fileName(format) {
31
+ if (format === "system" || format === "systemjs") {
32
+ return `[name].system.min.js`;
33
+ }
34
+ if (format === "cjs" || format === "commonjs") {
35
+ return `[name].min.cjs`;
36
+ }
37
+ return `[name].${format}.min.js`;
38
+ }
39
+ }
40
+ },
41
+ plugins: [
42
+ json(),
43
+ vue(),
44
+ vueJsx(),
45
+ babel({
46
+ babelHelpers: "bundled",
47
+ presets: [
48
+ [
49
+ "@babel/preset-env",
50
+ {
51
+ useBuiltIns: "usage",
52
+ corejs: 3,
53
+ bugfixes: true,
54
+ targets: {
55
+ chrome: "85",
56
+ edge: "85",
57
+ firefox: "79",
58
+ safari: "14.1"
59
+ }
60
+ }
61
+ ]
62
+ ]
63
+ })
64
+ ]
65
+ }),
66
+ opts
67
+ );
68
+ }
@@ -0,0 +1,9 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 构建本地开发 vite 通用配置,基于此配置构建其他 vite 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineDevViteConfig(opts?: UserConfig): UserConfig;
@@ -0,0 +1,19 @@
1
+ import { defineConfig, mergeConfig } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
3
+ import vueJsx from "@vitejs/plugin-vue-jsx";
4
+ import json from "@rollup/plugin-json";
5
+ export function defineDevViteConfig(opts = {}) {
6
+ return mergeConfig(
7
+ defineConfig({
8
+ css: {
9
+ preprocessorOptions: {
10
+ scss: {
11
+ additionalData: `@use "@gct-paas/scss/style/global.scss" as *;`
12
+ }
13
+ }
14
+ },
15
+ plugins: [json(), vue(), vueJsx()]
16
+ }),
17
+ opts
18
+ );
19
+ }
@@ -0,0 +1,2 @@
1
+ export declare function bootstrap(): Promise<void>;
2
+ export * from './core';
@@ -0,0 +1,28 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * 命令项
4
+ *
5
+ * @author chitanda
6
+ * @date 2021-12-18 15:12:13
7
+ * @export
8
+ * @interface ICommand
9
+ */
10
+ export interface ICommand {
11
+ /**
12
+ * 加载命令
13
+ *
14
+ * @author chitanda
15
+ * @date 2021-12-18 15:12:22
16
+ * @param {Command} program
17
+ */
18
+ load(program: Command): void;
19
+ /**
20
+ * 执行行为
21
+ *
22
+ * @author chitanda
23
+ * @date 2021-12-21 16:12:22
24
+ * @param {...unknown[]} args
25
+ * @return {*} {(void | Promise<void>)}
26
+ */
27
+ action(...args: unknown[]): void | Promise<void>;
28
+ }
File without changes
@@ -0,0 +1 @@
1
+ export * from "./i-command/i-command.mjs";
@@ -0,0 +1 @@
1
+ export { localBinExists, loadLocalBinCommandLoader, } from './local-binaries/local-binaries';
@@ -0,0 +1,4 @@
1
+ export {
2
+ localBinExists,
3
+ loadLocalBinCommandLoader
4
+ } from "./local-binaries/local-binaries.mjs";
@@ -0,0 +1,3 @@
1
+ import { CommandLoader } from '../../commands/index';
2
+ export declare function localBinExists(): boolean;
3
+ export declare function loadLocalBinCommandLoader(): typeof CommandLoader;
@@ -0,0 +1,11 @@
1
+ import { join, posix } from "path";
2
+ import fs from "fs-extra";
3
+ const localBinPathSegments = [process.cwd(), "node_modules", "@nestjs", "cli"];
4
+ export function localBinExists() {
5
+ return fs.existsSync(join(...localBinPathSegments));
6
+ }
7
+ export function loadLocalBinCommandLoader() {
8
+ const path = posix.join(...localBinPathSegments, "commands");
9
+ const commandsFile = require(path);
10
+ return commandsFile.CommandLoader;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/cli",
3
- "version": "0.0.1-dev.1",
3
+ "version": "0.0.1-dev.4",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  "main": "dist/index.mjs",
10
10
  "types": "dist/index.d.ts",
11
11
  "files": [
12
- "src",
12
+ "dist",
13
13
  "CHANGELOG.md",
14
14
  "README.md"
15
15
  ],
@@ -38,6 +38,7 @@
38
38
  "@commitlint/cli": "^19.6.1",
39
39
  "@commitlint/config-conventional": "^19.6.0",
40
40
  "@eslint/js": "^9.17.0",
41
+ "@gct-paas/scss": "workspace:*",
41
42
  "@rollup/plugin-babel": "^6.0.4",
42
43
  "@rollup/plugin-commonjs": "^28.0.2",
43
44
  "@rollup/plugin-eslint": "^9.0.5",
@@ -50,8 +51,10 @@
50
51
  "commander": "^13.0.0",
51
52
  "consola": "^3.3.3",
52
53
  "copy-file": "^11.0.0",
54
+ "core-js": "^3.40.0",
53
55
  "cpy": "^11.1.0",
54
56
  "eslint": "^9.17.0",
57
+ "eslint-config-prettier": "^9.1.0",
55
58
  "eslint-plugin-import": "^2.31.0",
56
59
  "eslint-plugin-prettier": "^5.2.1",
57
60
  "eslint-plugin-unused-imports": "^4.1.4",
@@ -81,5 +84,6 @@
81
84
  "@types/node": "^22.10.5",
82
85
  "typescript": "^5.7.2",
83
86
  "unbuild": "^3.2.0"
84
- }
87
+ },
88
+ "gitHead": "517219a1f78c7ffb3ce4bc77d076be2dfbbc5180"
85
89
  }
package/src/bin.ts DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { bootstrap } from './index';
4
-
5
- bootstrap();
@@ -1,16 +0,0 @@
1
- import { consola } from 'consola';
2
- import { Command } from 'commander';
3
-
4
- export class CommandLoader {
5
- public static load(program: Command): void {
6
- this.handleInvalidCommand(program);
7
- }
8
-
9
- private static handleInvalidCommand(program: Command) {
10
- program.on('command:*', () => {
11
- consola.error(`未支持的命令: `, program.args.join(' '));
12
- consola.log(`请使用 --help 查看已支持的命令.\n`);
13
- process.exit(1);
14
- });
15
- }
16
- }
@@ -1,37 +0,0 @@
1
- import { merge } from 'lodash-es';
2
- import type { UserConfig } from '@commitlint/types';
3
-
4
- /**
5
- * 基于基础配置,定义 commitlint 配置
6
- *
7
- * @export
8
- * @param {UserConfig} [config={}]
9
- * @returns {*} {UserConfig}
10
- */
11
- export function defineCommitlintConfig(config: UserConfig = {}): UserConfig {
12
- return merge(
13
- {
14
- extends: ['@commitlint/config-conventional'],
15
- rules: {
16
- 'type-enum': [
17
- 2,
18
- 'always',
19
- [
20
- 'feat',
21
- 'fix',
22
- 'docs',
23
- 'style',
24
- 'refactor',
25
- 'test',
26
- 'perf',
27
- 'revert',
28
- 'build',
29
- 'chore',
30
- 'release',
31
- ],
32
- ],
33
- },
34
- },
35
- config,
36
- );
37
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * 开发模式标识,匹配环境变量中的 NODE_ENV
3
- */
4
- export const DEV_MODE = 'development';
5
- /**
6
- * 生产编译模式标识,匹配环境变量中的 NODE_ENV
7
- */
8
- export const PROD_MODE = 'production';
@@ -1,122 +0,0 @@
1
- import eslint from '@eslint/js';
2
- import tsEslint, {
3
- ConfigArray,
4
- InfiniteDepthConfigWithExtends,
5
- } from 'typescript-eslint';
6
- import eslintPluginVue from 'eslint-plugin-vue';
7
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
8
- import unusedImports from 'eslint-plugin-unused-imports';
9
- import eslintPluginImport from 'eslint-plugin-import';
10
- import globals from 'globals';
11
-
12
- /**
13
- * 基于基础规则,定义 eslint 配置
14
- *
15
- * @export
16
- * @param {...InfiniteDepthConfigWithExtends[]} configs
17
- * @returns {*} {ConfigArray}
18
- */
19
- export function defineEslintConfig(
20
- ...configs: InfiniteDepthConfigWithExtends[]
21
- ): ConfigArray {
22
- return tsEslint.config(
23
- /** js推荐配置 */
24
- eslint.configs.recommended,
25
- /** ts推荐配置 */
26
- tsEslint.configs.strict,
27
- tsEslint.configs.stylistic,
28
- /** vue推荐配置 */
29
- eslintPluginVue.configs['flat/recommended'],
30
- eslintPluginPrettierRecommended,
31
- eslintPluginImport.flatConfigs.recommended,
32
- eslintPluginImport.flatConfigs.warnings,
33
- eslintPluginImport.flatConfigs.errors,
34
- eslintPluginImport.flatConfigs.typescript,
35
- {
36
- ignores: [
37
- '**/node_modules',
38
- 'lerna.json',
39
- 'package.json',
40
- 'tsconfig.json',
41
- 'pnpm-lock.yaml',
42
- 'pnpm-workspace.yaml',
43
- 'eslint.config.mjs',
44
- '**/dist',
45
- '**/out',
46
- '**/es',
47
- '**/lib',
48
- ],
49
- files: ['**/*.ts', '**.*.tsx', '**/*.vue'],
50
- plugins: {
51
- 'unused-imports': unusedImports,
52
- },
53
- languageOptions: {
54
- globals: {
55
- ...globals.browser,
56
- },
57
- parserOptions: {
58
- ecmaFeatures: {
59
- // 全局严格模式
60
- impliedStrict: true,
61
- // 启用 jsx
62
- jsx: true,
63
- },
64
- },
65
- },
66
- rules: {
67
- // 基础配置覆盖
68
- 'no-console': 'off',
69
- 'no-debugger': 'off',
70
- 'no-undef': 'off',
71
- 'no-plusplus': [
72
- 'error',
73
- {
74
- allowForLoopAfterthoughts: true,
75
- },
76
- ],
77
- 'no-underscore-dangle': 'off',
78
- 'no-restricted-syntax': 'off',
79
- 'no-continue': 'off',
80
- 'no-unused-vars': 'off',
81
- 'no-extraneous-class': 'off',
82
- 'no-param-reassign': 'off',
83
- 'no-useless-constructor': 'off',
84
- 'no-empty-function': 'off',
85
- // unused-imports 配置覆盖
86
- 'unused-imports/no-unused-imports': 'error',
87
- 'consistent-return': 'off',
88
- 'func-names': 'off',
89
- // import 配置覆盖
90
- 'import/no-unresolved': 'off',
91
- 'import/extensions': 'off',
92
- 'import/prefer-default-export': 'off',
93
- // vue 配置覆盖
94
- 'vue/no-setup-props-destructure': 'off',
95
- 'vue/require-default-prop': 'off',
96
- // typescript 配置覆盖
97
- '@typescript-eslint/no-unused-vars': [
98
- 'error',
99
- {
100
- argsIgnorePattern: '^_',
101
- },
102
- ],
103
- '@typescript-eslint/no-inferrable-types': 'off',
104
- '@typescript-eslint/no-explicit-any': ['error'],
105
- '@typescript-eslint/explicit-module-boundary-types': 'error',
106
- '@typescript-eslint/no-non-null-assertion': 'off',
107
- '@typescript-eslint/no-extraneous-class': 'off',
108
- // 其他配置覆盖
109
- 'class-methods-use-this': 'off',
110
- 'prefer-destructuring': 'off',
111
- },
112
- },
113
- {
114
- name: 'ts-vue-override',
115
- files: ['**/*.vue'],
116
- rules: {
117
- '@typescript-eslint/no-unused-vars': 'off',
118
- },
119
- },
120
- ...configs,
121
- );
122
- }
@@ -1,48 +0,0 @@
1
- import { merge } from 'lodash-es';
2
- import { Options } from 'prettier';
3
-
4
- /**
5
- * 基于基础配置,定义 prettier 配置
6
- *
7
- * @description 提交信息规范,提交格式: type: description
8
- * feat: 新功能(feature)
9
- * fix: 修补bug
10
- * docs: 文档(documentation)
11
- * style: 格式(不影响代码运行的变动)
12
- * refactor: 重构(即不是新增功能,也不是修改bug的代码变动)
13
- * test: 增加测试,或测试变更
14
- * perf : 性能优化
15
- * revert: 撤销上一次的提交
16
- * build: 构建工具或构建过程等的变动,如:关联包升级等
17
- * chore: 其他修改(不在上述类型中的修改)
18
- * release: 发布新版本
19
- *
20
- * @export
21
- * @param {Options} config
22
- * @returns {*} {Options}
23
- */
24
- export function definePrettierConfig(config: Options = {}): Options {
25
- return merge(
26
- {
27
- // 起始格式化间隔
28
- tabWidth: 2,
29
- // 使用单引号
30
- singleQuote: true,
31
- // jsx 中使用单引号
32
- jsxSingleQuote: true,
33
- // 对象中的 key 是否需要引号。as-needed: 只有在必须时才要
34
- quoteProps: 'as-needed',
35
- // 每行结尾是否需要分号
36
- trailingComma: 'all',
37
- // 括号中参数前后补充空格
38
- bracketSpacing: true,
39
- // 箭头函数,参数是否添加括号
40
- arrowParens: 'avoid',
41
- // jsx 元素最后末尾的 > ,换行放置
42
- bracketSameLine: false,
43
- // 设置换行符
44
- endOfLine: 'lf',
45
- },
46
- config,
47
- );
48
- }