Skip to content

Commit 2bc9ab5

Browse files
demonicattackleosvelperez
authored andcommitted
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 <[email protected]> (cherry picked from commit 25909b0)
1 parent dd88acc commit 2bc9ab5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/eslint-plugin/src/flat-configs/javascript.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export default tseslint.config(
2727
files: ['**/*.js', '**/*.jsx'],
2828
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
2929
},
30-
...(isPrettierAvailable ? [require('eslint-config-prettier')] : []),
3130
{
3231
languageOptions: {
3332
parser: tseslint.parser,
@@ -80,5 +79,9 @@ export default tseslint.config(
8079
*/
8180
'@typescript-eslint/no-require-imports': 'off',
8281
},
83-
}
82+
},
83+
/**
84+
* We include it last so it overrides the conflicting rules from the configuration blocks above.
85+
*/
86+
...(isPrettierAvailable ? [require('eslint-config-prettier')] : [])
8487
);

packages/eslint-plugin/src/flat-configs/typescript.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export default tseslint.config(
1818
files: ['**/*.ts', '**/*.tsx'],
1919
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
2020
},
21-
...(isPrettierAvailable ? [require('eslint-config-prettier')] : []),
2221
{
2322
plugins: { '@typescript-eslint': tseslint.plugin },
2423
languageOptions: {
@@ -64,5 +63,9 @@ export default tseslint.config(
6463
*/
6564
'@typescript-eslint/no-require-imports': 'off',
6665
},
67-
}
66+
},
67+
/**
68+
* We include it last so it overrides the conflicting rules from the configuration blocks above.
69+
*/
70+
...(isPrettierAvailable ? [require('eslint-config-prettier')] : [])
6871
);

0 commit comments

Comments
 (0)