piclist 1.9.14 → 2.0.0

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 (80) hide show
  1. package/.github/workflows/docker.yml +5 -5
  2. package/CHANGELOG.md +13 -0
  3. package/License +22 -22
  4. package/README.md +1 -1
  5. package/README_cn.md +1 -1
  6. package/bin/picgo +9 -7
  7. package/bin/picgo-server +180 -161
  8. package/dist/core/Lifecycle.d.ts +35 -36
  9. package/dist/core/PicGo.d.ts +52 -52
  10. package/dist/i18n/en.d.ts +2 -2
  11. package/dist/i18n/index.d.ts +19 -17
  12. package/dist/i18n/zh-CN.d.ts +293 -289
  13. package/dist/i18n/zh-TW.d.ts +2 -2
  14. package/dist/index.d.ts +10 -10
  15. package/dist/index.js +2 -0
  16. package/dist/lib/Commander.d.ts +22 -22
  17. package/dist/lib/LifecyclePlugins.d.ts +26 -26
  18. package/dist/lib/Logger.d.ts +19 -19
  19. package/dist/lib/PluginHandler.d.ts +10 -10
  20. package/dist/lib/PluginLoader.d.ts +27 -27
  21. package/dist/lib/Request.d.ts +12 -12
  22. package/dist/plugins/beforetransformer/compress.d.ts +5 -5
  23. package/dist/plugins/beforetransformer/skipProcess.d.ts +5 -5
  24. package/dist/plugins/beforetransformer/watermark.d.ts +5 -5
  25. package/dist/plugins/beforeupload/buildInRename.d.ts +5 -5
  26. package/dist/plugins/commander/config.d.ts +3 -3
  27. package/dist/plugins/commander/i18n.d.ts +3 -3
  28. package/dist/plugins/commander/index.d.ts +3 -3
  29. package/dist/plugins/commander/pluginHandler.d.ts +3 -3
  30. package/dist/plugins/commander/proxy.d.ts +3 -3
  31. package/dist/plugins/commander/setting.d.ts +5 -5
  32. package/dist/plugins/commander/upload.d.ts +3 -3
  33. package/dist/plugins/commander/use.d.ts +3 -3
  34. package/dist/plugins/commander/utils.d.ts +2 -2
  35. package/dist/plugins/transformer/base64.d.ts +5 -5
  36. package/dist/plugins/transformer/index.d.ts +5 -5
  37. package/dist/plugins/transformer/path.d.ts +5 -5
  38. package/dist/plugins/uploader/advancedplist.d.ts +2 -2
  39. package/dist/plugins/uploader/alist.d.ts +2 -2
  40. package/dist/plugins/uploader/aliyun.d.ts +2 -2
  41. package/dist/plugins/uploader/awss3plist.d.ts +2 -2
  42. package/dist/plugins/uploader/github.d.ts +2 -2
  43. package/dist/plugins/uploader/imgur.d.ts +2 -2
  44. package/dist/plugins/uploader/index.d.ts +5 -5
  45. package/dist/plugins/uploader/local.d.ts +2 -2
  46. package/dist/plugins/uploader/lsky.d.ts +20 -21
  47. package/dist/plugins/uploader/piclist.d.ts +2 -2
  48. package/dist/plugins/uploader/qiniu.d.ts +2 -2
  49. package/dist/plugins/uploader/s3/uploader.d.ts +25 -24
  50. package/dist/plugins/uploader/s3/utils.d.ts +9 -10
  51. package/dist/plugins/uploader/sftp.d.ts +2 -2
  52. package/dist/plugins/uploader/smms.d.ts +2 -2
  53. package/dist/plugins/uploader/tcyun.d.ts +8 -8
  54. package/dist/plugins/uploader/upyun.d.ts +2 -2
  55. package/dist/plugins/uploader/utils.d.ts +26 -26
  56. package/dist/plugins/uploader/webdav.d.ts +2 -2
  57. package/dist/types/index.d.ts +572 -693
  58. package/dist/types/oldRequest.d.ts +15 -15
  59. package/dist/utils/common.d.ts +42 -119
  60. package/dist/utils/createContext.d.ts +6 -6
  61. package/dist/utils/db.d.ts +17 -15
  62. package/dist/utils/enum.d.ts +27 -27
  63. package/dist/utils/eventBus.d.ts +3 -4
  64. package/dist/utils/getClipboardImage.d.ts +4 -4
  65. package/dist/utils/sshClient.d.ts +16 -16
  66. package/dist/utils/static.d.ts +1 -1
  67. package/docker-compose.yaml +11 -11
  68. package/eslint.config.js +104 -0
  69. package/package.json +62 -78
  70. package/rollup.config.js +25 -42
  71. package/.eslintignore +0 -6
  72. package/.eslintrc.js +0 -50
  73. package/.github/workflows/alpha.yml +0 -22
  74. package/.github/workflows/main.yml +0 -22
  75. package/.github/workflows/manually.yml +0 -19
  76. package/dist/index.cjs.js +0 -2
  77. package/dist/index.esm.js +0 -2
  78. package/dist/plugins/commander/init.d.ts +0 -3
  79. package/dist/utils/initUtils.d.ts +0 -26
  80. package/dist/utils/interfaces.d.ts +0 -201
