Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conflict with prettier? #133

Closed
remy90 opened this issue May 11, 2023 · 5 comments
Closed

conflict with prettier? #133

remy90 opened this issue May 11, 2023 · 5 comments

Comments

@remy90
Copy link

remy90 commented May 11, 2023

I have the following import statements:

import { useField, useFormFields } from 'payload/components/forms'
import React, { ChangeEvent, useEffect, useState } from 'react'

import options, {
  logicOptions,
  answerOptions,
} from './helpers'

import './index.scss'

In vscode, I have lint on save enable, with a default formatter set to prettier. When doing so, I can see simple-import-sort/imports reordering to put 'react' on the top line. The conflict means 'react' and (node_modules) 'payload/components/forms' switch back.

@lydell
Copy link
Owner

lydell commented May 11, 2023

Hi!

Prettier does not sort imports (unless you install a plugin to it that sorts imports).

You need to provide steps to reproduce that do not involve using VSCode for me to be able to do anything.

@remy90
Copy link
Author

remy90 commented May 11, 2023

Not something I can do at this point, when I can isolate a repro, i'll reopen. Thanks

@remy90 remy90 closed this as completed May 11, 2023
@dileep8014
Copy link

Installed https://github.com/trivago/prettier-plugin-sort-imports and enabled import sorting on save, enabled lint sorting as well. Now VS Code throws an error Run autofix to sort these imports!eslint[simple-import-sort/imports](https://github.com/lydell/eslint-plugin-simple-import-sort#sort-order)

@dileep8014
Copy link

@lydell ^^

@lydell
Copy link
Owner

lydell commented May 16, 2023

@dileep8014 Use one of the Prettier plugin and this ESLint plugin, not both. Otherwise you get conflicts (and waste time checking the same things twice).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants