Search code examples
importeslintspace

Rule to set spacing on import statements with eslint?


In my code I have things like this:

import  Something from './Something';

And I would like to normalize it to this:

import Something from './Something';

However, my keyword-spacing rule, although it applies to everything else, doesn't seem to apply to import statements:

'keyword-spacing': ['error', { 'before': true, 'after': true }],

Do I need to use a different rule for this and, if so, which one?


Solution

  • I use ESLint rule no-multi-spaces for the spacing.

    "no-multi-spaces": ["error"]