Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

☂️ eslint-plugin-promise #4655

Open
Boshen opened this issue Aug 5, 2024 · 0 comments
Open

☂️ eslint-plugin-promise #4655

Boshen opened this issue Aug 5, 2024 · 0 comments
Labels
A-linter Area - Linter C-enhancement Category - New feature or request

Comments

@Boshen
Copy link
Member

Boshen commented Aug 5, 2024

Warning

This comment is maintained by CI. Do not edit this comment directly.
To update comment template, see https://github.com/oxc-project/oxc/tree/main/tasks/lint_rules

This is tracking issue for eslint-plugin-promise.

There are 17(+ 0 deprecated) rules.

  • 4/12 recommended rules are remaining as TODO
  • 2/5 not recommended rules are remaining as TODO

To get started, run the following command:

just new-promise-rule <RULE_NAME>

Then register the rule in crates/oxc_linter/src/rules.rs and also declare_all_lint_rules at the bottom.

Recommended rules

✨: 8, 🚫: 0 / total: 12
Status Name Docs
promise/param-names https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/param-names.md
promise/no-return-wrap https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-return-wrap.md
promise/always-return https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/always-return.md
promise/catch-or-return https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/catch-or-return.md
promise/no-native https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-native.md
promise/no-callback-in-promise https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-callback-in-promise.md
promise/no-promise-in-callback https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-promise-in-callback.md
promise/no-nesting https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-nesting.md
promise/avoid-new https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/avoid-new.md
promise/no-new-statics https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-new-statics.md
promise/no-return-in-finally https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-return-in-finally.md
promise/valid-params https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/valid-params.md

✨ = Implemented, 🚫 = No need to implement

Not recommended rules

✨: 3, 🚫: 0 / total: 5
Status Name Docs
promise/prefer-await-to-callbacks https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-callbacks.md
promise/prefer-await-to-then https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-await-to-then.md
promise/prefer-catch https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/prefer-catch.md
promise/no-multiple-resolved https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/no-multiple-resolved.md
promise/spec-only https://github.com/eslint-community/eslint-plugin-promise/blob/main/docs/rules/spec-only.md

✨ = Implemented, 🚫 = No need to implement

@Boshen Boshen added the C-enhancement Category - New feature or request label Aug 5, 2024
@DonIsaac DonIsaac added the A-linter Area - Linter label Aug 5, 2024
Boshen pushed a commit that referenced this issue Nov 14, 2024
…ise/no-return-wrap` (#7232)

part of #4655

### Summary

Logic has been added to handle bind functions, unifying the
implementations of `unicorn/no-useless-promise-resolve-reject` and
`promise/no-return-wrap`.
This enables detection of the following code:

```javascript
foo().then((function() { return Promise.resolve(4) }).bind(this))
```

Merging this PR will allow this rule to pass all test cases of
promise/no-return-wrap without options. Additionally, merging #7274 will
ensure that all test cases are passed.
Dunqing pushed a commit that referenced this issue Nov 17, 2024
…ise/no-return-wrap` (#7232)

part of #4655

### Summary

Logic has been added to handle bind functions, unifying the
implementations of `unicorn/no-useless-promise-resolve-reject` and
`promise/no-return-wrap`.
This enables detection of the following code:

```javascript
foo().then((function() { return Promise.resolve(4) }).bind(this))
```

Merging this PR will allow this rule to pass all test cases of
promise/no-return-wrap without options. Additionally, merging #7274 will
ensure that all test cases are passed.
Dunqing pushed a commit that referenced this issue Nov 18, 2024
…ise/no-return-wrap` (#7232)

part of #4655

### Summary

Logic has been added to handle bind functions, unifying the
implementations of `unicorn/no-useless-promise-resolve-reject` and
`promise/no-return-wrap`.
This enables detection of the following code:

```javascript
foo().then((function() { return Promise.resolve(4) }).bind(this))
```

Merging this PR will allow this rule to pass all test cases of
promise/no-return-wrap without options. Additionally, merging #7274 will
ensure that all test cases are passed.
Dunqing pushed a commit that referenced this issue Nov 18, 2024
…ise/no-return-wrap` (#7232)

part of #4655

### Summary

Logic has been added to handle bind functions, unifying the
implementations of `unicorn/no-useless-promise-resolve-reject` and
`promise/no-return-wrap`.
This enables detection of the following code:

```javascript
foo().then((function() { return Promise.resolve(4) }).bind(this))
```

Merging this PR will allow this rule to pass all test cases of
promise/no-return-wrap without options. Additionally, merging #7274 will
ensure that all test cases are passed.
Boshen pushed a commit that referenced this issue Nov 22, 2024
related: #4655

This PR implements a rule to detect Promises inside error-first
callbacks, preventing the mixed usage of callbacks and Promises.

Example of problematic code:
```javascript
a(function(err) { doThing().then(a) });
                  ^^^^^^^^^^^^^^
```


[Original
implementation](https://github.com/eslint-community/eslint-plugin-promise/blob/266ddbb03076c05c362a6daecb9382b80cdd7108/rules/no-promise-in-callback.js)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter C-enhancement Category - New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants