eslint-config
eslint-config copied to clipboard
How do I keep only the indent rules of prettier or set them to the same effect of prettier using style/indent
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
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
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
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.
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).
@thenbe But using style/* does not indent the first effect
@laterdayi try https://eslint.style/rules/js/indent#flatternaryexpressions and https://eslint.style/rules/js/indent#offsetternaryexpressions One of them should do this
@Dimava Still can't achieve this effect, can you help me
value?.length
? executeGetEquipmentNumberChildList(__, {
params: { LayoutId: value, check: '1' }
})
: handleQueryEquipmentNumberList();
'style/indent': ['error', 2, { 'flatTernaryExpressions': false, offsetTernaryExpressions: true }],
value?.length
? executeGetEquipmentNumberChildList(__, {
params: { LayoutId: value, check: '1' }
})
: **handleQueryEquipmentNumberList();
I expected that, but it prompted an error
@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)
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();