@cuiqg/eslint-config 2.2.3 → 2.4.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.
package/LICENSE CHANGED
@@ -1,24 +1,24 @@
1
- This is free and unencumbered software released into the public domain.
2
-
3
- Anyone is free to copy, modify, publish, use, compile, sell, or
4
- distribute this software, either in source code form or as a compiled
5
- binary, for any purpose, commercial or non-commercial, and by any
6
- means.
7
-
8
- In jurisdictions that recognize copyright laws, the author or authors
9
- of this software dedicate any and all copyright interest in the
10
- software to the public domain. We make this dedication for the benefit
11
- of the public at large and to the detriment of our heirs and
12
- successors. We intend this dedication to be an overt act of
13
- relinquishment in perpetuity of all present and future rights to this
14
- software under copyright law.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- For more information, please refer to <https://unlicense.org>
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <https://unlicense.org/>
package/README.md CHANGED
@@ -1,45 +1,45 @@
1
- # @cuiqg/eslint-config [![npm](https://img.shields.io/npm/v/%40cuiqg%2Feslint-config?style=flat-square)](https://www.npmjs.com/package/@cuiqg/eslint-config)
2
-
3
- ## 使用
4
-
5
- ```bash
6
- npm i -D eslint @cuiqg/eslint-config
7
- ```
8
-
9
- 修改 `package.json` 文件
10
-
11
- ```diff
12
- {
13
- + "type": "module",
14
- "scripts": {
15
- + "lint": "eslint .",
16
- + "lint:fix": "eslint . --fix"
17
- }
18
- }
19
- ```
20
-
21
- 创建 `eslint.config.js` 文件
22
-
23
- ```js
24
- import cuiqg from '@cuiqg/eslint-config'
25
-
26
- export default cuiqg()
27
- ```
28
-
29
- ## 插件配置
30
-
31
- 安装 [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
32
-
33
- 创建配置文件 `.vscode/settings.json`
34
-
35
- ```json
36
- {
37
- "prettier.enable": false,
38
- "editor.formatOnSave": false,
39
- "eslint.useFlatConfig": true,
40
- "editor.codeActionsOnSave": {
41
- "source.fixAll.eslint": "explicit",
42
- "source.organizeImports": "never"
43
- }
44
- }
45
- ```
1
+ # @cuiqg/eslint-config [![npm](https://img.shields.io/npm/v/%40cuiqg%2Feslint-config?registry_uri=https%3A%2F%2Fregistry.npmmirror.com&style=social&logo=npm&logoColor=%23CB3837)](https://npmmirror.com/package/@cuiqg/eslint-config)
2
+
3
+ ## 使用
4
+
5
+ ```bash
6
+ npm i -D eslint @cuiqg/eslint-config
7
+ ```
8
+
9
+ 修改 `package.json` 文件
10
+
11
+ ```diff
12
+ {
13
+ + "type": "module",
14
+ "scripts": {
15
+ + "lint": "eslint .",
16
+ + "lint:fix": "eslint . --fix"
17
+ }
18
+ }
19
+ ```
20
+
21
+ 创建 `eslint.config.js` 文件
22
+
23
+ ```js
24
+ import cuiqg from '@cuiqg/eslint-config'
25
+
26
+ export default cuiqg()
27
+ ```
28
+
29
+ ## 插件配置
30
+
31
+ 安装 [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
32
+
33
+ 创建配置文件 `.vscode/settings.json`
34
+
35
+ ```json
36
+ {
37
+ "prettier.enable": false,
38
+ "editor.formatOnSave": false,
39
+ "eslint.useFlatConfig": true,
40
+ "editor.codeActionsOnSave": {
41
+ "source.fixAll.eslint": "explicit",
42
+ "source.organizeImports": "never"
43
+ }
44
+ }
45
+ ```
@@ -0,0 +1,124 @@
1
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
2
+ import { Linter } from "eslint";
3
+
4
+ //#region src/types.d.ts
5
+ type Awaitable<T> = T | Promise<T>;
6
+ type FlatConfigItem = Omit<Linter.Config, 'plugins'> & {
7
+ plugins?: Record<string, any>;
8
+ };
9
+ interface OptionsOverrides {
10
+ overrides?: Linter.Config['rules'];
11
+ }
12
+ interface OptionsFiles {
13
+ files?: Array<string | string[]>;
14
+ }
15
+ interface OptionsConfig {
16
+ /**
17
+ * @default true
18
+ */
19
+ gitignore?: boolean;
20
+ /**
21
+ * @default true
22
+ */
23
+ javascript?: boolean;
24
+ /**
25
+ * @default hasTypeScript()
26
+ */
27
+ typescript?: boolean;
28
+ /**
29
+ * @default true
30
+ */
31
+ imports?: boolean;
32
+ /**
33
+ * @default hasVue()
34
+ */
35
+ vue?: boolean;
36
+ /**
37
+ * @default false
38
+ */
39
+ prettier?: boolean;
40
+ /**
41
+ * @default hasUnoCss()
42
+ */
43
+ unocss?: boolean;
44
+ /**
45
+ * @default false
46
+ */
47
+ nextjs?: boolean;
48
+ }
49
+ //#endregion
50
+ //#region src/presets.d.ts
51
+ declare const defaultPluginRenaming: {
52
+ '@next/next': string;
53
+ n: string;
54
+ vitest: string;
55
+ yml: string;
56
+ '@typescript-eslint': string;
57
+ };
58
+ declare function cuiqg(options?: OptionsConfig & Omit<FlatConfigItem, 'files'>, ...userConfigs: Awaitable<FlatConfigItem | FlatConfigItem[]>[]): FlatConfigComposer<FlatConfigItem, string>;
59
+ //#endregion
60
+ //#region src/configs/nextjs.d.ts
61
+ declare function nextjs(): Promise<FlatConfigItem[]>;
62
+ //#endregion
63
+ //#region src/configs/node.d.ts
64
+ declare function node(): Promise<FlatConfigItem[]>;
65
+ //#endregion
66
+ //#region src/configs/package-json.d.ts
67
+ declare function packageJson(): Promise<FlatConfigItem[]>;
68
+ //#endregion
69
+ //#region src/configs/vue.d.ts
70
+ declare function vue(): Promise<FlatConfigItem[]>;
71
+ //#endregion
72
+ //#region src/configs/ignores.d.ts
73
+ declare function ignores(): Promise<FlatConfigItem[]>;
74
+ //#endregion
75
+ //#region src/configs/unocss.d.ts
76
+ declare function unocss(): Promise<FlatConfigItem[]>;
77
+ //#endregion
78
+ //#region src/configs/de-morgan.d.ts
79
+ declare function deMorgan(): Promise<FlatConfigItem[]>;
80
+ //#endregion
81
+ //#region src/configs/prettier.d.ts
82
+ declare function prettier(): Promise<FlatConfigItem[]>;
83
+ //#endregion
84
+ //#region src/configs/javascript.d.ts
85
+ declare function javascript(): Promise<FlatConfigItem[]>;
86
+ //#endregion
87
+ //#region src/configs/typescript.d.ts
88
+ declare function typescript(): Promise<FlatConfigItem[]>;
89
+ //#endregion
90
+ //#region src/env.d.ts
91
+ declare const isInGitHookOrLintStaged: () => boolean;
92
+ declare const isInEditor: () => boolean;
93
+ declare const hasVue: () => boolean;
94
+ declare const hasTypeScript: () => boolean;
95
+ declare const hasUnoCss: () => boolean;
96
+ declare const hasNextjs: () => boolean;
97
+ //#endregion
98
+ //#region src/globs.d.ts
99
+ declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
100
+ declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
101
+ declare const GLOB_TS = "**/*.?([cm])ts";
102
+ declare const GLOB_TSX = "**/*.?([cm])tsx";
103
+ declare const GLOB_JS = "**/*.?([cm])js";
104
+ declare const GLOB_JSX = "**/*.?([cm])jsx";
105
+ declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
106
+ declare const GLOB_CSS = "**/*.css";
107
+ declare const GLOB_SCSS = "**/*.scss";
108
+ declare const GLOB_LESS = "**/*.less";
109
+ declare const GLOB_STYLUS = "**/*.styl";
110
+ declare const GLOB_POSTCSS = "**/*.{p,post}css";
111
+ declare const GLOB_JSON = "**/*.json";
112
+ declare const GLOB_JSON5 = "**/*.json5";
113
+ declare const GLOB_JSONC = "**/*.jsonc";
114
+ declare const GLOB_MARKDOWN = "**/*.md";
115
+ declare const GLOB_VUE = "**/*.vue";
116
+ declare const GLOB_YAML = "**/*.y?(a)ml";
117
+ declare const GLOB_TOML = "**/*.toml";
118
+ declare const GLOB_XML = "**/*.xml";
119
+ declare const GLOB_SVG = "**/*.svg";
120
+ declare const GLOB_HTML = "**/*.htm?(l)";
121
+ declare const GLOB_ALL_SRC: string[];
122
+ declare const GLOB_EXCLUDE: string[];
123
+ //#endregion
124
+ export { Awaitable, FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_STYLUS, GLOB_SVG, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsConfig, OptionsFiles, OptionsOverrides, cuiqg, deMorgan, cuiqg as default, defaultPluginRenaming, hasNextjs, hasTypeScript, hasUnoCss, hasVue, ignores, isInEditor, isInGitHookOrLintStaged, javascript, nextjs, node, packageJson, prettier, typescript, unocss, vue };