Skip to content

Commit 49f44d4

Browse files
feat: use "mut_" over "m_"
1 parent 6136fd8 commit 49f44d4

File tree

6 files changed

+56
-56
lines changed

6 files changed

+56
-56
lines changed

src/configs/formatters.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ export async function formatters(
329329
"yaml/block-sequence-hyphen-indicator-newline": "off",
330330
} satisfies FlatConfigItem["rules"];
331331

332-
const m_configs: FlatConfigItem[] = [
332+
const mut_configs: FlatConfigItem[] = [
333333
{
334334
name: "rs:formatters:setup",
335335
plugins: {
@@ -339,7 +339,7 @@ export async function formatters(
339339
];
340340

341341
if (options.js !== undefined && options.js) {
342-
m_configs.push({
342+
mut_configs.push({
343343
name: "rs:formatter:javascript",
344344
files: [GLOB_JS, GLOB_JSX],
345345
rules: {
@@ -356,7 +356,7 @@ export async function formatters(
356356
}
357357

358358
if (options.ts !== undefined && options.ts) {
359-
m_configs.push({
359+
mut_configs.push({
360360
name: "rs:formatter:typescript",
361361
files: [GLOB_TS, GLOB_TSX],
362362
ignores: options.dts === true ? [] : [GLOB_DTS],
@@ -374,7 +374,7 @@ export async function formatters(
374374
}
375375

376376
if (options.yaml !== undefined && options.yaml) {
377-
m_configs.push({
377+
mut_configs.push({
378378
name: "rs:formatter:yaml",
379379
files: [GLOB_YAML],
380380
languageOptions: {
@@ -394,7 +394,7 @@ export async function formatters(
394394
}
395395

396396
if (options.json !== undefined && options.json) {
397-
m_configs.push(
397+
mut_configs.push(
398398
{
399399
name: "rs:formatter:json",
400400
files: [GLOB_JSON],
@@ -509,7 +509,7 @@ export async function formatters(
509509
}
510510

511511
if (options.css !== undefined && options.css) {
512-
m_configs.push(
512+
mut_configs.push(
513513
{
514514
name: "rs:formatter:css",
515515
files: [GLOB_CSS, GLOB_POSTCSS],
@@ -565,7 +565,7 @@ export async function formatters(
565565
}
566566

567567
if (options.html !== undefined && options.html) {
568-
m_configs.push({
568+
mut_configs.push({
569569
name: "rs:formatter:html",
570570
files: ["**/*.html"],
571571
languageOptions: {
@@ -592,7 +592,7 @@ export async function formatters(
592592
? ["**/slides.md"]
593593
: (options.slidev.files ?? []);
594594

595-
m_configs.push({
595+
mut_configs.push({
596596
name: "rs:formatter:markdown",
597597
files: [GLOB_MARKDOWN],
598598
ignores: GLOB_SLIDEV,
@@ -613,7 +613,7 @@ export async function formatters(
613613
});
614614

615615
if (options.slidev !== undefined && options.slidev !== false) {
616-
m_configs.push({
616+
mut_configs.push({
617617
name: "rs:formatter:slidev",
618618
files: GLOB_SLIDEV,
619619
languageOptions: {
@@ -636,7 +636,7 @@ export async function formatters(
636636
}
637637

638638
if (options.graphql !== undefined && options.graphql) {
639-
m_configs.push({
639+
mut_configs.push({
640640
files: [GLOB_GRAPHQL],
641641
languageOptions: {
642642
parser: parserPlain,
@@ -655,5 +655,5 @@ export async function formatters(
655655
});
656656
}
657657

658-
return m_configs;
658+
return mut_configs;
659659
}

src/configs/functional.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export async function functional(
7575
"functional/immutable-data": [
7676
"error",
7777
{
78-
ignoreAccessorPattern: ["**.mutable*.**", "**.m_*.**"],
78+
ignoreAccessorPattern: ["**.mut_*.**"],
7979
ignoreClasses: "fieldsOnly",
8080
ignoreImmediateMutation: true,
8181
ignoreNonConstDeclarations: true,

src/configs/javascript.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export function javascript(options: Readonly<Required<OptionsOverrides & Options
331331
? { props: false }
332332
: {
333333
props: true,
334-
ignorePropertyModificationsForRegex: ["^[mM]_"],
334+
ignorePropertyModificationsForRegex: ["^[mM]ut_"],
335335
},
336336
],
337337
}),

src/configs/typescript.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ export async function typescript(
312312
selector: "variableLike",
313313
filter: { regex: "_[^_]+", match: true },
314314
format: ["camelCase", "PascalCase"],
315-
prefix: ["m_", "M_"],
315+
prefix: ["mut_", "Mut_"],
316316
leadingUnderscore: "forbid",
317317
trailingUnderscore: "forbid",
318318
},
@@ -325,7 +325,7 @@ export async function typescript(
325325
{
326326
selector: "variable",
327327
format: ["camelCase", "PascalCase", "UPPER_CASE"],
328-
prefix: ["m_", "M_"],
328+
prefix: ["mut_", "Mut_"],
329329
leadingUnderscore: "forbid",
330330
trailingUnderscore: "forbid",
331331
},
@@ -342,7 +342,7 @@ export async function typescript(
342342
filter: { regex: "_[^_]+", match: true },
343343
format: ["camelCase", "PascalCase"],
344344
modifiers: ["const"],
345-
prefix: ["m_", "M_"],
345+
prefix: ["mut_", "Mut_"],
346346
leadingUnderscore: "forbid",
347347
trailingUnderscore: "forbid",
348348
},
@@ -368,7 +368,7 @@ export async function typescript(
368368
{
369369
selector: ["autoAccessor", "parameterProperty", "property"],
370370
format: ["camelCase", "PascalCase"],
371-
prefix: ["m_", "M_"],
371+
prefix: ["mut_", "Mut_"],
372372
leadingUnderscore: "forbid",
373373
trailingUnderscore: "forbid",
374374
},
@@ -377,7 +377,7 @@ export async function typescript(
377377
filter: { regex: "_[^_]+", match: true },
378378
format: ["camelCase", "PascalCase"],
379379
modifiers: ["readonly"],
380-
prefix: ["m_", "M_"],
380+
prefix: ["mut_", "Mut_"],
381381
leadingUnderscore: "forbid",
382382
trailingUnderscore: "forbid",
383383
},

src/factory.ts

+23-23
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ export async function rsEslint(
177177

178178
const functionalConfigOptions = {
179179
functionalEnforcement,
180-
ignoreNamePattern: ["^mutable", "^[mM]_"],
180+
ignoreNamePattern: ["^[mM]ut_"],
181181
...resolveSubOptions(options, "functional"),
182182
};
183183

184-
const m_configs: Array<Awaitable<FlatConfigItem[]>> = [];
184+
const mut_configs: Array<Awaitable<FlatConfigItem[]>> = [];
185185

186186
// Base configs
187-
m_configs.push(
187+
mut_configs.push(
188188
ignores({
189189
projectRoot,
190190
ignores: ignoresOptions ?? [],
@@ -214,15 +214,15 @@ export async function rsEslint(
214214
}
215215

216216
if (sonarOptions) {
217-
m_configs.push(sonar(functionalConfigOptions));
217+
mut_configs.push(sonar(functionalConfigOptions));
218218
}
219219

220220
if (jsxOptions) {
221-
m_configs.push(jsx());
221+
mut_configs.push(jsx());
222222
}
223223

224224
if (typeScriptOptions !== false) {
225-
m_configs.push(
225+
mut_configs.push(
226226
typescript({
227227
projectRoot,
228228
mode,
@@ -237,7 +237,7 @@ export async function rsEslint(
237237
}
238238

239239
if (stylisticOptions !== false) {
240-
m_configs.push(
240+
mut_configs.push(
241241
stylistic({
242242
stylistic: stylisticOptions,
243243
typescript: hasTypeScript,
@@ -247,7 +247,7 @@ export async function rsEslint(
247247
}
248248

249249
if (functionalEnforcement !== "none" || mode === "library") {
250-
m_configs.push(
250+
mut_configs.push(
251251
functional({
252252
...typescriptConfigOptions,
253253
...functionalConfigOptions,
@@ -259,7 +259,7 @@ export async function rsEslint(
259259
}
260260

261261
if (testOptions !== false) {
262-
m_configs.push(
262+
mut_configs.push(
263263
test({
264264
files: GLOB_TESTS,
265265
overrides: getOverrides(options, "test"),
@@ -268,7 +268,7 @@ export async function rsEslint(
268268
}
269269

270270
if (vueOptions !== false) {
271-
m_configs.push(
271+
mut_configs.push(
272272
vue({
273273
...typescriptConfigOptions,
274274
typescript: hasTypeScript,
@@ -284,7 +284,7 @@ export async function rsEslint(
284284
}
285285

286286
if (reactOptions !== false) {
287-
m_configs.push(
287+
mut_configs.push(
288288
react({
289289
...typescriptConfigOptions,
290290
typescript: hasTypeScript,
@@ -297,7 +297,7 @@ export async function rsEslint(
297297
}
298298

299299
if (tailwindOptions !== false) {
300-
m_configs.push(
300+
mut_configs.push(
301301
tailwind({
302302
stylistic: stylisticOptions,
303303
overrides: getOverrides(options, "tailwind"),
@@ -306,7 +306,7 @@ export async function rsEslint(
306306
}
307307

308308
if (unoCSSOptions !== false) {
309-
m_configs.push(
309+
mut_configs.push(
310310
unocss({
311311
attributify: true,
312312
strict: true,
@@ -317,7 +317,7 @@ export async function rsEslint(
317317
}
318318

319319
if (jsoncOptions !== false) {
320-
m_configs.push(
320+
mut_configs.push(
321321
jsonc({
322322
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
323323
overrides: getOverrides(options, "jsonc"),
@@ -328,7 +328,7 @@ export async function rsEslint(
328328
}
329329

330330
if (yamlOptions !== false) {
331-
m_configs.push(
331+
mut_configs.push(
332332
yaml({
333333
files: [GLOB_YAML],
334334
overrides: getOverrides(options, "yaml"),
@@ -338,7 +338,7 @@ export async function rsEslint(
338338
}
339339

340340
if (tomlOptions !== false) {
341-
m_configs.push(
341+
mut_configs.push(
342342
toml({
343343
files: [GLOB_TOML],
344344
overrides: getOverrides(options, "toml"),
@@ -348,7 +348,7 @@ export async function rsEslint(
348348
}
349349

350350
if (markdownOptions !== false) {
351-
m_configs.push(
351+
mut_configs.push(
352352
markdown({
353353
enableTypeRequiredRules: !(markdownOptions === true || markdownOptions.enableTypeRequiredRules === false),
354354
files: [GLOB_MARKDOWN],
@@ -359,22 +359,22 @@ export async function rsEslint(
359359
}
360360

361361
if (formattersOptions !== false) {
362-
m_configs.push(formatters(formattersOptions, stylisticOptions === false ? {} : stylisticOptions));
362+
mut_configs.push(formatters(formattersOptions, stylisticOptions === false ? {} : stylisticOptions));
363363
}
364364

365365
if (isInEditor) {
366-
m_configs.push(inEditor());
366+
mut_configs.push(inEditor());
367367
}
368368

369-
m_configs.push(overrides());
369+
mut_configs.push(overrides());
370370

371-
let m_composer = new FlatConfigComposer<FlatConfigItem>().append(...m_configs, ...userConfigs);
371+
let mut_composer = new FlatConfigComposer<FlatConfigItem>().append(...mut_configs, ...userConfigs);
372372

373373
if (autoRenamePlugins) {
374-
m_composer = m_composer.renamePlugins(defaultPluginRenaming);
374+
mut_composer = mut_composer.renamePlugins(defaultPluginRenaming);
375375
}
376376

377-
return m_composer.toConfigs();
377+
return mut_composer.toConfigs();
378378
}
379379

380380
export type ResolvedOptions<T> = T extends boolean ? never : T extends string ? never : NonNullable<T>;

src/utils.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,33 @@ export async function loadPackages<T extends string[]>(
5858
}
5959

6060
const installPackagesToLoad = new Set<string>();
61-
let m_installPackagesAction: Promise<void> | null = null;
62-
let m_installPackagesActionResolver: ((value: string[] | PromiseLike<string[]>) => void) | null = null;
63-
let m_installPackagesTimeout: NodeJS.Timeout | null = null;
61+
let mut_installPackagesAction: Promise<void> | null = null;
62+
let mut_installPackagesActionResolver: ((value: string[] | PromiseLike<string[]>) => void) | null = null;
63+
let mut_installPackagesTimeout: NodeJS.Timeout | null = null;
6464

6565
/* eslint-disable functional/no-loop-statements */
6666
async function installPackages(packages: ReadonlyArray<string>) {
6767
for (const p of packages) {
6868
installPackagesToLoad.add(p);
6969
}
7070

71-
if (m_installPackagesTimeout !== null) {
72-
clearTimeout(m_installPackagesTimeout);
71+
if (mut_installPackagesTimeout !== null) {
72+
clearTimeout(mut_installPackagesTimeout);
7373
}
7474

75-
m_installPackagesTimeout = setTimeout(() => {
75+
mut_installPackagesTimeout = setTimeout(() => {
7676
const allPackages = [...installPackagesToLoad.values()];
77-
m_installPackagesTimeout = null;
77+
mut_installPackagesTimeout = null;
7878
installPackagesToLoad.clear();
79-
m_installPackagesAction = null;
80-
assert(m_installPackagesActionResolver !== null);
81-
m_installPackagesActionResolver(allPackages);
82-
m_installPackagesActionResolver = null;
79+
mut_installPackagesAction = null;
80+
assert(mut_installPackagesActionResolver !== null);
81+
mut_installPackagesActionResolver(allPackages);
82+
mut_installPackagesActionResolver = null;
8383
}, 100);
8484

85-
if (m_installPackagesAction === null) {
86-
m_installPackagesAction = new Promise<string[]>((resolve) => {
87-
m_installPackagesActionResolver = resolve;
85+
if (mut_installPackagesAction === null) {
86+
mut_installPackagesAction = new Promise<string[]>((resolve) => {
87+
mut_installPackagesActionResolver = resolve;
8888
}).then(async (allPackages: string[]) => {
8989
const allPackagesString = allPackages.join(", ");
9090

@@ -106,6 +106,6 @@ async function installPackages(packages: ReadonlyArray<string>) {
106106
});
107107
}
108108

109-
return m_installPackagesAction;
109+
return mut_installPackagesAction;
110110
}
111111
/* eslint-enable functional/no-loop-statements */

0 commit comments

Comments
 (0)