@@ -2,10 +2,11 @@ import path from 'node:path'
22import { fileURLToPath } from 'node:url'
33
44import { FlatCompat } from '@eslint/eslintrc'
5- import js from '@eslint/js'
6- import stylistic from '@stylistic/eslint-plugin-js'
7- import mocha from 'eslint-plugin-mocha'
8- import n from 'eslint-plugin-n'
5+ import eslintPluginJs from '@eslint/js'
6+ import eslintPluginStylistic from '@stylistic/eslint-plugin-js'
7+ import eslintPluginMocha from 'eslint-plugin-mocha'
8+ import eslintPluginN from 'eslint-plugin-n'
9+ import eslintPluginUnicorn from 'eslint-plugin-unicorn'
910import globals from 'globals'
1011
1112const __filename = fileURLToPath ( import . meta. url )
@@ -48,14 +49,15 @@ export default [
4849 'packages/dd-trace/src/payload-tagging/jsonpath-plus.js' // Vendored
4950 ]
5051 } ,
51- { name : '@eslint/js/recommnded' , ...js . configs . recommended } ,
52+ { name : '@eslint/js/recommnded' , ...eslintPluginJs . configs . recommended } ,
5253 ...compat . extends ( 'standard' ) . map ( ( config , i ) => ( { name : config . name || `standard/${ i + 1 } ` , ...config } ) ) ,
5354 {
5455 name : 'dd-trace/defaults' ,
5556
5657 plugins : {
57- n,
58- '@stylistic/js' : stylistic
58+ '@stylistic/js' : eslintPluginStylistic ,
59+ n : eslintPluginN ,
60+ unicorn : eslintPluginUnicorn
5961 } ,
6062
6163 languageOptions : {
@@ -88,11 +90,6 @@ export default [
8890 'no-var' : 'error' // Override (set to warn in standard)
8991 }
9092 } ,
91- {
92- name : 'mocha/recommnded' ,
93- ...mocha . configs . flat . recommended ,
94- files : TEST_FILES
95- } ,
9693 {
9794 name : 'dd-trace/src/all' ,
9895 files : SRC_FILES ,
@@ -106,9 +103,91 @@ export default [
106103 name : 'semver' ,
107104 message : 'Please use semifies instead.'
108105 }
109- ] ]
106+ ] ] ,
107+
108+ ...eslintPluginUnicorn . configs . recommended . rules ,
109+
110+ // Overriding recommended unicorn rules
111+ 'unicorn/catch-error-name' : [ 'off' , { name : 'err' } ] , // 166 errors
112+ 'unicorn/consistent-existence-index-check' : 'off' , // 4 errors
113+ 'unicorn/consistent-function-scoping' : 'off' , // 21 errors
114+ 'unicorn/empty-brace-spaces' : 'off' , // 15 errors
115+ 'unicorn/error-message' : 'off' , // 1 error
116+ 'unicorn/escape-case' : 'off' , // 8 errors
117+ 'unicorn/expiring-todo-comments' : 'off' ,
118+ 'unicorn/explicit-length-check' : 'off' , // 68 errors
119+ 'unicorn/filename-case' : [ 'off' , { case : 'kebabCase' } ] , // 59 errors
120+ 'unicorn/import-style' : 'off' , // 9 errors - controversial
121+ 'unicorn/new-for-builtins' : 'off' , // 5 errors
122+ 'unicorn/no-abusive-eslint-disable' : 'off' , // 10 errors
123+ 'unicorn/no-anonymous-default-export' : 'off' , // only makes a difference for ESM
124+ 'unicorn/no-array-callback-reference' : 'off' , // too strict
125+ 'unicorn/no-array-for-each' : 'off' , // 122 errors
126+ 'unicorn/no-array-push-push' : 'off' , // 6 errors
127+ 'unicorn/no-array-reduce' : 'off' , // too strict
128+ 'unicorn/no-for-loop' : 'off' , // 15 errors
129+ 'unicorn/no-hex-escape' : 'off' , // too strict
130+ 'unicorn/no-instanceof-array' : 'off' , // 5 errors
131+ 'unicorn/no-instanceof-builtins' : 'off' , // 10 errors
132+ 'unicorn/no-lonely-if' : 'off' , // 19 errors
133+ 'unicorn/no-negated-condition' : 'off' , // too strict
134+ 'unicorn/no-nested-ternary' : 'off' , // too strict
135+ 'unicorn/no-new-array' : 'off' , // 6 errors
136+ 'unicorn/no-null' : 'off' , // too strict
137+ 'unicorn/no-object-as-default-parameter' : 'off' , // too strict
138+ 'unicorn/no-static-only-class' : 'off' , // 1 error
139+ 'unicorn/no-this-assignment' : 'off' , // too strict
140+ 'unicorn/no-typeof-undefined' : 'off' , // 1 error
141+ 'unicorn/no-unreadable-array-destructuring' : 'off' , // TODO: undecided
142+ 'unicorn/no-unreadable-iife' : 'off' , // too strict
143+ 'unicorn/no-useless-promise-resolve-reject' : 'off' , // 3 errors
144+ 'unicorn/no-useless-undefined' : 'off' , // 59 errors
145+ 'unicorn/no-zero-fractions' : 'off' , // 5 errors
146+ 'unicorn/number-literal-case' : 'off' , // 44 errors
147+ 'unicorn/numeric-separators-style' : 'off' , // 35 errors
148+ 'unicorn/prefer-array-flat-map' : 'off' , // 1 error
149+ 'unicorn/prefer-array-flat' : 'off' , // 9 errors
150+ 'unicorn/prefer-array-some' : 'off' , // 2 errors
151+ 'unicorn/prefer-at' : 'off' , // 47 errors
152+ 'unicorn/prefer-code-point' : 'off' , // 3 errors
153+ 'unicorn/prefer-default-parameters' : 'off' , // 1 error
154+ 'unicorn/prefer-event-target' : 'off' , // TODO: undecided (2 errors)
155+ 'unicorn/prefer-export-from' : 'off' , // 1 error
156+ 'unicorn/prefer-global-this' : 'off' , // 23 errors
157+ 'unicorn/prefer-includes' : 'off' , // 19 errors
158+ 'unicorn/prefer-logical-operator-over-ternary' : 'off' , // 15 errors
159+ 'unicorn/prefer-math-min-max' : 'off' , // 1 error
160+ 'unicorn/prefer-math-trunc' : 'off' , // 8 errors
161+ 'unicorn/prefer-module' : 'off' , // too strict
162+ 'unicorn/prefer-native-coercion-functions' : 'off' , // 18 errors
163+ 'unicorn/prefer-negative-index' : 'off' , // 1 error
164+ 'unicorn/prefer-node-protocol' : 'off' , // 148 errors
165+ 'unicorn/prefer-number-properties' : 'off' , // 56 errors
166+ 'unicorn/prefer-object-from-entries' : 'off' , // 3 errors
167+ 'unicorn/prefer-optional-catch-binding' : 'off' , // 62 errors
168+ 'unicorn/prefer-reflect-apply' : 'off' , // too strict
169+ 'unicorn/prefer-regexp-test' : 'off' , // 6 errors
170+ 'unicorn/prefer-set-has' : 'off' , // 18 errors
171+ 'unicorn/prefer-spread' : 'off' , // 36 errors
172+ 'unicorn/prefer-string-raw' : 'off' , // 22 errors
173+ 'unicorn/prefer-string-replace-all' : 'off' , // 33 errors
174+ 'unicorn/prefer-string-slice' : 'off' , // 53 errors
175+ 'unicorn/prefer-switch' : 'off' , // 8 errors
176+ 'unicorn/prefer-ternary' : 'off' , // 48 errors
177+ 'unicorn/prefer-top-level-await' : 'off' , // too strict
178+ 'unicorn/prefer-type-error' : 'off' , // 5 errors
179+ 'unicorn/prevent-abbreviations' : 'off' , // too strict
180+ 'unicorn/relative-url-style' : 'off' , // 1 error
181+ 'unicorn/switch-case-braces' : 'off' , // too strict
182+ 'unicorn/text-encoding-identifier-case' : 'off' , // 4 errors
183+ 'unicorn/throw-new-error' : 'off' // 5 errors
110184 }
111185 } ,
186+ {
187+ name : 'mocha/recommended' ,
188+ ...eslintPluginMocha . configs . flat . recommended ,
189+ files : TEST_FILES
190+ } ,
112191 {
113192 name : 'dd-trace/tests/all' ,
114193 files : TEST_FILES ,
0 commit comments