Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eslint-community/eslint-plugin-n
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 241988828e30c2a32cc58982548dfce1cc56b87f
Choose a base ref
...
head repository: eslint-community/eslint-plugin-n
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9ddd351e27f265e69c7d70bdfe3f87729c07a54c
Choose a head ref
  • 5 commits
  • 35 files changed
  • 1 contributor

Commits on Jan 2, 2024

  1. Release 16.6.1

    aladdin-add committed Jan 2, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    aladdin-add 唯然
    Copy the full SHA
    bc6c538 View commit details

Commits on Jan 3, 2024

  1. chore: move rule tests parserOptions to ruleTester (#157)

    it can help migrating to the eslint v9 RuleTester
    aladdin-add authored Jan 3, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ad8f4f4 View commit details

Commits on Jan 4, 2024

  1. chore: add non-rule-change issue template (#159)

    There is already an issue template for rule-related changes,
    but some changes do not apply to it. Therefore, this pull request adds a new one.
    aladdin-add authored Jan 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c191101 View commit details

Commits on Jan 9, 2024

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    aladdin-add 唯然
    Copy the full SHA
    5fc2198 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    aladdin-add 唯然
    Copy the full SHA
    9ddd351 View commit details
Showing with 408 additions and 712 deletions.
  1. +47 −0 .github/ISSUE_TEMPLATE/non-rule-change.yml
  2. +3 −3 lib/rules/no-callback-literal.js
  3. +3 −3 package.json
  4. +2 −12 tests/lib/rules/callback-return.js
  5. +17 −60 tests/lib/rules/exports-style.js
  6. +0 −4 tests/lib/rules/file-extension-in-import.js
  7. +1 −3 tests/lib/rules/global-require.js
  8. +16 −8 tests/lib/rules/handle-callback-err.js
  9. +6 −1 tests/lib/rules/no-callback-literal.js
  10. +1 −114 tests/lib/rules/no-deprecated-api.js
  11. +2 −4 tests/lib/rules/no-extraneous-import.js
  12. +2 −5 tests/lib/rules/no-hide-core-modules.js
  13. +4 −21 tests/lib/rules/no-missing-import.js
  14. +2 −67 tests/lib/rules/no-missing-require.js
  15. +2 −1 tests/lib/rules/no-mixed-requires.js
  16. +1 −1 tests/lib/rules/no-new-require.js
  17. +3 −7 tests/lib/rules/no-path-concat.js
  18. +1 −1 tests/lib/rules/no-process-env.js
  19. +2 −1 tests/lib/rules/no-process-exit.js
  20. +2 −4 tests/lib/rules/no-restricted-import.js
  21. +1 −1 tests/lib/rules/no-sync.js
  22. +274 −260 tests/lib/rules/no-unpublished-bin.js
  23. +1 −54 tests/lib/rules/no-unpublished-require.js
  24. +1 −1 tests/lib/rules/no-unsupported-features.js
  25. +2 −12 tests/lib/rules/no-unsupported-features/node-builtins.js
  26. +1 −7 tests/lib/rules/prefer-global/buffer.js
  27. +1 −7 tests/lib/rules/prefer-global/console.js
  28. +1 −7 tests/lib/rules/prefer-global/process.js
  29. +1 −7 tests/lib/rules/prefer-global/text-decoder.js
  30. +1 −7 tests/lib/rules/prefer-global/text-encoder.js
  31. +1 −7 tests/lib/rules/prefer-global/url-search-params.js
  32. +1 −7 tests/lib/rules/prefer-global/url.js
  33. +2 −7 tests/lib/rules/prefer-promises/dns.js
  34. +2 −7 tests/lib/rules/prefer-promises/fs.js
  35. +1 −1 tests/lib/rules/shebang.js
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/non-rule-change.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "\U0001F680 Request a change (not rule-related)"
description: "Request a change that is not a bug fix, rule change, or new rule"
title: "Change Request: (fill in)"
labels:
- enhancement
- core
body:
- type: markdown
attributes:
value: By opening an issue, you agree to abide by the [Open JS Foundation Code of Conduct](https://eslint.org/conduct).
- type: input
attributes:
label: eslint-plugin-n version
description: |
What version of eslint-plugin-n are you currently using?
placeholder: |
e.g. v16.0.0
validations:
required: true
- type: textarea
attributes:
label: What problem do you want to solve?
description: |
Please explain your use case in as much detail as possible.
placeholder: |
ESLint currently...
validations:
required: true
- type: textarea
attributes:
label: What do you think is the correct solution?
description: |
Please explain how you'd like to change to address the problem.
placeholder: |
I'd like to...
validations:
required: true
- type: checkboxes
attributes:
label: Participation
options:
- label: I am willing to submit a pull request for this change.
required: false
- type: textarea
attributes:
label: Additional comments
description: Is there anything else that's important for the team to know?
6 changes: 3 additions & 3 deletions lib/rules/no-callback-literal.js
Original file line number Diff line number Diff line change
@@ -62,7 +62,8 @@ function couldBeError(node) {
case "TaggedTemplateExpression":
case "YieldExpression":
return true // possibly an error object.

case "Literal":
return node.value == null
case "AssignmentExpression":
return couldBeError(node.right)

@@ -76,8 +77,7 @@ function couldBeError(node) {

case "ConditionalExpression":
return couldBeError(node.consequent) || couldBeError(node.alternate)

default:
return node.value === null
return true // assuming unknown nodes can be error objects.
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-n",
"version": "16.6.0",
"version": "16.6.1",
"description": "Additional ESLint's rules for Node.js",
"engines": {
"node": ">=16.0.0"
@@ -31,10 +31,10 @@
"@types/eslint": "^8.44.6",
"@typescript-eslint/parser": "^5.60.0",
"esbuild": "^0.18.7",
"eslint": "^8.53.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.8.0",
"eslint-doc-generator": "^1.6.1",
"eslint-plugin-eslint-plugin": "^5.1.0",
"eslint-plugin-eslint-plugin": "^5.2.1",
"eslint-plugin-n": "file:.",
"fast-glob": "^3.2.12",
"husky": "^8.0.3",
14 changes: 2 additions & 12 deletions tests/lib/rules/callback-return.js
Original file line number Diff line number Diff line change
@@ -6,8 +6,9 @@

const RuleTester = require("eslint").RuleTester
const rule = require("../../../lib/rules/callback-return")
const ruleTester = new RuleTester({ env: { node: true, es6: true } })

new RuleTester().run("callback-return", rule, {
ruleTester.run("callback-return", rule, {
valid: [
// callbacks inside of functions should return
"function a(err) { if (err) return callback (err); }",
@@ -40,25 +41,20 @@ new RuleTester().run("callback-return", rule, {
// arrow functions
{
code: "var x = err => { if (err) { callback(); return; } }",
parserOptions: { ecmaVersion: 6 },
},
{
code: "var x = err => callback(err)",
parserOptions: { ecmaVersion: 6 },
},
{
code: "var x = err => { setTimeout( () => { callback(); }); }",
parserOptions: { ecmaVersion: 6 },
},

// classes
{
code: "class x { horse() { callback(); } } ",
parserOptions: { ecmaVersion: 6 },
},
{
code: "class x { horse() { if (err) { return callback(); } callback(); } } ",
parserOptions: { ecmaVersion: 6 },
},

// options (only warns with the correct callback name)
@@ -188,7 +184,6 @@ new RuleTester().run("callback-return", rule, {
},
{
code: "var x = (err) => { if (err) { callback (err); } }",
parserOptions: { ecmaVersion: 6 },
errors: [
{
messageId: "missingReturn",
@@ -200,7 +195,6 @@ new RuleTester().run("callback-return", rule, {
},
{
code: "var x = { x(err) { if (err) { callback (err); } } }",
parserOptions: { ecmaVersion: 6 },
errors: [
{
messageId: "missingReturn",
@@ -223,7 +217,6 @@ new RuleTester().run("callback-return", rule, {
},
{
code: "var x = { x(err) { if (err) { callback && callback (err); } } }",
parserOptions: { ecmaVersion: 6 },
errors: [
{
messageId: "missingReturn",
@@ -268,7 +261,6 @@ new RuleTester().run("callback-return", rule, {
},
{
code: "var a = (err) => { callback (err); callback(); }",
parserOptions: { ecmaVersion: 6 },
errors: [
{
messageId: "missingReturn",
@@ -302,7 +294,6 @@ new RuleTester().run("callback-return", rule, {
},
{
code: "class x { horse() { if (err) { callback(); } callback(); } } ",
parserOptions: { ecmaVersion: 6 },
errors: [
{
messageId: "missingReturn",
@@ -344,7 +335,6 @@ new RuleTester().run("callback-return", rule, {
},
{
code: "() => { if (x) { callback(); } }",
parserOptions: { ecmaVersion: 6 },
errors: [
{
messageId: "missingReturn",
Loading