π Prefer identifiers over string literals in import and export specifiers.
πΌ This rule is enabled in the following configs: β
recommended, βοΈ unopinionated.
π§ This rule is automatically fixable by the --fix CLI option.
Prefer identifier syntax over string-literal syntax in import and export specifiers and import attribute keys when the string is a valid identifier name.
This rule does not require all specifiers to use the same style. Use string literals when the imported or exported name cannot be written as an identifier.
// β
import {'foo' as foo} from 'foo';
// β
import {foo as foo} from 'foo';// β
export {foo as 'bar'};
// β
export {foo as bar};// β
export {'foo' as bar} from 'foo';
// β
export {foo as bar} from 'foo';// β
import foo from 'foo' with {'type': 'json'};
// β
import foo from 'foo' with {type: 'json'};// β
import {'a string' as aString} from 'foo';