Skip to content

Commit 88f3748

Browse files
committedJun 21, 2023
fix: added info_on_disabling_prettier_conflict_rule to disable the info about found prettier
Signed-off-by: prisis <d.bannert@anolilab.de>
1 parent 7b6a225 commit 88f3748

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
 

‎packages/eslint-config/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,24 @@ To disable the info, set the value to `false`.
241241
}
242242
```
243243

244+
#### info_on_disabling_prettier_conflict_rule
245+
246+
Type: `boolean`
247+
248+
Default: `undefined`
249+
250+
To disable the info, set the value to `false`.
251+
252+
```json
253+
{
254+
"anolilab": {
255+
"eslint-config": {
256+
"info_on_disabling_prettier_conflict_rule": false
257+
}
258+
}
259+
}
260+
```
261+
244262
### Let [Prettier](https://prettier.io/) handle style-related rules
245263

246264
Prettier is a code formatting tool that offers fewer options but is more professional than the style-related rules in ESLint.

‎packages/eslint-config/src/index.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ if (pkg?.engines?.["node"]) {
7777
nodeVersion = pkg.engines["node"];
7878
}
7979

80+
let anolilabEslintConfig: { [key: string]: boolean | undefined } = {};
81+
82+
if (pkg) {
83+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
84+
anolilabEslintConfig = pkg?.["anolilab"]?.["eslint-config"];
85+
}
86+
8087
Object.entries(engineRules).forEach(([rule, ruleConfig]) => {
8188
Object.keys(ruleConfig)
8289
.sort(semver.rcompare)
@@ -96,7 +103,9 @@ if (
96103
if (!global.hasAnolilabEsLintConfigPrettier) {
97104
global.hasAnolilabEsLintConfigPrettier = true;
98105

99-
consoleLog("\nFound prettier as dependency, disabling some rules to fix wrong behavior of the rule with eslint and prettier");
106+
if (anolilabEslintConfig?.["info_on_disabling_prettier_conflict_rule"] !== false) {
107+
consoleLog("\nFound prettier as dependency, disabling some rules to fix wrong behavior of the rule with eslint and prettier");
108+
}
100109
}
101110

102111
configRules = {

0 commit comments

Comments
 (0)
Please sign in to comment.