Skip to content

Commit 03a64b2

Browse files
committed
refactor: standardize code formatting and improve linting configuration
1 parent 106a338 commit 03a64b2

27 files changed

+1437
-1179
lines changed

.unimportedrc.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"ignorePatterns": [
3-
"**/node_modules/**",
4-
"**/*.tests.{js,jsx,ts,tsx}",
5-
"**/*.test.{js,jsx,ts,tsx}",
6-
"**/*.spec.{js,jsx,ts,tsx}",
7-
"**/tests/**",
8-
"**/__tests__/**",
9-
"**/mocks/**",
10-
"**/*.d.ts"
11-
],
12-
"ignoreUnimported": [],
13-
"ignoreUnused": [],
14-
"ignoreUnresolved": [],
15-
"respectGitignore": true,
16-
"aliases": {
17-
"@": ["./src"]
18-
}
2+
"ignorePatterns": [
3+
"**/node_modules/**",
4+
"**/*.tests.{js,jsx,ts,tsx}",
5+
"**/*.test.{js,jsx,ts,tsx}",
6+
"**/*.spec.{js,jsx,ts,tsx}",
7+
"**/tests/**",
8+
"**/__tests__/**",
9+
"**/mocks/**",
10+
"**/*.d.ts"
11+
],
12+
"ignoreUnimported": [],
13+
"ignoreUnused": [],
14+
"ignoreUnresolved": [],
15+
"respectGitignore": true,
16+
"aliases": {
17+
"@": ["./src"]
18+
}
1919
}

CHANGELOG.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
[{"version":"1.0.0","type":"major","comment":"Initial implementation.","date":"Tue Jul 08 2025","author":"BorysShulyak","issueLinks":[]}]
1+
[
2+
{
3+
"version": "1.0.0",
4+
"type": "major",
5+
"comment": "Initial implementation.",
6+
"date": "Tue Jul 08 2025",
7+
"author": "BorysShulyak",
8+
"issueLinks": []
9+
}
10+
]

