New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(import-destructuring-spacing): add fixer #595
feat(import-destructuring-spacing): add fixer #595
Conversation
|
||
it('should succeed when there is more than one space left and right', () => { | ||
const source = ` | ||
import { Foo, Bar, FooBar } from './foo'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not we throw an error in this case ?
Well, that’s how the rule works actually. It just enforces that you must leave whitespaces inside of the import statements curly braces, but not the quantity. |
@rafaelss95 yes, it should be a single space. |
Done. Not related to this PR, but don't you think it's a good idea to add coveralls to this repo? It seems to be a really great tool to ensure that we cover more specifics parts of a rule, for example. Also, it can be integrated with CI. |
@rafaelss95 this sounds good to me! @wKoza what are your thoughts? |
typescriptOnly: true | ||
}; | ||
|
||
public static FAILURE_STRING = "You need to leave whitespaces inside of the import statement's curly braces"; | ||
static readonly FAILURE_STRING = "Import statements' curly braces must be spaced exactly by a space to the right and a space to the left"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to change the failure message to reflect the new behavior. What do you guys think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
statements' => statement's ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Just last one comment and It's ok for me. |
Just out of curiosity since I didn't see a test for it, what would happen with these (multiple spaces in middle):
|
@intellix Currently, the rule only cares about spaces relative to curly braces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ! thanks @rafaelss95 !
This adds a fixer for
import-destructuring-spacing
rule and adds a bunch of new tests.