@@ -22,7 +22,7 @@ function addRule (rules, name, value) {
22
22
const ruleSet = config . find ( c => c . name === rules )
23
23
24
24
assert . ok ( ruleSet , `No ruleset with name ${ rules } found` )
25
- assert . notDeepEqual ( ruleSet . rules ?. [ name ] , value , `${ rules } /${ name } is already set to ${ value } ` )
25
+ assert . notDeepEqual ( ruleSet . rules ?. [ name ] , value , `${ rules } /${ name } is already set to ${ JSON . stringify ( value , null , 2 ) } ` )
26
26
27
27
ruleSet . rules ??= { }
28
28
ruleSet . rules [ name ] = value
@@ -103,18 +103,34 @@ setParser('neostandard/ts', eslintParser, {
103
103
ecmaVersion : 'latest'
104
104
} )
105
105
106
+ // TODO: not compatible with ESLint 9x yet
106
107
// addPlugin('neostandard/ts', 'etc', etc)
107
-
108
108
// addRule('neostandard/ts', 'etc/prefer-interface', 'error') // https://ncjamieson.com/prefer-interfaces/
109
+
110
+ addRule ( 'neostandard/ts' , '@typescript-eslint/no-use-before-define' , [
111
+ 'error' , {
112
+ functions : false ,
113
+ classes : false ,
114
+ enums : false ,
115
+ variables : false ,
116
+ typedefs : false ,
117
+ }
118
+ ] ) // Types often are recursive & no use before define is too restrictive
109
119
addRule ( 'neostandard/ts' , '@typescript-eslint/prefer-function-type' , 'off' ) // conflicts with 'etc/prefer-interface'
110
- addRule ( 'neostandard/ts' , '@typescript-eslint/explicit-function-return-type' , 'error' ) // functions require return types
120
+ addRule ( 'neostandard/ts' , '@typescript-eslint/explicit-function-return-type' , [
121
+ 'error' , {
122
+ allowExpressions : true ,
123
+ allowHigherOrderFunctions : true ,
124
+ allowTypedFunctionExpressions : true ,
125
+ allowDirectConstAssertionInArrowFunctions : true
126
+ }
127
+ ] ) // functions require return types
111
128
addRule ( 'neostandard/ts' , '@typescript-eslint/no-this-alias' , 'off' ) // allow 'const self = this'
112
129
addRule ( 'neostandard/ts' , '@typescript-eslint/await-thenable' , 'error' ) // disallows awaiting a value that is not a "Thenable"
113
130
addRule ( 'neostandard/ts' , '@typescript-eslint/restrict-template-expressions' , 'off' ) // allow values with `any` type in template literals
114
131
addRule ( 'neostandard/ts' , '@typescript-eslint/method-signature-style' , [ 'error' , 'method' ] ) // enforce method signature style
115
132
addRule ( 'neostandard/ts' , '@typescript-eslint/no-unsafe-argument' , 'off' ) // allow passing argswith `any` type to functions
116
133
addRule ( 'neostandard/ts' , '@typescript-eslint/unbound-method' , 'off' ) // allow invoking functions that may be unbound (e.g. passed as part of an options object)
117
- addRule ( 'neostandard/ts' , '@typescript-eslint/no-unused-vars' , 'error' ) // disallow unused variables
118
134
addRule ( 'neostandard/ts' , 'no-return-await' , 'off' ) // disable this rule to use @typescript -eslint/return-await instead
119
135
addRule ( 'neostandard/ts' , '@typescript-eslint/return-await' , [ 'error' , 'in-try-catch' ] ) // require awaiting thenables returned from try/catch
120
136
addRule ( 'neostandard/ts' , 'jsdoc/require-param' , 'off' ) // do not require jsdoc for params
0 commit comments