eslint-plugin-typescript-space-curly v1.0.2
Description
This package is a typescript-eslint plugin that adds rules for inner spacing for curly braces in interfaces and literal object types.
Installation
Run the command
npm install eslint-plugin-typescript-space-curly.
Inside .eslintrc.js, add this line in your plugins : 'typescript-space-curly'
And finally add the rules to your rules :
'typescript-space-curly/interface-curly-inner-spacing': 'error',
'typescript-space-curly/literal-object-type-curly-inner-spacing': 'error'
Uses
interface MyInterface = {property: string} will give 2 errors:
'A space is required after '{'. and 'A space is required before '}'.
Applying the fix will turn the code into interface MyInterface = { property: string }
The same applies to let fooObject: {property: string} , since it is a literal object type.