11import js from '@eslint/js'
22import tseslint from 'typescript-eslint'
3- import perfectionistNatural from 'eslint-plugin-perfectionist/configs/recommended-natural '
3+ import perfectionist from 'eslint-plugin-perfectionist'
44import { configs as regexpPluginConfigs } from 'eslint-plugin-regexp'
55import eslintConfigPrettier from 'eslint-config-prettier'
66import payloadPlugin from '@payloadcms/eslint-plugin'
@@ -30,24 +30,24 @@ const baseRules = {
3030 {
3131 type : 'natural' ,
3232 order : 'asc' ,
33- 'partition-by-comment' : true ,
34- 'partition-by-new-line' : true ,
33+ partitionByComment : true ,
34+ partitionByNewLine : true ,
3535 groups : [ 'top' , 'unknown' ] ,
36- 'custom-groups' : {
36+ customGroups : {
3737 top : [ '_id' , 'id' , 'name' , 'slug' , 'type' ] ,
3838 } ,
3939 } ,
4040 ] ,
4141 /*'perfectionist/sort-object-types': [
4242 'error',
4343 {
44- 'partition-by-new-line' : true,
44+ partitionByNewLine : true,
4545 },
4646 ],
4747 'perfectionist/sort-interfaces': [
4848 'error',
4949 {
50- 'partition-by-new-line ': true,
50+ partitionByNewLine ': true,
5151 },
5252 ],*/
5353 'payload/no-jsx-import-statements' : 'error' ,
@@ -62,7 +62,6 @@ const reactA11yRules = {
6262
6363const typescriptRules = {
6464 '@typescript-eslint/no-use-before-define' : 'off' ,
65- '@typescript-eslint/ban-ts-comment' : 'off' ,
6665
6766 // Type-aware any rules:
6867 '@typescript-eslint/no-unsafe-assignment' : 'off' ,
@@ -76,7 +75,7 @@ const typescriptRules = {
7675 // Type-aware any rules end
7776
7877 // ts-expect preferred over ts-ignore. It will error if the expected error is no longer present.
79- '@typescript-eslint/prefer -ts-expect-error ' : 'error' ,
78+ '@typescript-eslint/ban -ts-comment ' : 'warn' , // Recommended over deprecated @typescript -eslint/prefer-ts-expect-error: https://github.com/typescript-eslint/typescript-eslint/issues/8333. Set to warn to ease migration.
8079 // By default, it errors for unused variables. This is annoying, warnings are enough.
8180 '@typescript-eslint/no-unused-vars' : [
8281 'warn' ,
@@ -94,7 +93,17 @@ const typescriptRules = {
9493 '@typescript-eslint/restrict-template-expressions' : 'warn' ,
9594 '@typescript-eslint/no-redundant-type-constituents' : 'warn' ,
9695 '@typescript-eslint/no-unnecessary-type-constraint' : 'warn' ,
97- '@typescript-eslint/ban-types' : 'warn' ,
96+ '@typescript-eslint/no-misused-promises' : [
97+ 'error' ,
98+ {
99+ // See https://github.com/typescript-eslint/typescript-eslint/issues/4619 and https://github.com/typescript-eslint/typescript-eslint/pull/4623
100+ // Don't want something like <button onClick={someAsyncFunction}> to error
101+ checksVoidReturn : {
102+ attributes : false ,
103+ arguments : false
104+ }
105+ } ,
106+ ]
98107}
99108
100109/** @typedef {import('eslint').Linter.FlatConfig } */
@@ -103,7 +112,7 @@ let FlatConfig
103112/** @type {FlatConfig } */
104113const baseExtends = deepMerge (
105114 js . configs . recommended ,
106- perfectionistNatural ,
115+ perfectionist . configs [ 'recommended-natural' ] ,
107116 regexpPluginConfigs [ 'flat/recommended' ] ,
108117)
109118
0 commit comments