dd-trace-js icon indicating copy to clipboard operation
dd-trace-js copied to clipboard

Enable recommended rules for eslint-plugin-n

Open watson opened this issue 11 months ago • 8 comments

What does this PR do?

Enables all recommended rules from the eslint-plugin-n ESLint plugin that could reasonably be enabled without too much work. The following rules have for now been disabled as they caused too many errors when enabled:

  • n/hashbang
  • n/no-process-exit
  • n/no-missing-require (only disabled in tests)

For now all eslint-plugin-n rules have also been disabled for **/*.mjs files as these for some reason resulting in parsing errors.

Motivation

Plugin Checklist

Additional Notes

watson avatar Feb 06 '25 10:02 watson

This stack of pull requests is managed by Graphite. Learn more about stacking.

watson avatar Feb 06 '25 10:02 watson

Overall package size

Self size: 9.61 MB Deduped: 107.67 MB No deduping: 108.19 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | @datadog/libdatadog | 0.7.0 | 35.02 MB | 35.02 MB | | @datadog/native-appsec | 9.0.0 | 19.6 MB | 19.61 MB | | @datadog/native-iast-taint-tracking | 4.0.0 | 11.72 MB | 11.73 MB | | @datadog/pprof | 5.9.0 | 9.77 MB | 10.14 MB | | @opentelemetry/core | 1.30.1 | 908.66 kB | 7.16 MB | | protobufjs | 7.5.3 | 2.95 MB | 5.6 MB | | @datadog/wasm-js-rewriter | 4.0.1 | 2.85 MB | 3.58 MB | | @datadog/native-metrics | 3.1.1 | 1.02 MB | 1.43 MB | | @opentelemetry/api | 1.8.0 | 1.21 MB | 1.21 MB | | jsonpath-plus | 10.3.0 | 617.18 kB | 1.08 MB | | import-in-the-middle | 1.14.2 | 122.36 kB | 850.93 kB | | source-map | 0.7.4 | 226 kB | 226 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | lru-cache | 7.18.3 | 133.92 kB | 133.92 kB | | pprof-format | 2.1.0 | 111.69 kB | 111.69 kB | | @datadog/sketches-js | 2.1.1 | 109.9 kB | 109.9 kB | | lodash.sortby | 4.7.0 | 75.76 kB | 75.76 kB | | ignore | 5.3.2 | 53.63 kB | 53.63 kB | | istanbul-lib-coverage | 3.2.2 | 34.37 kB | 34.37 kB | | rfdc | 1.4.1 | 27.15 kB | 27.15 kB | | @isaacs/ttlcache | 1.4.1 | 25.2 kB | 25.2 kB | | dc-polyfill | 0.1.9 | 25.11 kB | 25.11 kB | | tlhunter-sorted-set | 0.1.0 | 24.94 kB | 24.94 kB | | shell-quote | 1.8.3 | 23.74 kB | 23.74 kB | | limiter | 1.1.5 | 23.17 kB | 23.17 kB | | retry | 0.13.1 | 18.85 kB | 18.85 kB | | semifies | 1.0.0 | 15.84 kB | 15.84 kB | | jest-docblock | 29.7.0 | 8.99 kB | 12.76 kB | | crypto-randomuuid | 1.0.0 | 11.18 kB | 11.18 kB | | ttl-set | 1.0.0 | 4.61 kB | 9.69 kB | | mutexify | 1.4.0 | 5.71 kB | 8.74 kB | | path-to-regexp | 0.1.12 | 6.6 kB | 6.6 kB | | koalas | 1.0.2 | 6.47 kB | 6.47 kB | | module-details-from-path | 1.0.4 | 3.96 kB | 3.96 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

github-actions[bot] avatar Feb 06 '25 10:02 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.78%. Comparing base (9ff794c) to head (3e6860f). Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5216      +/-   ##
==========================================
- Coverage   81.81%   81.78%   -0.04%     
==========================================
  Files         472      472              
  Lines       19422    19422              
==========================================
- Hits        15891    15884       -7     
- Misses       3531     3538       +7     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Feb 06 '25 10:02 codecov[bot]

Datadog Report

Branch report: watson/enable-eslint-plugin-n Commit report: 2eb38dd Test service: dd-trace-js-integration-tests

:x: 138 Failed (138 Known Flaky), 1015 Passed, 0 Skipped, 20m 42.48s Total Time

:x: Failed Tests (138)

This report shows up to 5 failed tests.

  • jest CommonJS can report git metadata - integration-tests/jest/jest.spec.js - :snowflake: Known flaky - Details

    Expand for error
    imeout
    
  • jest CommonJS can report git metadata - integration-tests/jest/jest.spec.js - :snowflake: Known flaky - Details

    Expand for error
    imeout
    
  • jest CommonJS can run and report tests with agentless - integration-tests/jest/jest.spec.js - :snowflake: Known flaky - Details

    Expand for error
    imeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/integration-tests/jest/jest.spec.js)
    
  • jest CommonJS can run and report tests with agentless - integration-tests/jest/jest.spec.js - :snowflake: Known flaky - Details

    Expand for error
    imeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/integration-tests/jest/jest.spec.js)
    
  • jest CommonJS can run and report tests with evp proxy - integration-tests/jest/jest.spec.js - :snowflake: Known flaky - Details

    Expand for error
    imeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/integration-tests/jest/jest.spec.js)
    

Benchmarks

Benchmark execution time: 2025-07-08 12:47:30

Comparing candidate commit 3e6860f6cdaeada5f66788ed2fbc026cbd3403a7 in PR branch watson/enable-eslint-plugin-n with baseline commit 9ff794ccfc8e8b99d9827872cd50ec0ff4f74f21 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 1271 metrics, 52 unstable metrics.

pr-commenter[bot] avatar Feb 06 '25 10:02 pr-commenter[bot]

@BridgeAR I discovered a problem regarding eslint-plugin-n and eslint-config-standard. It seems that eslint-config-standard bundles eslint-plugin-n, and so any scope we set for which files eslint-plugin-n should cover is overridden the moment we enable eslint-config-standard. I've long wanted to ditch eslint-config-standard since it's using a lot of deprecated rules and otherwise doesn't follow modern ESLint standards. Maybe this is the final straw. But in any case, figuring out how to deal with this is probably a prerequisite for this PR.

watson avatar Feb 25 '25 12:02 watson

@watson that makes sense. Standard is sadly not properly maintained since a long time. +1 on removing it. Should we just do it in this PR?

BridgeAR avatar Feb 25 '25 12:02 BridgeAR

Seems like there is an issue running the linter:

ReferenceError: n is not defined at file:///home/runner/work/dd-trace-js/dd-trace-js/eslint.config.mjs?mtime=1740645489770:55:8

BridgeAR avatar Feb 27 '25 11:02 BridgeAR