-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
recommended.js is a flat config version of the recommended config. This diverges from the legacy config version of the recommended config as it does not automatically configure eslint-config-prettier. Configs extending other configs is complicated and not transparent. We should trust the user to configure their configs directly. In a future major change we should remove eslint-config-prettier from the legacy config too.
- Loading branch information
Showing
6 changed files
with
73 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
'eslint-plugin-prettier': minor | ||
--- | ||
|
||
Add recommended config for the flat config format. | ||
|
||
If you are using flat config, import the recommended config from `eslint-plugin-prettier/recommended`. Note that in contrast to the legacy recommended config, the flat recommended config does not add `eslint-config-prettier` automatically, consumers will need to explictly add that themselves. | ||
|
||
```js | ||
// eslint.config.js | ||
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended'); | ||
const eslintConfigPrettier = require('eslint-config-prettier'); | ||
|
||
module.exports = [ | ||
// Any other config imports go at the top | ||
eslintPluginPrettierRecommended, | ||
eslintConfigPrettier, | ||
]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Linter } from 'eslint'; | ||
|
||
declare const recommendedConfig: Linter.FlatConfig; | ||
|
||
export = recommendedConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const eslintPluginPrettier = require('./eslint-plugin-prettier'); | ||
|
||
// This diverges from the legacy format recommended config, as it does not | ||
// extend from the `eslint-config-prettier` ruleset. When using the flat config | ||
// the consumer should add eslint-config-prettier to their own root config. | ||
module.exports = { | ||
plugins: { | ||
prettier: eslintPluginPrettier, | ||
}, | ||
rules: { | ||
'prettier/prettier': 'error', | ||
'arrow-body-style': 'off', | ||
'prefer-arrow-callback': 'off', | ||
}, | ||
}; |