prettier-plugin-sort-imports icon indicating copy to clipboard operation
prettier-plugin-sort-imports copied to clipboard

Use strict breaks import order

Open BleedingDev opened this issue 3 years ago • 1 comments

Your Environment

  • Prettier version: 2.6.2
  • node version: 16.14.0
  • package manager: 8.3.1
  • IDE: CLI

Describe the bug

'use strict' is pushed below imports.

To Reproduce

  1. Try to format this code:
'use strict'

import type { Period } from './Period'
  1. Bug appears.
import type { Period } from './Period'

;('use strict')

Expected behavior

Keep 'use strict' above.

Screenshots, code sample, etc

Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)

{
  "semi": false,
  "trailingComma": "none",
  "singleQuote": true,
  "printWidth": 640,
  "importOrder": ["@riot/metaplayer", "^[./]"],
  "importOrderSeparation": true
}

Error log

Contribute to @trivago/prettier-plugin-sort-imports

  • [ ] I'm willing to fix this bug 🥇

BleedingDev avatar Apr 11 '22 16:04 BleedingDev

FWIW, this is fixed in a fork: https://github.com/IanVS/prettier-plugin-sort-imports/releases/tag/v3.3.1.

IanVS avatar Apr 27 '22 14:04 IanVS

Can you give a try to v4.1.1 ?

Please feel free to reopen if the issue is still valid.

ayusharma avatar Feb 24 '23 20:02 ayusharma