lydell / eslint-plugin-simple-import-sort

Easy autofixable import sorting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conflict with prettier?

remy90 opened this issue · comments

commented

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.

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.

commented

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

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 Use one of the Prettier plugin and this ESLint plugin, not both. Otherwise you get conflicts (and waste time checking the same things twice).