Skip to content

Commit b29b51c

Browse files
committed
Enable recommended rules for eslint-plugin-n
1 parent 664c0fc commit b29b51c

File tree

30 files changed

+59
-9
lines changed

30 files changed

+59
-9
lines changed

benchmark/sirun/appsec-iast/insecure-bank.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const http = require('http')
2-
const app = require('/opt/insecure-bank-js/app') // eslint-disable-line import/no-absolute-path
2+
const app = require('/opt/insecure-bank-js/app') // eslint-disable-line import/no-absolute-path, n/no-missing-require
33

44
const { port } = require('./common')
55

benchmark/sirun/appsec/insecure-bank.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const http = require('http')
2-
const app = require('/opt/insecure-bank-js/app') // eslint-disable-line import/no-absolute-path
2+
const app = require('/opt/insecure-bank-js/app') // eslint-disable-line import/no-absolute-path, n/no-missing-require
33

44
const { port } = require('./common')
55

benchmark/sirun/plugin-bluebird/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ if (Number(process.env.USE_TRACER)) {
44
require('../../..').init()
55
}
66

7+
// eslint-disable-next-line n/no-missing-require
78
const Promise = require('../../../versions/bluebird/node_modules/bluebird/js/release/bluebird')
89

910
const count = process.env.COUNT ? Number(process.env.COUNT) : 50000

esbuild.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
'use strict'
22

3+
// TODO: It shouldn't be necessary to disable n/no-unpublished-require - Research
4+
// eslint-disable-next-line n/no-unpublished-require
35
module.exports = require('./packages/datadog-esbuild/index.js')

eslint.config.mjs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,21 @@ export default [
4040
},
4141
{ name: '@eslint/js/recommnded', ...js.configs.recommended },
4242
...compat.extends('standard').map((config, i) => ({ name: config.name || `standard/${i + 1}`, ...config })),
43+
{
44+
...n.configs['flat/recommended'],
45+
ignores: [
46+
'packages/dd-trace/test/appsec/next/app-dir/**/*.js',
47+
'packages/dd-trace/test/appsec/next/pages-dir/**/*.js',
48+
'packages/datadog-plugin-next/test/app/**/*.js',
49+
'packages/datadog-plugin-next/test/**/pages/**/*.js',
50+
'packages/datadog-plugin-next/test/middleware.js',
51+
'**/*.mjs' // TODO: This shoudln't be required, research why it is
52+
]
53+
},
4354
{
4455
name: 'dd-trace/defaults',
4556

4657
plugins: {
47-
n,
4858
'@stylistic/js': stylistic
4959
},
5060

@@ -72,6 +82,15 @@ export default [
7282
'@stylistic/js/object-curly-spacing': ['error', 'always'],
7383
'import/no-extraneous-dependencies': 'error',
7484
'n/no-restricted-require': ['error', ['diagnostics_channel']],
85+
'n/hashbang': 'off', // TODO: Enable this rule once we have a plan to address it
86+
'n/no-process-exit': 'off', // TODO: Enable this rule once we have a plan to address it
87+
'n/no-unsupported-features/node-builtins': ['error', {
88+
ignores: [
89+
'async_hooks.createHook',
90+
'async_hooks.executionAsyncId',
91+
'async_hooks.executionAsyncResource'
92+
]
93+
}],
7594
'no-console': 'error',
7695
'no-prototype-builtins': 'off', // Override (turned on by @eslint/js/recommnded)
7796
'no-unused-expressions': 'off', // Override (turned on by standard)
@@ -107,7 +126,8 @@ export default [
107126
'mocha/no-sibling-hooks': 'off',
108127
'mocha/no-skipped-tests': 'off',
109128
'mocha/no-top-level-hooks': 'off',
110-
'n/handle-callback-err': 'off'
129+
'n/handle-callback-err': 'off',
130+
'n/no-missing-require': 'off'
111131
}
112132
},
113133
{

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
'use strict'
22

3+
// TODO: It shouldn't be necessary to disable n/no-unpublished-require - Research
4+
// eslint-disable-next-line n/no-unpublished-require
35
module.exports = require('./packages/dd-trace')

init.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
/* eslint-disable no-var */
44

5+
// TODO: It shouldn't be necessary to disable n/no-unpublished-require - Research
6+
// eslint-disable-next-line n/no-unpublished-require
57
var guard = require('./packages/dd-trace/src/guardrails')
68

79
module.exports = guard(function () {

initialize.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
* hook will always be active for ESM support.
1111
*/
1212

13+
/* eslint n/no-unsupported-features/node-builtins: ['error', { ignores: ['module.register'] }] */
14+
1315
import { isMainThread } from 'worker_threads'
1416

1517
import * as Module from 'node:module'

integration-tests/appsec/esm-app/index.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict'
2+
/* eslint n/no-unsupported-features/node-builtins: ['error', { ignores: ['module.register'] }] */
23

34
import childProcess from 'node:child_process'
45
import express from 'express'

integration-tests/appsec/multer.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict'
2+
/* eslint n/no-unsupported-features/node-builtins: ['error', { allowExperimental: true }] */
23

34
const { assert } = require('chai')
45
const path = require('path')

0 commit comments

Comments
 (0)