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

How do I keep only the indent rules of prettier or set them to the same effect of prettier using style/indent #387

Open
3 tasks done
laterdayi opened this issue Jan 5, 2024 · 10 comments
Labels
enhancement New feature or request

Comments

@laterdayi
Copy link

Clear and concise description of the problem

How do I keep only the indent rules of prettier or set them to the same effect of prettier using style/indent

Suggested solution

How do I keep only the indent rules of prettier or set them to the same effect of prettier using style/indent

Alternative

How do I keep only the indent rules of prettier or set them to the same effect of prettier using style/indent

Additional context

How do I keep only the indent rules of prettier or set them to the same effect of prettier using style/indent

Validations

@laterdayi laterdayi added the enhancement New feature or request label Jan 5, 2024
@laterdayi
Copy link
Author

    onUpdateValue: (value: (string | number | null)[]) => {
        if (formData.value) formData.value.eqpIds = [];
        value?.length
          ? executeGetEquipmentNumberChildList(__, {
              params: { LayoutId: value, check: '1' }
            })
          : handleQueryEquipmentNumberList();
      }
    onUpdateValue: (value: (string | number | null)[]) => {
        if (formData.value) formData.value.eqpIds = [];
        value?.length
          ? executeGetEquipmentNumberChildList(__, {
            params: { LayoutId: value, check: '1' }
          })
          : handleQueryEquipmentNumberList();
      }

I wanted to keep the top style, but now it's the bottom style

@thenbe
Copy link
Contributor

thenbe commented Jan 5, 2024

For best results, you should use either prettier or eslint stylistic rules (style/*), not both.

For even better results, don't use prettier at all and configure your indent rules like this.

@thenbe
Copy link
Contributor

thenbe commented Jan 5, 2024

this whole linting and styling business with all it's plethora of config/plugin packages, is at times more complicated than programming itself.

This is exactly why I'm using this project (antfu/eslint-config) :)


All those things you mentioned, you can just get rid of them:

rm -f .prettierrc .prettierignore
npm rm eslint-config-prettier eslint-plugin-prettier prettier
# npm rm prettier-plugin-whatever

For vscode, just turn off anything prettier and only leave eslint. I don't use vscode so I'm not sure how exactly, but you can probably take inspiration from here (search for prettier, eslint in that file for the relevant settings).

@laterdayi
Copy link
Author

@thenbe But using style/* does not indent the first effect
image

@Dimava
Copy link
Contributor

Dimava commented Jan 5, 2024

@laterdayi
Copy link
Author

@Dimava Still can't achieve this effect, can you help me

@laterdayi
Copy link
Author

value?.length
          ? executeGetEquipmentNumberChildList(__, {
            params: { LayoutId: value, check: '1' }
          })
          : handleQueryEquipmentNumberList();

'style/indent': ['error', 2, { 'flatTernaryExpressions': false, offsetTernaryExpressions: true }],

@laterdayi
Copy link
Author

        value?.length
          ? executeGetEquipmentNumberChildList(__, {
              params: { LayoutId: value, check: '1' }
            })
          : **handleQueryEquipmentNumberList();

image
I expected that, but it prompted an error

@Dimava
Copy link
Contributor

Dimava commented Jan 5, 2024

@laterdayi it should autofix the error on save
Is there a rule conflict? I.e. does it reformat back to the code you don't want? Check what rule is that, you may need to disable it, or you may be using the wrong indent rule (you may need style/ts/indent or whatever)

@laterdayi
Copy link
Author

It fixes itself, but it fixes the wrong thing
It can't be fixed like this

value?.length
          ? executeGetEquipmentNumberChildList(__, {
              params: { LayoutId: value, check: '1' }
            })
          : **handleQueryEquipmentNumberList();

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

No branches or pull requests

3 participants