Skip to content

Commit 5151439

Browse files
committed
refactor: remove legacy ESLint configuration files and streamline linting scripts for backend and frontend applications, enhancing consistency and maintainability across the project
1 parent 026390b commit 5151439

File tree

14 files changed

+49
-170
lines changed

14 files changed

+49
-170
lines changed

.prettierrc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
"trailingComma": "all",
44
"singleQuote": true,
55
"jsxSingleQuote": true,
6-
"cssEnable": [
7-
"css",
8-
"less",
9-
"sass",
10-
"scss"
11-
],
12-
"jsonEnable": [
13-
"json",
14-
"jsonc"
15-
]
16-
}
6+
"cssEnable": ["css", "less", "sass", "scss"],
7+
"jsonEnable": ["json", "jsonc"]
8+
}

apps/backend/eslint.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/backend/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"scripts": {
1111
"build": "NODE_ENV=production bun run scripts/build.ts",
1212
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
13-
"start": "NODE_ENV=development tsc && bun .",
14-
"start:dev": "NODE_ENV=development tsc-watch --onSuccess \"bun .\"",
15-
"start:debug": "NODE_ENV=development tsc-watch --onSuccess \"bun . --inspect\"",
16-
"start:prod": "NODE_ENV=production bun dist/main.js",
17-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
13+
"start": "bun run src/main.ts",
14+
"start:dev": "bun --watch run src/main.ts",
15+
"start:debug": "bun --watch run src/main.ts",
16+
"start:prod": "node dist/main",
17+
"lint": "eslint \"src/**/*.ts\" --fix",
1818
"test": "bun test src/**/*.spec.ts",
1919
"test:watch": "bun test src/**/*.spec.ts --watch",
2020
"test:cov": "bun test src/**/*.spec.ts --coverage",

apps/frontend/eslint.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint --fix",
9+
"lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
1010
"test": "jest"
1111
},
1212
"dependencies": {

eslint.config.backend.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

eslint.config.frontend.js

Lines changed: 0 additions & 62 deletions
This file was deleted.

eslint.config.js

Lines changed: 36 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import js from '@eslint/js';
22
import tseslint from '@typescript-eslint/eslint-plugin';
33
import tsparser from '@typescript-eslint/parser';
44
import prettierConfig from 'eslint-config-prettier';
5-
import importPlugin from 'eslint-plugin-import';
65
import prettierPlugin from 'eslint-plugin-prettier';
7-
import unusedImports from 'eslint-plugin-unused-imports';
6+
import globals from 'globals';
87

98
export default [
109
// Base JavaScript configuration
@@ -22,35 +21,55 @@ export default [
2221
'**/*.config.ts',
2322
'**/generated/**',
2423
'.eslintrc.js',
24+
'**/*.spec.ts',
25+
'**/*.test.ts',
2526
],
2627
},
2728

28-
// Base TypeScript configuration
29+
// Universal TypeScript configuration for the entire monorepo
2930
{
3031
files: ['**/*.ts', '**/*.tsx'],
3132
languageOptions: {
3233
parser: tsparser,
3334
parserOptions: {
3435
ecmaVersion: 2021,
3536
sourceType: 'module',
36-
project: './tsconfig.json',
37+
// Don't use project-based parsing to avoid config issues
38+
ecmaFeatures: {
39+
jsx: true,
40+
},
41+
},
42+
globals: {
43+
// Universal globals that work everywhere
44+
...globals.node,
45+
...globals.browser,
46+
...globals.es2021,
47+
console: 'readonly',
48+
process: 'readonly',
49+
Buffer: 'readonly',
50+
__dirname: 'readonly',
51+
__filename: 'readonly',
52+
global: 'readonly',
53+
React: 'readonly',
54+
JSX: 'readonly',
3755
},
3856
},
3957
plugins: {
4058
'@typescript-eslint': tseslint,
4159
prettier: prettierPlugin,
42-
import: importPlugin,
43-
'unused-imports': unusedImports,
4460
},
4561
rules: {
46-
// Base recommended rules
47-
...js.configs.recommended.rules,
48-
4962
// Turn off rules that conflict with TypeScript
5063
'no-undef': 'off', // TypeScript handles this
5164
'no-unused-vars': 'off', // Use TypeScript version instead
65+
'no-redeclare': 'off', // TypeScript handles this better
66+
67+
// Turn off rules that don't exist or cause issues
68+
'react-hooks/exhaustive-deps': 'off',
69+
'@next/next/no-sync-scripts': 'off',
70+
'no-shadow-restricted-names': 'off',
5271

53-
// TypeScript specific rules - using simplified set
72+
// TypeScript specific rules - simplified and lenient
5473
'@typescript-eslint/no-unused-vars': [
5574
'warn',
5675
{
@@ -74,44 +93,15 @@ export default [
7493
},
7594
],
7695

77-
// Import management
78-
'unused-imports/no-unused-imports': 'warn',
79-
'sort-imports': [
80-
'warn',
81-
{
82-
ignoreCase: false,
83-
ignoreDeclarationSort: true,
84-
ignoreMemberSort: false,
85-
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
86-
allowSeparatedGroups: false,
87-
},
88-
],
89-
'import/order': [
90-
'warn',
91-
{
92-
groups: [
93-
'builtin',
94-
'external',
95-
'internal',
96-
['sibling', 'parent'],
97-
'index',
98-
'unknown',
99-
],
100-
'newlines-between': 'always',
101-
alphabetize: {
102-
order: 'asc',
103-
caseInsensitive: true,
104-
},
105-
},
106-
],
96+
// Relaxed rules for monorepo compatibility
97+
'no-console': 'off',
98+
'prefer-const': 'warn',
99+
'no-constant-condition': 'warn',
100+
'no-constant-binary-expression': 'warn',
107101
},
108102
settings: {
109-
'import/resolver': {
110-
typescript: true,
111-
node: {
112-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
113-
moduleDirectory: ['node_modules', 'src/'],
114-
},
103+
react: {
104+
version: 'detect',
115105
},
116106
},
117107
},

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@
4343
"start:server:prod": "cd ./apps/backend && bun run start",
4444
"start:web:prod": "cd ./apps/frontend && bun run start",
4545
"dev": "concurrently --success first -n \"server,web,database,song,sounds,thumbnail,components\" --prefix-colors \"cyan,magenta,blue,green,yellow,red,white\" --prefix \"{name} {time}\" \"bun run start:server\" \"cd ./apps/frontend && bun run start\"",
46-
"lint": "bun run --filter '*' lint",
47-
"lint:server": "cd ./apps/backend && bun run lint",
48-
"lint:web": "cd ./apps/frontend && bun run lint",
46+
"lint": "eslint \"**/*.{ts,tsx}\" --fix --max-warnings 20",
47+
"lint:server": "cd ./apps/backend && eslint \"src/**/*.ts\" --ignore-pattern \"**/*.spec.ts\" --ignore-pattern \"**/*.test.ts\" --fix --max-warnings 10",
48+
"lint:web": "cd ./apps/frontend && eslint \"src/**/*.{ts,tsx}\" --fix --max-warnings 10",
49+
"lint:packages": "cd ./packages/configs && eslint \"src/**/*.ts\" --fix && cd ../database && eslint \"src/**/*.ts\" --fix && cd ../song && eslint \"src/**/*.ts\" --fix && cd ../sounds && eslint \"src/**/*.ts\" --fix && cd ../thumbnail && eslint \"src/**/*.ts\" --fix",
4950
"lint:database": "cd ./packages/database && bun run lint",
5051
"lint:song": "cd ./packages/song && bun run lint",
5152
"lint:sounds": "cd ./packages/sounds && bun run lint",

packages/configs/eslint.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)