@1adybug/prettier-plugin-sort-imports 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -163,6 +163,8 @@ function formatImportStatements(statements) {
|
|
|
163
163
|
return statements.map(formatImportStatement).join("\n");
|
|
164
164
|
}
|
|
165
165
|
function parseImports(code) {
|
|
166
|
+
const hasImportOrExport = /^\s*(import|export)\s/m.test(code);
|
|
167
|
+
if (!hasImportOrExport) return [];
|
|
166
168
|
const ast = parse(code, {
|
|
167
169
|
sourceType: "module",
|
|
168
170
|
plugins: [
|