@@ -1,15 +1,15 @@
1
- export type IMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
2
- export type IHeaders = Record<string, any>;
3
- export interface IRequestPromiseOptions {
4
- baseUrl?: string | undefined;
5
- url?: string;
6
- method?: IMethod;
7
- formData?: Record<string, any> | undefined;
8
- qs?: any;
9
- json?: boolean;
10
- body?: any;
11
- resolveWithFullResponse?: boolean;
12
- headers?: IHeaders;
13
- proxy?: any;
14
- timeout?: number;
15
- }
1
+ export type IMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
2
+ export type IHeaders = Record<string, any>;
3
+ export interface IRequestPromiseOptions {
4
+ baseUrl?: string | undefined;
5
+ url?: string;
6
+ method?: IMethod;
7
+ formData?: Record<string, any> | undefined;
8
+ qs?: any;
9
+ json?: boolean;
10
+ body?: any;
11
+ resolveWithFullResponse?: boolean;
12
+ headers?: IHeaders;
13
+ proxy?: any;
14
+ timeout?: number;
15
+ }
@@ -1,119 +1,42 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- import sharp from 'sharp';
5
- import crypto from 'crypto';
6
- import { IImgSize, IPathTransformedImgInfo, IPluginNameType, ILogger, IPicGo, IBuildInCompressOptions, IBuildInWaterMarkOptions } from '../types';
7
- export declare function randomStringGenerator(length: number): string;
8
- export declare function renameFileNameWithTimestamp(oldName: string): string;
9
- export declare function renameFileNameWithRandomString(oldName: string, length?: number): string;
10
- export declare function renameFileNameWithCustomString(oldName: string, customFormat: string, affixFileName?: string, fileBuffer?: crypto.BinaryLike): string;
11
- export declare const isUrl: (url: string) => boolean;
12
- export declare const isUrlEncode: (url: string) => boolean;
13
- export declare const handleUrlEncode: (url: string) => string;
14
- export declare const getImageSize: (file: Buffer) => IImgSize;
15
- export declare const getFSFile: (filePath: string) => Promise<IPathTransformedImgInfo>;
16
- export declare const getURLFile: (url: string, ctx: IPicGo) => Promise<IPathTransformedImgInfo>;
17
- /**
18
- * detect the input string's type
19
- * for example
20
- * 1. @xxx/picgo-plugin-xxx -> scope
21
- * 2. picgo-plugin-xxx -> normal
22
- * 3. xxx -> simple
23
- * 4. not exists or is a path -> unknown
24
- * @param name
25
- */
26
- export declare const getPluginNameType: (name: string) => IPluginNameType;
27
- /**
28
- * detect the input string is a simple plugin name or not
29
- * for example
30
- * 1. xxx -> true
31
- * 2. /Usr/xx/xxxx/picgo-plugin-xxx -> false
32
- * @param name pluginNameOrPath
33
- */
34
- export declare const isSimpleName: (nameOrPath: string) => boolean;
35
- /**
36
- * streamline the full plugin name to a simple one
37
- * for example:
38
- * 1. picgo-plugin-xxx -> xxx
39
- * 2. @xxx/picgo-plugin-yyy -> yyy
40
- * @param name pluginFullName
41
- */
42
- export declare const handleStreamlinePluginName: (name: string) => string;
43
- /**
44
- * complete plugin name to full name
45
- * for example:
46
- * 1. xxx -> picgo-plugin-xxx
47
- * 2. picgo-plugin-xxx -> picgo-plugin-xxx
48
- * @param name pluginSimpleName
49
- * @param scope pluginScope
50
- */
51
- export declare const handleCompletePluginName: (name: string, scope?: string) => string;
52
- /**
53
- * handle install/uninstall/update plugin name or path
54
- * for example
55
- * 1. picgo-plugin-xxx -> picgo-plugin-xxx
56
- * 2. @xxx/picgo-plugin-xxx -> @xxx/picgo-plugin-xxx
57
- * 3. xxx -> picgo-plugin-xxx
58
- * 4. ./xxxx/picgo-plugin-xxx -> /absolutePath/.../xxxx/picgo-plugin-xxx
59
- * 5. /absolutePath/.../picgo-plugin-xxx -> /absolutePath/.../picgo-plugin-xxx
60
- * @param nameOrPath pluginName or pluginPath
61
- */
62
- export declare const getProcessPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
63
- /**
64
- * get the normal plugin name
65
- * for example:
66
- * 1. picgo-plugin-xxx -> picgo-plugin-xxx
67
- * 2. @xxx/picgo-plugin-xxx -> @xxx/picgo-plugin-xxx
68
- * 3. ./xxxx/picgo-plugin-xxx -> picgo-plugin-xxx
69
- * 4. /absolutePath/.../picgo-plugin-xxx -> picgo-plugin-xxx
70
- * 5. an exception: [package.json's name] !== [folder name]
71
- * then use [package.json's name], usually match the scope package.
72
- * 6. if plugin name has version: picgo-plugin-xxx@x.x.x then remove the version
73
- * @param nameOrPath
74
- */
75
- export declare const getNormalPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
76
- /**
77
- * handle transform the path to unix style
78
- * for example
79
- * 1. C:\\xxx\\xxx -> C:/xxx/xxx
80
- * 2. /xxx/xxx -> /xxx/xxx
81
- * @param path
82
- */
83
- export declare const handleUnixStylePath: (pathStr: string) => string;
84
- /**
85
- * remove plugin version when register plugin name
86
- * 1. picgo-plugin-xxx@1.0.0 -> picgo-plugin-xxx
87
- * 2. @xxx/picgo-plugin-xxx@1.0.0 -> @xxx/picgo-plugin-xxx
88
- * @param nameOrPath
89
- * @param scope
90
- */
91
- export declare const removePluginVersion: (nameOrPath: string, scope?: boolean) => string;
92
- /**
93
- * the config black item list which won't be setted
94
- * only can be got
95
- */
96
- export declare const configBlackList: never[];
97
- /**
98
- * check some config key is in blackList
99
- * @param key
100
- */
101
- export declare const isConfigKeyInBlackList: (key: string) => boolean;
102
- /**
103
- * check the input config is valid
104
- * config must be object such as { xxx: 'xxx' }
105
- * && can't be array
106
- * @param config
107
- * @returns
108
- */
109
- export declare const isInputConfigValid: (config: any) => boolean;
110
- export declare function safeParse<T>(str: string): T | string;
111
- export declare const forceNumber: (num?: string | number) => number;
112
- export declare const isDev: () => boolean;
113
- export declare function AddWatermark(img: Buffer, watermarkType: 'text' | 'image', defaultWatermarkFontPath: string, isFullScreenWatermark?: boolean, watermarkDegree?: number, text?: string, watermarkFontPath?: string, watermarkScaleRatio?: number, watermarkColor?: string, watermarkImagePath?: string, position?: sharp.Gravity): Promise<Buffer>;
114
- export declare function imageAddWaterMark(img: Buffer, options: IBuildInWaterMarkOptions, defaultWatermarkFontPath: string, logger: ILogger): Promise<Buffer>;
115
- export declare function imageCompress(img: Buffer, options: IBuildInCompressOptions, rawFormat: string, logger: ILogger): Promise<Buffer>;
116
- export declare function getConvertedFormat(options: IBuildInCompressOptions | undefined, rawFormat: string): string;
117
- export declare const isNeedAddWatermark: (watermarkOptions: IBuildInWaterMarkOptions | undefined, fileExt: string) => boolean;
118
- export declare const isNeedCompress: (compressOptions: IBuildInCompressOptions | undefined, fileExt: string) => boolean;
119
- export declare const removeExif: (img: Buffer, fileExt: string) => Promise<Buffer>;
1
+ import crypto from 'node:crypto';
2
+ import sharp from 'sharp';
3
+ import type { IBuildInCompressOptions, IBuildInWaterMarkOptions, IImgSize, ILogger, IPathTransformedImgInfo, IPicGo, IPluginNameType } from '../types';
4
+ export declare function randomStringGenerator(length: number): string;
5
+ export declare function renameFileNameWithTimestamp(oldName: string): string;
6
+ export declare function renameFileNameWithRandomString(oldName: string, length?: number): string;
7
+ export declare function renameFileNameWithCustomString(oldName: string, customFormat: string, affixFileName?: string, fileBuffer?: crypto.BinaryLike): string;
8
+ export declare const isUrl: (url: string) => boolean;
9
+ export declare const isUrlEncode: (url: string) => boolean;
10
+ export declare const handleUrlEncode: (url: string) => string;
11
+ export declare const getImageSize: (file: Buffer) => IImgSize;
12
+ export declare const getFSFile: (filePath: string) => Promise<IPathTransformedImgInfo>;
13
+ export declare const getURLFile: (url: string, ctx: IPicGo) => Promise<IPathTransformedImgInfo>;
14
+ export declare const getPluginNameType: (name: string) => IPluginNameType;
15
+ export declare const isSimpleName: (nameOrPath: string) => boolean;
16
+ export declare const handleStreamlinePluginName: (name: string) => string;
17
+ export declare const handleCompletePluginName: (name: string, scope?: string) => string;
18
+ export declare const getProcessPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
19
+ export declare const getNormalPluginName: (nameOrPath: string, logger?: ILogger | Console) => string;
20
+ export declare const handleUnixStylePath: (pathStr: string) => string;
21
+ export declare const removePluginVersion: (nameOrPath: string, scope?: boolean) => string;
22
+ /**
23
+ * the config black item list which won't be setted
24
+ * only can be got
25
+ */
26
+ export declare const configBlackList: never[];
27
+ /**
28
+ * check some config key is in blackList
29
+ * @param key
30
+ */
31
+ export declare const isConfigKeyInBlackList: (key: string) => boolean;
32
+ export declare const isInputConfigValid: (config: any) => boolean;
33
+ export declare function safeParse<T>(str: string): T | string;
34
+ export declare const forceNumber: (num?: string | number) => number;
35
+ export declare const isDev: () => boolean;
36
+ export declare function AddWatermark(img: Buffer, watermarkType: 'text' | 'image', defaultWatermarkFontPath: string, isFullScreenWatermark?: boolean, watermarkDegree?: number, text?: string, watermarkFontPath?: string, watermarkScaleRatio?: number, watermarkColor?: string, watermarkImagePath?: string, position?: sharp.Gravity, watermarkImageOpacity?: number): Promise<Buffer>;
37
+ export declare function imageAddWaterMark(img: Buffer, options: IBuildInWaterMarkOptions, defaultWatermarkFontPath: string, logger: ILogger): Promise<Buffer>;
38
+ export declare function imageCompress(img: Buffer, options: IBuildInCompressOptions, rawFormat: string, logger: ILogger): Promise<Buffer>;
39
+ export declare function getConvertedFormat(options: IBuildInCompressOptions | undefined, rawFormat: string): string;
40
+ export declare const isNeedAddWatermark: (watermarkOptions: IBuildInWaterMarkOptions | undefined, fileExt: string) => boolean;
41
+ export declare const isNeedCompress: (compressOptions: IBuildInCompressOptions | undefined, fileExt: string) => boolean;
42
+ export declare const removeExif: (img: Buffer, fileExt: string) => Promise<Buffer>;
@@ -1,6 +1,6 @@
1
- import { IPicGo } from '../types';
2
- /**
3
- * create an unique context for each upload process
4
- * @param ctx
5
- */
6
- export declare const createContext: (ctx: IPicGo) => IPicGo;
1
+ import { IPicGo } from '../types';
2
+ /**
3
+ * create an unique context for each upload process
4
+ * @param ctx
5
+ */
6
+ export declare const createContext: (ctx: IPicGo) => IPicGo;
@@ -1,15 +1,17 @@
1
- import { IConfig, IPicGo } from '../types';
2
- import { IJSON } from '@picgo/store/dist/types';
3
- declare class DB {
4
- private readonly ctx;
5
- private readonly db;
6
- constructor(ctx: IPicGo);
7
- read(flush?: boolean): IJSON;
8
- get(key?: string): any;
9
- set(key: string, value: any): void;
10
- has(key: string): boolean;
11
- unset(key: string, value: any): boolean;
12
- saveConfig(config: Partial<IConfig>): void;
13
- removeConfig(config: IConfig): void;
14
- }
15
- export default DB;
1
+ interface IJSON {
2
+ [propsName: string]: string | number | IJSON;
3
+ }
4
+ import { IConfig, IPicGo } from '../types';
5
+ declare class DB {
6
+ private readonly ctx;
7
+ private readonly db;
8
+ constructor(ctx: IPicGo);
9
+ read(flush?: boolean): IJSON;
10
+ get(key?: string): any;
11
+ set(key: string, value: any): void;
12
+ has(key: string): boolean;
13
+ unset(key: string, value: any): boolean;
14
+ saveConfig(config: Partial<IConfig>): void;
15
+ removeConfig(config: IConfig): void;
16
+ }
17
+ export default DB;
@@ -1,27 +1,27 @@
1
- export declare enum ILogType {
2
- success = "success",
3
- info = "info",
4
- warn = "warn",
5
- error = "error"
6
- }
7
- /**
8
- * these events will be catched by users
9
- */
10
- export declare enum IBuildInEvent {
11
- UPLOAD_PROGRESS = "uploadProgress",
12
- FAILED = "failed",
13
- BEFORE_TRANSFORM = "beforeTransform",
14
- BEFORE_UPLOAD = "beforeUpload",
15
- AFTER_UPLOAD = "afterUpload",
16
- FINISHED = "finished",
17
- INSTALL = "install",
18
- UNINSTALL = "uninstall",
19
- UPDATE = "update",
20
- NOTIFICATION = "notification"
21
- }
22
- /**
23
- * these events will be catched only by picgo
24
- */
25
- export declare enum IBusEvent {
26
- CONFIG_CHANGE = "CONFIG_CHANGE"
27
- }
1
+ export declare enum ILogType {
2
+ success = "success",
3
+ info = "info",
4
+ warn = "warn",
5
+ error = "error"
6
+ }
7
+ /**
8
+ * these events will be catched by users
9
+ */
10
+ export declare enum IBuildInEvent {
11
+ UPLOAD_PROGRESS = "uploadProgress",
12
+ FAILED = "failed",
13
+ BEFORE_TRANSFORM = "beforeTransform",
14
+ BEFORE_UPLOAD = "beforeUpload",
15
+ AFTER_UPLOAD = "afterUpload",
16
+ FINISHED = "finished",
17
+ INSTALL = "install",
18
+ UNINSTALL = "uninstall",
19
+ UPDATE = "update",
20
+ NOTIFICATION = "notification"
21
+ }
22
+ /**
23
+ * these events will be catched only by picgo
24
+ */
25
+ export declare enum IBusEvent {
26
+ CONFIG_CHANGE = "CONFIG_CHANGE"
27
+ }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- declare const eventBus: EventEmitter;
4
- export { eventBus };
1
+ import { EventEmitter } from 'node:events';
2
+ declare const eventBus: EventEmitter<[never]>;
3
+ export { eventBus };
@@ -1,4 +1,4 @@
1
- import { IPicGo, IClipboardImage } from '../types';
2
- export type Platform = 'darwin' | 'win32' | 'win10' | 'linux' | 'wsl';
3
- declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
4
- export default getClipboardImage;
1
+ import { IClipboardImage, IPicGo } from '../types';
2
+ export type Platform = 'darwin' | 'win32' | 'win10' | 'linux' | 'wsl';
3
+ declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
4
+ export default getClipboardImage;
@@ -1,16 +1,16 @@
1
- import { ISftpPlistConfig } from '../types';
2
- declare class SSHClient {
3
- private static instance;
4
- private client;
5
- isConnected: boolean;
6
- private constructor();
7
- static getInstance(): SSHClient;
8
- private static changeWinStylePathToUnix;
9
- connect(config: ISftpPlistConfig): Promise<void>;
10
- upload(local: string, remote: string, config: ISftpPlistConfig): Promise<void>;
11
- private mkdir;
12
- chown(remote: string, user: string, group?: string): Promise<void>;
13
- private exec;
14
- close(): void;
15
- }
16
- export default SSHClient;
1
+ import type { ISftpPlistConfig } from '../types';
2
+ declare class SSHClient {
3
+ private static instance;
4
+ private client;
5
+ isConnected: boolean;
6
+ private constructor();
7
+ static getInstance(): SSHClient;
8
+ private static changeWinStylePathToUnix;
9
+ connect(config: ISftpPlistConfig): Promise<void>;
10
+ upload(local: string, remote: string, config: ISftpPlistConfig): Promise<void>;
11
+ private mkdir;
12
+ chown(remote: string, user: string, group?: string): Promise<void>;
13
+ private exec;
14
+ close(): void;
15
+ }
16
+ export default SSHClient;
@@ -1 +1 @@
1
- export declare const CLIPBOARD_IMAGE_FOLDER = "piclist-clipboard-images";
1
+ export declare const CLIPBOARD_IMAGE_FOLDER = "piclist-clipboard-images";
@@ -1,12 +1,12 @@
1
- version: '3.3'
2
-
3
- services:
4
- node:
5
- image: 'kuingsmile/piclist:latest'
6
- container_name: piclist
7
- restart: always
8
- ports:
9
- - 36677:36677
10
- volumes:
11
- - './piclist:/root/.piclist'
1
+ version: '3.3'
2
+
3
+ services:
4
+ node:
5
+ image: 'kuingsmile/piclist:latest'
6
+ container_name: piclist
7
+ restart: always
8
+ ports:
9
+ - 36677:36677
10
+ volumes:
11
+ - './piclist:/root/.piclist'
12
12
  command: node /usr/local/bin/picgo-server -k piclist123456
