Skip to content

Commit 28b4e4f

Browse files
committed
chore: integrate @stylistic/eslint-plugin and update ESLint configuration for improved code style enforcement
1 parent 3527592 commit 28b4e4f

File tree

3 files changed

+42
-29
lines changed

3 files changed

+42
-29
lines changed

bun.lock

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
"devDependencies": {
1111
"@eslint/js": "^9.35.0",
12+
"@stylistic/eslint-plugin": "^5.4.0",
1213
"@types/bun": "^1.2.10",
1314
"@types/node": "^20.3.1",
1415
"@typescript-eslint/eslint-plugin": "^8.43.0",
@@ -19,7 +20,6 @@
1920
"eslint-plugin-import": "^2.32.0",
2021
"eslint-plugin-mdx": "^3.6.2",
2122
"eslint-plugin-prettier": "^4.2.5",
22-
"eslint-plugin-unused-imports": "^2.0.0",
2323
"globals": "^16.4.0",
2424
"prettier": "^2.8.8",
2525
},
@@ -864,6 +864,8 @@
864864

865865
"@smithy/util-waiter": ["@smithy/[email protected]", "", { "dependencies": { "@smithy/abort-controller": "^3.1.9", "@smithy/types": "^3.7.2", "tslib": "^2.6.2" } }, "sha512-PpjSboaDUE6yl+1qlg3Si57++e84oXdWGbuFUSAciXsVfEZJJJupR2Nb0QuXHiunt2vGR+1PTizOMvnUPaG2Qg=="],
866866

867+
"@stylistic/eslint-plugin": ["@stylistic/[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.0", "@typescript-eslint/types": "^8.44.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "estraverse": "^5.3.0", "picomatch": "^4.0.3" }, "peerDependencies": { "eslint": ">=9.0.0" } }, "sha512-UG8hdElzuBDzIbjG1QDwnYH0MQ73YLXDFHgZzB4Zh/YJfnw8XNsloVtytqzx0I2Qky9THSdpTmi8Vjn/pf/Lew=="],
868+
867869
"@swc/counter": ["@swc/[email protected]", "", {}, "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ=="],
868870

869871
"@swc/helpers": ["@swc/[email protected]", "", { "dependencies": { "@swc/counter": "^0.1.3", "tslib": "^2.4.0" } }, "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A=="],
@@ -1030,7 +1032,7 @@
10301032

10311033
"@typescript-eslint/type-utils": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.43.0", "@typescript-eslint/typescript-estree": "8.43.0", "@typescript-eslint/utils": "8.43.0", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-qaH1uLBpBuBBuRf8c1mLJ6swOfzCXryhKND04Igr4pckzSEW9JX5Aw9AgW00kwfjWJF0kk0ps9ExKTfvXfw4Qg=="],
10321034

1033-
"@typescript-eslint/types": ["@typescript-eslint/types@8.43.0", "", {}, "sha512-vQ2FZaxJpydjSZJKiSW/LJsabFFvV7KgLC5DiLhkBcykhQj8iK9BOaDmQt74nnKdLvceM5xmhaTF+pLekrxEkw=="],
1035+
"@typescript-eslint/types": ["@typescript-eslint/types@8.44.1", "", {}, "sha512-Lk7uj7y9uQUOEguiDIDLYLJOrYHQa7oBiURYVFqIpGxclAFQ78f6VUOM8lI2XEuNOKNB7XuvM2+2cMXAoq4ALQ=="],
10341036

10351037
"@typescript-eslint/typescript-estree": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/project-service": "8.43.0", "@typescript-eslint/tsconfig-utils": "8.43.0", "@typescript-eslint/types": "8.43.0", "@typescript-eslint/visitor-keys": "8.43.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-7Vv6zlAhPb+cvEpP06WXXy/ZByph9iL6BQRBDj4kmBsW98AqEeQHlj/13X+sZOrKSo9/rNKH4Ul4f6EICREFdw=="],
10361038

@@ -1532,10 +1534,6 @@
15321534

15331535
"eslint-plugin-react-hooks": ["[email protected]", "", { "peerDependencies": { "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" } }, "sha512-AZYbMo/NW9chdL7vk6HQzQhT+PvTAEVqWk9ziruUoW2kAOcN5qNyelv70e0F1VNQAbvutOC9oc+xfWycI9FxDw=="],
15341536