biome.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
},
1111
"linter": {
1212
"enabled": true,
13+
"domains": {
14+
"test": "all"
15+
},
1316
"rules": {
1417
"recommended": true
1518
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build": "tsup",
1515
"test": "vitest run",
1616
"lint": "biome lint",
17-
"lint:fix": "biome lint --write",
17+
"lint:fix": "biome lint --write --unsafe",
1818
"lint:ci": "biome ci --formatter-enabled=false --assist-enabled=false --enforce-assist=false",
1919
"format": "biome format",
2020
"format:fix": "biome format --write",

src/commands/check.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
import { DEFAULT_LINTED_FILE_REGEX } from '../constants/regex';
2-
import { eslintCheckFiles } from '../utils/eslint/eslintCheckFiles/eslintCheckFiles';
1+
import { DEFAULT_LINTED_FILE_REGEX } from "../constants/regex";
2+
import { eslintCheckFiles } from "../utils/eslint/eslintCheckFiles/eslintCheckFiles";
33

4-
export const check = async (options: { rootDir?: string; pattern?: string[] }) => {
5-
try {
6-
const rootDir = options.rootDir || './';
7-
const filesRegex = options.pattern
8-
? options.pattern.map((pattern) => new RegExp(pattern))
9-
: [DEFAULT_LINTED_FILE_REGEX];
4+
export const check = async (options: {
5+
rootDir?: string;
6+
pattern?: string[];
7+
}) => {
8+
try {
9+
const rootDir = options.rootDir || "./";
10+
const filesRegex = options.pattern
11+
? options.pattern.map((pattern) => new RegExp(pattern))
12+
: [DEFAULT_LINTED_FILE_REGEX];
1013

11-
console.log(`Checking files in ${rootDir} for eslint-disable comments...`);
14+
console.log(`Checking files in ${rootDir} for eslint-disable comments...`);
1215

13-
await eslintCheckFiles({
14-
rootDir,
15-
filesRegex
16-
});
16+
await eslintCheckFiles({
17+
rootDir,
18+
filesRegex,
19+
});
1720

18-
console.log('✅ All files are clean - no eslint-disable comments found.');
19-
} catch (error) {
20-
console.error('❌ Eslint-disable comments found:');
21-
console.error(error instanceof Error ? error.message : String(error));
22-
process.exit(1);
23-
}
21+
console.log("✅ All files are clean - no eslint-disable comments found.");
22+
} catch (error) {
23+
console.error("❌ Eslint-disable comments found:");
24+
console.error(error instanceof Error ? error.message : String(error));
25+
process.exit(1);
26+
}
2427
};

src/commands/checkStaged.ts

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1-
import { DEFAULT_LINTED_FILE_REGEX } from '../constants/regex';
2-
import { eslintCheckStagedFiles } from '../utils/eslint/eslintCheckStagedFiles/eslintCheckStagedFiles';
1+
import { DEFAULT_LINTED_FILE_REGEX } from "../constants/regex";
2+
import { eslintCheckStagedFiles } from "../utils/eslint/eslintCheckStagedFiles/eslintCheckStagedFiles";
33

4-
export const checkStaged = async (options: { rootDir?: string; pattern?: string[] }) => {
5-
try {
6-
const rootDir = options.rootDir || './';
7-
const filesRegex = options.pattern
8-
? options.pattern.map((pattern) => new RegExp(pattern))
9-
: [DEFAULT_LINTED_FILE_REGEX];
4+
export const checkStaged = async (options: {
5+
rootDir?: string;
6+
pattern?: string[];
7+
}) => {
8+
try {
9+
const rootDir = options.rootDir || "./";
10+
const filesRegex = options.pattern
11+
? options.pattern.map((pattern) => new RegExp(pattern))
12+
: [DEFAULT_LINTED_FILE_REGEX];
1013

11-
console.log('Checking staged files for eslint-disable comments...');
14+
console.log("Checking staged files for eslint-disable comments...");
1215

13-
await eslintCheckStagedFiles({
14-
rootDir,
15-
filesRegex,
16-
onFileProcessed: (filePath) => {
17-
console.log(`✓ Checked: ${filePath}`);
18-
}
19-
});
16+
await eslintCheckStagedFiles({
17+
rootDir,
18+
filesRegex,
19+
onFileProcessed: (filePath) => {
20+
console.log(`✓ Checked: ${filePath}`);
21+
},
22+
});
2023

21-
console.log('✅ All staged files are clean - no eslint-disable comments found.');
22-
} catch (error) {
23-
console.error('❌ Eslint-disable comments found in staged files:');
24-
console.error(error instanceof Error ? error.message : String(error));
25-
process.exit(1);
26-
}
24+
console.log(
25+
"✅ All staged files are clean - no eslint-disable comments found.",
26+
);
27+
} catch (error) {
28+
console.error("❌ Eslint-disable comments found in staged files:");
29+
console.error(error instanceof Error ? error.message : String(error));
30+
process.exit(1);
31+
}
2732
};

src/commands/disable.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
import { SUCCESS } from '../constants/successMessages';
2-
import { eslintDisableFiles } from '../utils/eslint/eslintDisbaleFiles/eslintDisbaleFiles';
1+
import { SUCCESS } from "../constants/successMessages";
2+
import { eslintDisableFiles } from "../utils/eslint/eslintDisbaleFiles/eslintDisbaleFiles";
33

4-
export const disable = async (options?: { rootDir?: string; pattern?: string[] }) => {
5-
const processedPatterns = options?.pattern?.map((pattern) => new RegExp(pattern));
6-
await eslintDisableFiles({
7-
rootDir: options?.rootDir,
8-
filesRegex: processedPatterns,
9-
onFileProcessed: (filePath) => {
10-
console.info(SUCCESS.eslintDisableFile(filePath));
11-
}
12-
});
4+
export const disable = async (options?: {
5+
rootDir?: string;
6+
pattern?: string[];
7+
}) => {
8+
const processedPatterns = options?.pattern?.map(
9+
(pattern) => new RegExp(pattern),
10+
);
11+
await eslintDisableFiles({
12+
rootDir: options?.rootDir,
13+
filesRegex: processedPatterns,
14+
onFileProcessed: (filePath) => {
15+
console.info(SUCCESS.eslintDisableFile(filePath));
16+
},
17+
});
1318
};

src/constants/errorMessages.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export const ERRORS = {
2-
writeFileError: (filePath: string) => `Error: Failed to write to ${filePath} file.`,
3-
readFileError: (filePath: string) => `Error: Failed to read ${filePath} file.`,
4-
eslintDisableFoundError: (filePath: string) =>
5-
`Error: File ${filePath} contains eslint-disable comment. Please remove it.`
2+
writeFileError: (filePath: string) =>
3+
`Error: Failed to write to ${filePath} file.`,
4+
readFileError: (filePath: string) =>
5+
`Error: Failed to read ${filePath} file.`,
6+
eslintDisableFoundError: (filePath: string) =>
7+
`Error: File ${filePath} contains eslint-disable comment. Please remove it.`,
68
};

src/constants/eslint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const ESLINT_DISABLE_FILES = '/* eslint-disable */';
1+
export const ESLINT_DISABLE_FILES = "/* eslint-disable */";

src/constants/successMessages.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const SUCCESS = {
2-
eslintDisableFile: (filePath: string) => `Successfully disabled eslint for ${filePath}`
2+
eslintDisableFile: (filePath: string) =>
3+
`Successfully disabled eslint for ${filePath}`,
34
};

0 commit comments

Comments
 (0)