Skip to content

Commit d8d5289

Browse files
authored
fix(eslint-plugin): Activate no floating promises rule (#87)
* fix: Add project to parserOptions * feat: Add test for no-floating-promises rule in example-app
1 parent 2b4c10c commit d8d5289

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

example-app/eslint-breaking-examples/break-eslint-recommended-rules.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ console.log(
1111
// no-empty
1212
if (true) {
1313
}
14+
15+
// This should trigger an error breaking no-floating-promises rule
16+
const promise = new Promise((resolve) => resolve("value"));
17+
promise;

packages/eslint-plugin/lib/configs/recommended.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module.exports = defineConfig({
4444
"@typescript-eslint/no-unused-vars": "off",
4545
"unused-imports/no-unused-imports": "error",
4646
"unused-imports/no-unused-vars": "error",
47-
// "@typescript-eslint/no-floating-promises": "error", //TODO: A réactiver après le fix de @thomasrebam https://www.notion.so/m33/ETQU-sur-le-plugin-eslint-la-r-gle-no-floating-promises-fonctionne-949b4beca2b34704a87c41faa982f540
47+
"@typescript-eslint/no-floating-promises": "error",
4848
},
4949
env: {
5050
node: true,
@@ -57,6 +57,8 @@ module.exports = defineConfig({
5757
ecmaFeatures: {
5858
jsx: true,
5959
},
60+
// Introduced to define the parserOptions.project property for @typescript-eslint/no-floating-promises
61+
project: ["tsconfig.json"],
6062
},
6163
settings: {
6264
react: {

0 commit comments

Comments
 (0)