@@ -0,0 +1,104 @@
1
+ import eslint from '@eslint/js'
2
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
3
+ import simpleImportSort from 'eslint-plugin-simple-import-sort'
4
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn'
5
+ import globals from 'globals'
6
+ import tseslint from 'typescript-eslint'
7
+
8
+ export default tseslint.config(
9
+ {
10
+ files: [
11
+ './src/*.{ts,tsx,cts,mts,js,cjs,mjs}',
12
+ './scripts/*.{ts,js,mjs}',
13
+ './test/*.{ts,js,mjs}',
14
+ './bin/picgo',
15
+ './bin/picgo-server'
16
+ ]
17
+ },
18
+ {
19
+ ignores: ['**/node_modules/**', '**/dist/**', '**/webpack.config.js', 'vitest.workspace.mjs']
20
+ },
21
+ eslint.configs.recommended,
22
+ ...tseslint.configs.recommended,
23
+ ...tseslint.configs.stylistic,
24
+ {
25
+ plugins: {
26
+ 'simple-import-sort': simpleImportSort,
27
+ unicorn: eslintPluginUnicorn
28
+ },
29
+ rules: {
30
+ 'simple-import-sort/imports': 'error',
31
+ 'simple-import-sort/exports': 'error'
32
+ }
33
+ },
34
+ {
35
+ languageOptions: {
36
+ parserOptions: {
37
+ warnOnUnsupportedTypeScriptVersion: false
38
+ },
39
+ globals: globals.node
40
+ }
41
+ },
42
+ {
43
+ rules: {
44
+ eqeqeq: 'error',
45
+ 'no-caller': 'error',
46
+ 'no-constant-condition': ['error', { checkLoops: false }],
47
+ 'no-eval': 'error',
48
+ 'no-extra-bind': 'error',
49
+ 'no-new-func': 'error',
50
+ 'no-new-wrappers': 'error',
51
+ 'no-throw-literal': 'error',
52
+ 'no-undef-init': 'error',
53
+ 'no-var': 'error',
54
+ 'object-shorthand': 'error',
55
+ 'prefer-const': 'error',
56
+ 'prefer-object-spread': 'error',
57
+ 'unicode-bom': ['error', 'never'],
58
+ // Enabled in eslint:recommended, but not applicable here
59
+ 'no-extra-boolean-cast': 'off',
60
+ 'no-case-declarations': 'off',
61
+ 'no-cond-assign': 'off',
62
+ 'no-control-regex': 'off',
63
+ 'no-inner-declarations': 'off',
64
+ 'no-empty': 'off',
65
+
66
+ // @typescript-eslint/eslint-plugin
67
+ 'no-unused-expressions': 'off',
68
+ '@typescript-eslint/no-unused-expressions': 'off',
69
+ '@typescript-eslint/ban-ts-comment': 'off',
70
+ '@typescript-eslint/class-literal-property-style': 'off',
71
+ '@typescript-eslint/consistent-indexed-object-style': 'off',
72
+ '@typescript-eslint/consistent-generic-constructors': 'off',
73
+ '@typescript-eslint/no-duplicate-enum-values': 'off',
74
+ '@typescript-eslint/no-empty-function': 'off',
75
+ '@typescript-eslint/no-namespace': 'off',
76
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
77
+ '@typescript-eslint/no-var-requires': 'off',
78
+ '@typescript-eslint/no-empty-interface': 'off',
79
+ '@typescript-eslint/no-explicit-any': 'off',
80
+ '@typescript-eslint/no-empty-object-type': 'off', // {} is a totally useful and valid type.
81
+ '@typescript-eslint/no-require-imports': 'off',
82
+ '@typescript-eslint/no-unused-vars': 'off',
83
+ '@typescript-eslint/no-inferrable-types': 'off',
84
+ // Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820
85
+ '@typescript-eslint/prefer-optional-chain': 'off',
86
+ 'unicorn/prefer-node-protocol': 'error'
87
+ }
88
+ },
89
+ {
90
+ files: ['**/*.mjs', '**/*.mts'],
91
+ rules: {
92
+ // These globals don't exist outside of CJS files.
93
+ 'no-restricted-globals': [
94
+ 'error',
95
+ { name: '__filename' },
96
+ { name: '__dirname' },
97
+ { name: 'require' },
98
+ { name: 'module' },
99
+ { name: 'exports' }
100
+ ]
101
+ }
102
+ },
103
+ eslintPluginPrettierRecommended
104
+ )