fix(linter): move eslint-config-prettier to the end for proper override (#28503)
There is a conflict between ESLint and Prettier rules, which causes incorrect formatting behavior. Reordering the config so that `eslint-config-prettier` is applied last ensures proper rule overrides and resolves conflicts with Prettier. --------- Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
This commit is contained in:
parent
e4ce2b1140
commit
25909b0d9e
@ -27,7 +27,6 @@ export default tseslint.config(
|
|||||||
files: ['**/*.js', '**/*.jsx'],
|
files: ['**/*.js', '**/*.jsx'],
|
||||||
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
|
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
|
||||||
},
|
},
|
||||||
...(isPrettierAvailable ? [require('eslint-config-prettier')] : []),
|
|
||||||
{
|
{
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parser: tseslint.parser,
|
parser: tseslint.parser,
|
||||||
@ -80,5 +79,9 @@ export default tseslint.config(
|
|||||||
*/
|
*/
|
||||||
'@typescript-eslint/no-require-imports': 'off',
|
'@typescript-eslint/no-require-imports': 'off',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
/**
|
||||||
|
* We include it last so it overrides the conflicting rules from the configuration blocks above.
|
||||||
|
*/
|
||||||
|
...(isPrettierAvailable ? [require('eslint-config-prettier')] : [])
|
||||||
);
|
);
|
||||||
|
|||||||
@ -18,7 +18,6 @@ export default tseslint.config(
|
|||||||
files: ['**/*.ts', '**/*.tsx'],
|
files: ['**/*.ts', '**/*.tsx'],
|
||||||
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
|
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
|
||||||
},
|
},
|
||||||
...(isPrettierAvailable ? [require('eslint-config-prettier')] : []),
|
|
||||||
{
|
{
|
||||||
plugins: { '@typescript-eslint': tseslint.plugin },
|
plugins: { '@typescript-eslint': tseslint.plugin },
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
@ -64,5 +63,9 @@ export default tseslint.config(
|
|||||||
*/
|
*/
|
||||||
'@typescript-eslint/no-require-imports': 'off',
|
'@typescript-eslint/no-require-imports': 'off',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
/**
|
||||||
|
* We include it last so it overrides the conflicting rules from the configuration blocks above.
|
||||||
|
*/
|
||||||
|
...(isPrettierAvailable ? [require('eslint-config-prettier')] : [])
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user