1- import docusauruseslint from "@docusaurus/ eslint-plugin " ;
1+ import { FlatCompat } from "@eslint/eslintrc " ;
22import eslint from "@eslint/js" ;
33import perfectionisteslint from "eslint-plugin-perfectionist" ;
44import globals from "globals" ;
55import tseslint from "typescript-eslint" ;
66
7+ const compat = new FlatCompat ( {
8+ baseDirectory : import . meta. dirname ,
9+ } ) ;
10+
711export default tseslint . config (
812 // Use recommended eslint rules
913 eslint . configs . recommended ,
1014
11- // Use strict type-checked typescript-eslint rules
12- tseslint . configs . strictTypeChecked ,
15+ // Use recommended type-checked typescript-eslint rules
16+ tseslint . configs . recommendedTypeChecked ,
1317
1418 // Use stylistic type-checked typescript-eslint rules
1519 tseslint . configs . stylisticTypeChecked ,
1620
21+ // Use recommended Docusaurus rules
22+ ...compat . extends ( "plugin:@docusaurus/recommended" ) ,
23+
1724 // Use recommended perfectionist rules
1825 perfectionisteslint . configs [ "recommended-alphabetical" ] ,
1926
@@ -24,6 +31,9 @@ export default tseslint.config(
2431 // Support browser globals
2532 ...globals . browser ,
2633
34+ // Support ES2023 globals
35+ ...globals . es2023 ,
36+
2737 // Support node globals
2838 ...globals . node ,
2939 } ,
@@ -33,20 +43,63 @@ export default tseslint.config(
3343 // Needed for type-aware linting
3444 projectService : true ,
3545
46+ // Allow ES2022 syntax
47+ sourceType : "module" ,
48+
3649 // Set the root directory of the project
3750 // Needed for type-aware linting
3851 tsconfigRootDir : import . meta. dirname ,
3952 } ,
4053 } ,
4154
42- plugins : {
43- // Enable docusaurus plugin
44- "@docusaurus" : docusauruseslint ,
45- } ,
46-
4755 rules : {
48- // Use recommended docusaurus rules
49- ...docusauruseslint . configs . recommended . rules ,
56+ // Use objects instead of records for empty types
57+ "@typescript-eslint/consistent-indexed-object-style" : [
58+ "error" ,
59+ "index-signature" ,
60+ ] ,
61+
62+ // Use types instead of interfaces
63+ "@typescript-eslint/consistent-type-definitions" : [ "error" , "type" ] ,
64+
65+ // Allow promises in callbacks
66+ "@typescript-eslint/no-misused-promises" : [
67+ "error" ,
68+ {
69+ checksVoidReturn : false ,
70+ } ,
71+ ] ,
72+
73+ // Allow nullish coalescing operator for primitive types
74+ "@typescript-eslint/prefer-nullish-coalescing" : [
75+ "error" ,
76+ {
77+ ignorePrimitives : true ,
78+ } ,
79+ ] ,
80+
81+ // Allow async functions without await
82+ "@typescript-eslint/require-await" : "off" ,
83+
84+ // Skip checking whether static methods are bound
85+ "@typescript-eslint/unbound-method" : [
86+ "error" ,
87+ {
88+ ignoreStatic : true ,
89+ } ,
90+ ] ,
91+
92+ // Allow anonymous default exports
93+ "import/no-anonymous-default-export" : "off" ,
94+
95+ // Allow empty block statements
96+ "no-empty" : "off" ,
97+
98+ // Allow empty destructuring patterns
99+ "no-empty-pattern" : "off" ,
100+
101+ // Don't sort module members
102+ "perfectionist/sort-modules" : "off" ,
50103 } ,
51104 } ,
52105) ;
0 commit comments