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:
demonicattack 2024-11-19 22:01:43 +04:00 committed by GitHub
parent e4ce2b1140
commit 25909b0d9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -27,7 +27,6 @@ export default tseslint.config(
files: ['**/*.js', '**/*.jsx'],
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
},
...(isPrettierAvailable ? [require('eslint-config-prettier')] : []),
{
languageOptions: {
parser: tseslint.parser,
@ -80,5 +79,9 @@ export default tseslint.config(
*/
'@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')] : [])
);

View File

@ -18,7 +18,6 @@ export default tseslint.config(
files: ['**/*.ts', '**/*.tsx'],
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
},
...(isPrettierAvailable ? [require('eslint-config-prettier')] : []),
{
plugins: { '@typescript-eslint': tseslint.plugin },
languageOptions: {
@ -64,5 +63,9 @@ export default tseslint.config(
*/
'@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')] : [])
);