-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy patheslint.config.js
More file actions
119 lines (103 loc) · 2.63 KB
/
eslint.config.js
File metadata and controls
119 lines (103 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* Copyright 2025 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
'use strict'
const jsdoc = require('eslint-plugin-jsdoc')
const sharedConfig = require('@newrelic/eslint-config')
// The new eslint configuration format is a simple array of configuration
// objects. See https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects.
//
// While working on the config, it can be helpful to run:
// npx @eslint/config-inspector
// See https://eslint.org/docs/latest/use/configure/ignore#ignoring-files
const globalIgnores = {
ignores: [
'**/node_modules/**',
'**/out/**', // Compiled jsdocs directory.
'**/.next/**', // Compiled Next.js directory.
// To avoid parsing HTML
'nextjs/nextjs-app-router/**',
'nextjs/nextjs-legacy/pages/404.js'
]
}
const configOverrides = {
files: [
'**/newrelic.js',
'**/newrelic.mjs',
'**/newrelic.cjs',
'**/.eslintrc.js',
'**/next.config.js'
],
rules: {
'header/header': 'off'
}
}
const executableOverrides = {
files: [
'application-logging/log-generator/log-generator.js'
],
rules: {
'n/hashbang': 'off'
}
}
const jsdocConfig = {
plugins: { jsdoc },
rules: {
'jsdoc/require-jsdoc': 'off',
'jsdoc/tag-lines': 'off',
'jsdoc/check-types': 'off'
}
}
// Configuration objects are merged in order. That is, the last object in the
// list will merge with objects earlier in the list. This allows for overriding
// any settings by adding objects to the end of the list.
// See:
// + https://eslint.org/docs/latest/use/configure/configuration-files#cascading-configuration-objectsar
// + https://eslint.org/blog/2022/08/new-config-system-part-2/#goodbye-extends%2C-hello-flat-cascade
module.exports = [
...sharedConfig.configs.neostandard,
sharedConfig.plugins.sonarjs.configs.recommended,
{
...sharedConfig.configs.sonarjsTestsOverrides,
},
sharedConfig.configs.sonarjsBaselineOverrides,
jsdoc.configs['flat/recommended'],
jsdocConfig,
{
...sharedConfig.configs.nodeRecommended
},
{
files: ['bin/*.js'],
rules: { 'n/hashbang': 'off' }
},
sharedConfig.configs.baselineNewRelicConfig,
configOverrides,
globalIgnores,
{
rules: {
'n/no-missing-require': 'warn',
'n/no-missing-import': 'warn'
}
},
{
settings: {
node: {
version: '>=22.16',
}
},
rules: {
'n/no-unsupported-features/node-builtins':
['error', {
ignores: []
}]
}
},
{
files: ['eslint.config.js'],
rules: {
'n/no-unpublished-require': 'off'
}
},
executableOverrides
]