1535-
"eslint-plugin-unused-imports": ["[email protected]", "", { "dependencies": { "eslint-rule-composer": "^0.3.0" }, "peerDependencies": { "@typescript-eslint/eslint-plugin": "^5.0.0", "eslint": "^8.0.0" }, "optionalPeers": ["@typescript-eslint/eslint-plugin"] }, "sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A=="],
1536-
1537-
"eslint-rule-composer": ["[email protected]", "", {}, "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg=="],
1538-
15391537
"eslint-scope": ["[email protected]", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg=="],
15401538

15411539
"eslint-visitor-keys": ["[email protected]", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="],
@@ -2430,7 +2428,7 @@
24302428

24312429
"picocolors": ["[email protected]", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
24322430

2433-
"picomatch": ["[email protected].1", "", {}, "sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg=="],
2431+
"picomatch": ["[email protected].3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
24342432

24352433
"pify": ["[email protected]", "", {}, "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog=="],
24362434

@@ -3026,6 +3024,8 @@
30263024

30273025
"@angular-devkit/core/jsonc-parser": ["[email protected]", "", {}, "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA=="],
30283026

3027+
"@angular-devkit/core/picomatch": ["[email protected]", "", {}, "sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg=="],
3028+
30293029
"@angular-devkit/core/rxjs": ["[email protected]", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg=="],
30303030

30313031
"@angular-devkit/core/source-map": ["[email protected]", "", {}, "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA=="],
@@ -3178,10 +3178,24 @@
31783178

31793179
"@types/whatwg-url/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg=="],
31803180

3181+
"@typescript-eslint/parser/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-vQ2FZaxJpydjSZJKiSW/LJsabFFvV7KgLC5DiLhkBcykhQj8iK9BOaDmQt74nnKdLvceM5xmhaTF+pLekrxEkw=="],
3182+
3183+
"@typescript-eslint/project-service/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-vQ2FZaxJpydjSZJKiSW/LJsabFFvV7KgLC5DiLhkBcykhQj8iK9BOaDmQt74nnKdLvceM5xmhaTF+pLekrxEkw=="],
3184+
3185+
"@typescript-eslint/scope-manager/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-vQ2FZaxJpydjSZJKiSW/LJsabFFvV7KgLC5DiLhkBcykhQj8iK9BOaDmQt74nnKdLvceM5xmhaTF+pLekrxEkw=="],
3186+
3187+
"@typescript-eslint/type-utils/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-vQ2FZaxJpydjSZJKiSW/LJsabFFvV7KgLC5DiLhkBcykhQj8iK9BOaDmQt74nnKdLvceM5xmhaTF+pLekrxEkw=="],
3188+
3189+
"@typescript-eslint/typescript-estree/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-vQ2FZaxJpydjSZJKiSW/LJsabFFvV7KgLC5DiLhkBcykhQj8iK9BOaDmQt74nnKdLvceM5xmhaTF+pLekrxEkw=="],
3190+
31813191
"@typescript-eslint/typescript-estree/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
31823192

31833193
"@typescript-eslint/typescript-estree/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="],
31843194

3195+
"@typescript-eslint/utils/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-vQ2FZaxJpydjSZJKiSW/LJsabFFvV7KgLC5DiLhkBcykhQj8iK9BOaDmQt74nnKdLvceM5xmhaTF+pLekrxEkw=="],
3196+
3197+
"@typescript-eslint/visitor-keys/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-vQ2FZaxJpydjSZJKiSW/LJsabFFvV7KgLC5DiLhkBcykhQj8iK9BOaDmQt74nnKdLvceM5xmhaTF+pLekrxEkw=="],
3198+
31853199
"ajv-formats/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", "uri-js": "^4.2.2" } }, "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA=="],
31863200

