Skip to content

Commit cfb9a0c

Browse files
committed
feat: adopt stylistic eslint and more
1 parent 2813b68 commit cfb9a0c

File tree

4 files changed

+91
-248
lines changed

4 files changed

+91
-248
lines changed

eslint.config.js

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,55 @@
1-
import configPrisma from 'eslint-config-prisma'
1+
import eslint from '@eslint/js'
2+
import stylistic from '@stylistic/eslint-plugin'
3+
import onlyWarn from 'eslint-plugin-only-warn'
4+
import tsdoc from 'eslint-plugin-tsdoc'
25
import tsEslint from 'typescript-eslint'
36

4-
export default tsEslint.config({
5-
extends: [...configPrisma],
6-
ignores: ['**/build/**/*', 'eslint.config.js'],
7-
languageOptions: {
8-
parserOptions: {
9-
project: true,
10-
tsconfigRootDir: import.meta.dirname,
7+
export default tsEslint.config(
8+
eslint.configs.recommended,
9+
stylistic.configs.recommended,
10+
tsEslint.configs.recommendedTypeChecked,
11+
tsEslint.configs.strictTypeChecked,
12+
tsEslint.configs.eslintRecommended,
13+
tsEslint.configs.stylisticTypeChecked,
14+
{
15+
ignores: ['build', 'eslint.config.js'],
16+
},
17+
{
18+
languageOptions: {
19+
parserOptions: {
20+
projectService: true,
21+
tsconfigRootDir: import.meta.dirname,
22+
},
23+
},
24+
plugins: {
25+
// https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
26+
tsdoc: tsdoc,
27+
// This makes it so the IDE reports lint rejections as warnings only. This is
28+
// better than errors because most lint rejections are not runtime errors. This
29+
// allows IDE errors to be exclusive for e.g. static type errors which often are
30+
// reflective of real runtime errors.
31+
// https://github.com/bfanger/eslint-plugin-only-warn
32+
onlyWarn,
33+
'@stylistic': stylistic,
34+
},
35+
rules: {
36+
'@stylistic/quotes': ['warn', 'backtick'],
37+
'@typescript-eslint/consistent-type-imports': 'warn',
38+
'tsdoc/syntax': 'warn',
39+
// TypeScript makes these safe & effective
40+
'no-case-declarations': 'off',
41+
// Same approach used by TypeScript noUnusedLocals
42+
'@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
43+
// Needed when working with .mts/.cts where a lone e.g. <T> is not allowed
44+
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
45+
// Useful for organizing Types
46+
'@typescript-eslint/no-namespace': 'off',
47+
// Turn training wheels off. When we want these we want these.
48+
'@typescript-eslint/no-non-null-assertion': 'off',
49+
'@typescript-eslint/no-unsafe-argument': 'off',
50+
'@typescript-eslint/no-unsafe-return': 'off',
51+
'@typescript-eslint/no-explicit-any': 'off',
52+
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-expect-error': false }],
1153
},
1254
},
13-
})
55+
)

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"check:publint": "publint run --strict"
4646
},
4747
"devDependencies": {
48+
"@stylistic/eslint-plugin": "^4.2.0",
4849
"@tsconfig/node22": "^22.0.0",
4950
"@tsconfig/recommended": "1.0.8",
5051
"@tsconfig/strictest": "2.0.5",
@@ -53,10 +54,7 @@
5354
"@typescript-eslint/parser": "8.27.0",
5455
"dripip": "0.10.0",
5556
"eslint": "9.22.0",
56-
"eslint-config-prisma": "0.6.0",
57-
"eslint-plugin-deprecation": "3.0.0",
5857
"eslint-plugin-only-warn": "1.1.0",
59-
"eslint-plugin-prefer-arrow": "1.2.3",
6058
"eslint-plugin-tsdoc": "0.4.0",
6159
"execa": "9.5.2",
6260
"fast-glob": "3.3.3",
@@ -67,6 +65,7 @@
6765
"publint": "^0.3.9",
6866
"tsx": "4.19.3",
6967
"typescript": "5.8.2",
68+
"typescript-eslint": "^8.27.0",
7069
"vitest": "3.0.9"
7170
}
7271
}

0 commit comments

Comments
 (0)