@magicdawn/eslint-config 1.5.14 → 1.6.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/dist/index.d.ts +8 -17
- package/dist/index.js +67 -13
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -41,35 +41,26 @@ declare const mgCustomRules: {
|
|
|
41
41
|
}];
|
|
42
42
|
};
|
|
43
43
|
readonly unicorn: {
|
|
44
|
-
/**
|
|
45
|
-
* I don't prefer, I know what I'm doing ~
|
|
46
|
-
*/
|
|
47
|
-
readonly 'unicorn/catch-error-name': "off";
|
|
48
|
-
readonly 'unicorn/consistent-function-scoping': "off";
|
|
49
|
-
readonly 'unicorn/filename-case': "off";
|
|
50
44
|
readonly 'unicorn/prefer-array-flat-map': "off";
|
|
51
45
|
readonly 'unicorn/prefer-array-index-of': "off";
|
|
52
46
|
readonly 'unicorn/prefer-array-some': "off";
|
|
53
|
-
readonly 'unicorn/
|
|
54
|
-
readonly 'unicorn/prefer-
|
|
47
|
+
readonly 'unicorn/no-array-reduce': "off";
|
|
48
|
+
readonly 'unicorn/prefer-string-trim-start-end': "off";
|
|
49
|
+
readonly 'unicorn/prefer-string-raw': "off";
|
|
55
50
|
readonly 'unicorn/prefer-query-selector': "off";
|
|
56
51
|
readonly 'unicorn/prefer-dom-node-append': "off";
|
|
57
52
|
readonly 'unicorn/prefer-dom-node-dataset': "off";
|
|
58
|
-
readonly 'unicorn/prefer-modern-dom-apis': "off";
|
|
59
53
|
readonly 'unicorn/prefer-add-event-listener': "off";
|
|
60
|
-
readonly 'unicorn/prefer-
|
|
61
|
-
readonly 'unicorn/prefer-
|
|
54
|
+
readonly 'unicorn/prefer-single-call': "off";
|
|
55
|
+
readonly 'unicorn/prefer-reflect-apply': "off";
|
|
56
|
+
readonly 'unicorn/catch-error-name': "off";
|
|
57
|
+
readonly 'unicorn/consistent-function-scoping': "off";
|
|
58
|
+
readonly 'unicorn/filename-case': "off";
|
|
62
59
|
readonly 'unicorn/no-negated-condition': "off";
|
|
63
60
|
readonly 'unicorn/no-array-sort': "off";
|
|
64
61
|
readonly 'unicorn/no-array-reverse': "off";
|
|
65
62
|
readonly 'unicorn/prefer-global-this': "off";
|
|
66
63
|
readonly 'unicorn/no-useless-undefined': "off";
|
|
67
|
-
/**
|
|
68
|
-
* change options
|
|
69
|
-
*/
|
|
70
|
-
readonly 'unicorn/text-encoding-identifier-case': ["warn", {
|
|
71
|
-
readonly withDash: true;
|
|
72
|
-
}];
|
|
73
64
|
};
|
|
74
65
|
readonly disableMorePrefer: {
|
|
75
66
|
readonly 'prefer-template': "off";
|
package/dist/index.js
CHANGED
|
@@ -26,27 +26,26 @@ const mgCustomRules = {
|
|
|
26
26
|
"@typescript-eslint/consistent-type-imports": ["warn", { fixStyle: "inline-type-imports" }]
|
|
27
27
|
},
|
|
28
28
|
unicorn: {
|
|
29
|
-
"unicorn/catch-error-name": "off",
|
|
30
|
-
"unicorn/consistent-function-scoping": "off",
|
|
31
|
-
"unicorn/filename-case": "off",
|
|
32
29
|
"unicorn/prefer-array-flat-map": "off",
|
|
33
30
|
"unicorn/prefer-array-index-of": "off",
|
|
34
31
|
"unicorn/prefer-array-some": "off",
|
|
35
|
-
"unicorn/
|
|
36
|
-
"unicorn/prefer-
|
|
32
|
+
"unicorn/no-array-reduce": "off",
|
|
33
|
+
"unicorn/prefer-string-trim-start-end": "off",
|
|
34
|
+
"unicorn/prefer-string-raw": "off",
|
|
37
35
|
"unicorn/prefer-query-selector": "off",
|
|
38
36
|
"unicorn/prefer-dom-node-append": "off",
|
|
39
37
|
"unicorn/prefer-dom-node-dataset": "off",
|
|
40
|
-
"unicorn/prefer-modern-dom-apis": "off",
|
|
41
38
|
"unicorn/prefer-add-event-listener": "off",
|
|
42
|
-
"unicorn/prefer-
|
|
43
|
-
"unicorn/prefer-
|
|
39
|
+
"unicorn/prefer-single-call": "off",
|
|
40
|
+
"unicorn/prefer-reflect-apply": "off",
|
|
41
|
+
"unicorn/catch-error-name": "off",
|
|
42
|
+
"unicorn/consistent-function-scoping": "off",
|
|
43
|
+
"unicorn/filename-case": "off",
|
|
44
44
|
"unicorn/no-negated-condition": "off",
|
|
45
45
|
"unicorn/no-array-sort": "off",
|
|
46
46
|
"unicorn/no-array-reverse": "off",
|
|
47
47
|
"unicorn/prefer-global-this": "off",
|
|
48
|
-
"unicorn/no-useless-undefined": "off"
|
|
49
|
-
"unicorn/text-encoding-identifier-case": ["warn", { withDash: true }]
|
|
48
|
+
"unicorn/no-useless-undefined": "off"
|
|
50
49
|
},
|
|
51
50
|
disableMorePrefer: { "prefer-template": "off" },
|
|
52
51
|
tseslint: {
|
|
@@ -112,6 +111,62 @@ const mgCustomJsonOrder = { tsconfig: [{
|
|
|
112
111
|
]
|
|
113
112
|
}] };
|
|
114
113
|
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/perfection-list/sort-imports.ts
|
|
116
|
+
/**
|
|
117
|
+
* https://perfectionist.dev/rules/sort-imports#groups
|
|
118
|
+
*
|
|
119
|
+
* modifier & selector are terms of perfectionist
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
[
|
|
123
|
+
'type-import',
|
|
124
|
+
['value-builtin', 'value-external'],
|
|
125
|
+
'type-internal',
|
|
126
|
+
'value-internal',
|
|
127
|
+
['type-parent', 'type-sibling', 'type-index'],
|
|
128
|
+
['value-parent', 'value-sibling', 'value-index'],
|
|
129
|
+
'ts-equals-import',
|
|
130
|
+
'unknown',
|
|
131
|
+
]
|
|
132
|
+
*/
|
|
133
|
+
/**
|
|
134
|
+
https://github.com/sxzz/eslint-config/blob/main/src/configs/sort.ts
|
|
135
|
+
builtin',
|
|
136
|
+
'external',
|
|
137
|
+
'internal',
|
|
138
|
+
'parent',
|
|
139
|
+
'subpath',
|
|
140
|
+
'sibling',
|
|
141
|
+
'index',
|
|
142
|
+
'style',
|
|
143
|
+
'type',
|
|
144
|
+
'side-effect',
|
|
145
|
+
'side-effect-style',
|
|
146
|
+
*/
|
|
147
|
+
const generalOrder = [
|
|
148
|
+
"builtin",
|
|
149
|
+
"external",
|
|
150
|
+
"tsconfig-path",
|
|
151
|
+
"subpath",
|
|
152
|
+
"internal",
|
|
153
|
+
"parent",
|
|
154
|
+
"index",
|
|
155
|
+
"sibling"
|
|
156
|
+
];
|
|
157
|
+
function addModifier(modifier) {
|
|
158
|
+
return generalOrder.map((x) => {
|
|
159
|
+
if (typeof x === "string") return `${modifier}-${x}`;
|
|
160
|
+
throw new Error("should not reach here");
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const customSortImportGroups = [
|
|
164
|
+
"side-effect-style",
|
|
165
|
+
"side-effect",
|
|
166
|
+
...generalOrder,
|
|
167
|
+
...addModifier("type")
|
|
168
|
+
];
|
|
169
|
+
|
|
115
170
|
//#endregion
|
|
116
171
|
//#region src/from-sxzz.ts
|
|
117
172
|
function fromSxzz(options, ...moreConfigs) {
|
|
@@ -171,13 +226,12 @@ function fromSxzz(options, ...moreConfigs) {
|
|
|
171
226
|
assert(options$1[0], "options[0] should not be nil");
|
|
172
227
|
options$1[0].internalPattern = uniq([
|
|
173
228
|
"^[~@#$]/.*",
|
|
174
|
-
|
|
229
|
+
`^[$].+`,
|
|
175
230
|
...internalPattern ?? []
|
|
176
231
|
]);
|
|
177
232
|
options$1[0].groups = uniq([
|
|
178
233
|
...groups ?? [],
|
|
179
|
-
|
|
180
|
-
"side-effect",
|
|
234
|
+
...customSortImportGroups,
|
|
181
235
|
...options$1[0].groups ?? []
|
|
182
236
|
]);
|
|
183
237
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magicdawn/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "1.6.0",
|
|
5
|
+
"packageManager": "pnpm@10.26.2+sha512.0e308ff2005fc7410366f154f625f6631ab2b16b1d2e70238444dd6ae9d630a8482d92a451144debc492416896ed16f7b114a86ec68b8404b2443869e68ffda6",
|
|
6
6
|
"description": "magicdawn's eslint-config",
|
|
7
7
|
"author": "magicdawn",
|
|
8
8
|
"license": "MIT",
|
|
@@ -51,18 +51,18 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@sxzz/eslint-config": "^7.4.
|
|
55
|
-
"es-toolkit": "^1.
|
|
54
|
+
"@sxzz/eslint-config": "^7.4.4",
|
|
55
|
+
"es-toolkit": "^1.43.0",
|
|
56
56
|
"eslint-config-prettier": "^10.1.8",
|
|
57
57
|
"eslint-flat-config-utils": "^2.1.4"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@magicdawn/prettier-config": "^0.1.0",
|
|
61
|
-
"@types/node": "^24.10.
|
|
61
|
+
"@types/node": "^24.10.4",
|
|
62
62
|
"husky": "^9.1.7",
|
|
63
63
|
"lint-staged": "^16.2.7",
|
|
64
64
|
"prettier": "^3.7.4",
|
|
65
|
-
"tsdown": "^0.
|
|
65
|
+
"tsdown": "^0.18.3"
|
|
66
66
|
},
|
|
67
67
|
"lint-staged": {
|
|
68
68
|
"*.{?(c|m)(j|t)s?(x),json,y?(a)ml}": [
|