31873201
"alce/esprima": ["[email protected]", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-S9VbPDU0adFErpDai3qDkjq8+G05ONtKzcyNrPKg/ZKa+tf879nX2KexNU95b31UoTJjRLInNBHHHjFPoCd7lQ=="],

eslint.config.js

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import js from '@eslint/js';
22
import tseslint from 'typescript-eslint';
33
import globals from 'globals';
44
import importPlugin from 'eslint-plugin-import';
5-
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
5+
import stylistic from '@stylistic/eslint-plugin';
66

77
export default tseslint.config(
88
// Global ignores.
@@ -34,7 +34,7 @@ export default tseslint.config(
3434
},
3535
plugins: {
3636
'import': importPlugin,
37-
'unused-imports': unusedImportsPlugin,
37+
'@stylistic': stylistic,
3838
},
3939
settings: {
4040
'import/resolver': {
@@ -65,19 +65,10 @@ export default tseslint.config(
6565
ignoreStrings: true,
6666
ignoreTemplateLiterals: true,
6767
}],
68-
'key-spacing': ['error', {
69-
align: {
70-
beforeColon: false,
71-
afterColon: true,
72-
on: 'colon',
73-
},
74-
}],
75-
'@typescript-eslint/no-unused-vars': 'off', // Disabled to allow unused-imports plugin to handle it.
7668
'@typescript-eslint/no-explicit-any': 'warn',
7769
'@typescript-eslint/no-require-imports': 'warn',
7870
'@typescript-eslint/ban-ts-comment': 'warn',
79-
'unused-imports/no-unused-imports': 'error',
80-
'unused-imports/no-unused-vars': [
71+
'@typescript-eslint/no-unused-vars': [
8172
'warn',
8273
{
8374
vars: 'all',
@@ -112,14 +103,22 @@ export default tseslint.config(
112103
'import/no-duplicates': 'error',
113104

114105
// Spacing rules for consistency
115-
'space-infix-ops': 'error', // Enforces spaces around operators like +, =, etc.
116-
'keyword-spacing': ['error', { 'before': true, 'after': true }], // Enforces spaces around keywords like if, else.
117-
'arrow-spacing': ['error', { 'before': true, 'after': true }], // Enforces spaces around arrow in arrow functions.
118-
'space-before-blocks': 'error', // Enforces a space before opening curly braces.
119-
'object-curly-spacing': ['error', 'always'], // Enforces spaces inside curly braces: { foo } not {foo}.
120-
'comma-spacing': ['error', { 'before': false, 'after': true }], // Enforces space after a comma, not before.
121-
'space-before-function-paren': ['error', { 'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always' }], // Controls space before function parentheses.
122-
'comma-dangle': ['error', 'never'], // Disallows trailing commas
106+
'@stylistic/space-infix-ops': 'error', // Enforces spaces around operators like +, =, etc.
107+
'@stylistic/keyword-spacing': ['error', { 'before': true, 'after': true }], // Enforces spaces around keywords like if, else.
108+
'@stylistic/arrow-spacing': ['error', { 'before': true, 'after': true }], // Enforces spaces around arrow in arrow functions.
109+
'@stylistic/space-before-blocks': 'error', // Enforces a space before opening curly braces.
110+
'@stylistic/object-curly-spacing': ['error', 'always'], // Enforces spaces inside curly braces: { foo } not {foo}.
111+
'@stylistic/comma-spacing': ['error', { 'before': false, 'after': true }], // Enforces space after a comma, not before.
112+
'@stylistic/space-before-function-paren': ['error', { 'anonymous': 'always', 'named': 'never', 'asyncArrow': 'always' }], // Controls space before function parentheses.
113+
'@stylistic/comma-dangle': ['error', 'never'], // Disallows trailing commas
114+
'@stylistic/key-spacing': ['error', {
115+
align: {
116+
beforeColon: false,
117+
afterColon: true,
118+
on: 'colon',
119+
},
120+
}],
123121
},
124122
},
125-
);
123+
);
124+

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
],
6161
"devDependencies": {
6262
"@eslint/js": "^9.35.0",
63+
"@stylistic/eslint-plugin": "^5.4.0",
6364
"@types/bun": "^1.2.10",
6465
"@types/node": "^20.3.1",
6566
"@typescript-eslint/eslint-plugin": "^8.43.0",
@@ -70,7 +71,6 @@
7071
"eslint-plugin-import": "^2.32.0",
7172
"eslint-plugin-mdx": "^3.6.2",
7273
"eslint-plugin-prettier": "^4.2.5",
73-
"eslint-plugin-unused-imports": "^2.0.0",
7474
"globals": "^16.4.0",
7575
"prettier": "^2.8.8"
7676
},

0 commit comments

Comments
 (0)