IanVS / prettier-plugin-sort-imports

An opinionated but flexible prettier plugin to sort import statements
Apache License 2.0
951 stars 21 forks source link

Doesn't work on .prettierrc.yml format #113

Closed hrqmonteiro closed 1 year ago

hrqmonteiro commented 1 year ago

Your Environment

Describe the bug

Doesn't work when using the yaml format for the prettier config? .prettierrc.yml

To Reproduce

Just trying to run prettier and the plugin doesn't recognize any option

Expected behavior

To run fine

Screenshots, code sample, etc

image

image

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

bracketSpacing: true
importOrder:
  - '^(react/(.*)$)|^(react$)'
  - '^(next/(.*)$)|^(next$)'
  - '<THIRD_PARTY_MODULES>'
  - ''
  - '^types$'
  - '^@/env(.*)$'
  - '^@/types/(.*)$'
  - '^@/config/(.*)$'
  - '^@/lib/(.*)$'
  - '^@/hooks/(.*)$'
  - '^@/components/ui/(.*)$'
  - '^@/components/(.*)$'
  - '^@/styles/(.*)$'
  - '^@/app/(.*)$'
  - ''
  - '^[./]'
jsxSingleQuote: true
semi: false
singleQuote: true
tabWidth: 2
trailingComma: none
useTabs: false

Error log

> prettier --write .

[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
.eslintrc.yml 32ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
.prettierrc.yml 5ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
app/layout.tsx 161ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
app/page.tsx 3ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
commitlint.config.ts 3ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
components/atoms/container.tsx 3ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
components/atoms/index.ts 2ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
components/atoms/logo.tsx 3ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
components/molecules/index.ts 2ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
components/molecules/navbar.tsx 5ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
next.config.js 31ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
package.json 5ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
postcss.config.js 3ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
README.md 36ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
styles/globals.css 27ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
tailwind.config.ts 5ms
[warn] Ignored unknown option { importOrder: ["^(react/(.*)$)|^(react$)", "^(next/(.*)$)|^(next$)", "<THIRD_PARTY_MODULES>", "", "^types$", "^@/env(.*)$", "^@/types/(.*)$", "^@/config/(.*)$", "^@/lib/(.*)$", "^@/hooks/(.*)$", "^@/components/ui/(.*)$", "^@/components/(.*)$", "^@/styles/(.*)$", "^@/app/(.*)$", "", "^[./]"] }.
tsconfig.json 5ms
jasikpark commented 1 year ago

In prettier 3.0, prettier no longer auto-searches for plugins, so you must directly mention them

https://prettier.io/docs/en/plugins.html#using-plugins

add

"plugins": ["@ianvs/prettier-plugin-sort-imports"],

to your config

IanVS commented 1 year ago

Yep, exactly. We should probably make a note of it in the readme.