|
1 | 1 | { |
2 | 2 | "extends": "eslint:recommended", |
3 | 3 | "rules": { |
| 4 | + // "quotes": ["warn", "single", { "avoidEscape": true }], |
4 | 5 | "require-atomic-updates": "off", |
5 | 6 | "block-spacing": [ |
6 | 7 | "error", |
|
118 | 119 | "unicode-bom": [ |
119 | 120 | "error", |
120 | 121 | "never" |
| 122 | + ], |
| 123 | + "no-restricted-properties": [ |
| 124 | + "warn", |
| 125 | + { |
| 126 | + "object": "Promise", |
| 127 | + "property": "map", |
| 128 | + "message": "Bluebird-specific method 'Promise.map' detected. Suggestion: use native arrays with Promise.all or a library like 'p-map'." |
| 129 | + }, |
| 130 | + { |
| 131 | + "object": "Promise", |
| 132 | + "property": "reduce", |
| 133 | + "message": "Bluebird-specific method 'Promise.reduce' detected. Suggestion: use Array.reduce plus async/await or a concurrency library." |
| 134 | + }, |
| 135 | + { |
| 136 | + "object": "Promise", |
| 137 | + "property": "filter", |
| 138 | + "message": "Bluebird-specific method 'Promise.filter' detected. Suggestion: use Array.filter plus async/await or a concurrency library." |
| 139 | + }, |
| 140 | + { |
| 141 | + "object": "Promise", |
| 142 | + "property": "each", |
| 143 | + "message": "Bluebird-specific method 'Promise.each' detected. Suggestion: use a for-loop/forEach with async/await." |
| 144 | + }, |
| 145 | + { |
| 146 | + "object": "Promise", |
| 147 | + "property": "props", |
| 148 | + "message": "Bluebird-specific method 'Promise.props' detected. Suggestion: use Promise.all with Object.entries or a custom approach." |
| 149 | + }, |
| 150 | + { |
| 151 | + "object": "Promise", |
| 152 | + "property": "join", |
| 153 | + "message": "Bluebird-specific method 'Promise.join' detected. Suggestion: use Promise.all([...]) and destructuring in .then." |
| 154 | + }, |
| 155 | + { |
| 156 | + "object": "Promise", |
| 157 | + "property": "try", |
| 158 | + "message": "Bluebird-specific method 'Promise.try' detected. Suggestion: use a try/catch block or an async function." |
| 159 | + }, |
| 160 | + { |
| 161 | + "object": "Promise", |
| 162 | + "property": "attempt", |
| 163 | + "message": "Bluebird-specific method 'Promise.attempt' detected. Suggestion: same as 'Promise.try'—use try/catch or async." |
| 164 | + }, |
| 165 | + { |
| 166 | + "object": "Promise", |
| 167 | + "property": "method", |
| 168 | + "message": "Bluebird-specific method 'Promise.method' detected. Suggestion: define an async function or return a native Promise." |
| 169 | + }, |
| 170 | + { |
| 171 | + "object": "Promise", |
| 172 | + "property": "promisify", |
| 173 | + "message": "Bluebird-specific method 'Promise.promisify' detected. Suggestion: use native 'util.promisify' or wrap in a new Promise." |
| 174 | + }, |
| 175 | + { |
| 176 | + "object": "Promise", |
| 177 | + "property": "promisifyAll", |
| 178 | + "message": "Bluebird-specific method 'Promise.promisifyAll' detected. Suggestion: consider 'util.promisify' for each function or a similar library." |
| 179 | + }, |
| 180 | + { |
| 181 | + "object": "Promise", |
| 182 | + "property": "fromCallback", |
| 183 | + "message": "Bluebird-specific method 'Promise.fromCallback' detected. Suggestion: use new Promise(...) or 'util.promisify'." |
| 184 | + }, |
| 185 | + { |
| 186 | + "object": "Promise", |
| 187 | + "property": "coroutine", |
| 188 | + "message": "Bluebird-specific method 'Promise.coroutine' detected. Suggestion: use native async/await." |
| 189 | + }, |
| 190 | + { |
| 191 | + "object": "Promise", |
| 192 | + "property": "spawn", |
| 193 | + "message": "Bluebird-specific method 'Promise.spawn' detected. Suggestion: use native async/await." |
| 194 | + }, |
| 195 | + { |
| 196 | + "object": "Promise", |
| 197 | + "property": "using", |
| 198 | + "message": "Bluebird-specific method 'Promise.using' detected. Suggestion: use try/finally or a resource-management library." |
| 199 | + }, |
| 200 | + { |
| 201 | + "object": "Promise", |
| 202 | + "property": "disposer", |
| 203 | + "message": "Bluebird-specific method 'Promise.disposer' detected. Suggestion: use try/finally or a resource-management library." |
| 204 | + }, |
| 205 | + { |
| 206 | + "object": "Promise", |
| 207 | + "property": "settle", |
| 208 | + "message": "Bluebird-specific method 'Promise.settle' detected. Suggestion: use native 'Promise.allSettled'." |
| 209 | + }, |
| 210 | + |
| 211 | + /* ---------- Same methods on the Bluebird object itself ---------- */ |
| 212 | + { |
| 213 | + "object": "Bluebird", |
| 214 | + "property": "map", |
| 215 | + "message": "Bluebird-specific method 'Bluebird.map' detected. Suggestion: use array mapping + Promise.all or 'p-map'." |
| 216 | + }, |
| 217 | + { |
| 218 | + "object": "Bluebird", |
| 219 | + "property": "reduce", |
| 220 | + "message": "Bluebird-specific method 'Bluebird.reduce' detected. Suggestion: use array reduce + async/await or concurrency library." |
| 221 | + }, |
| 222 | + { |
| 223 | + "object": "Bluebird", |
| 224 | + "property": "filter", |
| 225 | + "message": "Bluebird-specific method 'Bluebird.filter' detected. Suggestion: use array filter + async/await or concurrency library." |
| 226 | + }, |
| 227 | + { |
| 228 | + "object": "Bluebird", |
| 229 | + "property": "each", |
| 230 | + "message": "Bluebird-specific method 'Bluebird.each' detected. Suggestion: use a for-loop or forEach + async/await." |
| 231 | + }, |
| 232 | + { |
| 233 | + "object": "Bluebird", |
| 234 | + "property": "props", |
| 235 | + "message": "Bluebird-specific method 'Bluebird.props' detected. Suggestion: use Promise.all with object entries or a custom approach." |
| 236 | + }, |
| 237 | + { |
| 238 | + "object": "Bluebird", |
| 239 | + "property": "join", |
| 240 | + "message": "Bluebird-specific method 'Bluebird.join' detected. Suggestion: use Promise.all([...]) and destructuring." |
| 241 | + }, |
| 242 | + { |
| 243 | + "object": "Bluebird", |
| 244 | + "property": "try", |
| 245 | + "message": "Bluebird-specific method 'Bluebird.try' detected. Suggestion: use a try/catch block or async function." |
| 246 | + }, |
| 247 | + { |
| 248 | + "object": "Bluebird", |
| 249 | + "property": "attempt", |
| 250 | + "message": "Bluebird-specific method 'Bluebird.attempt' detected. Suggestion: use a try/catch block or async function." |
| 251 | + }, |
| 252 | + { |
| 253 | + "object": "Bluebird", |
| 254 | + "property": "method", |
| 255 | + "message": "Bluebird-specific method 'Bluebird.method' detected. Suggestion: define an async function or return a native Promise." |
| 256 | + }, |
| 257 | + { |
| 258 | + "object": "Bluebird", |
| 259 | + "property": "promisify", |
| 260 | + "message": "Bluebird-specific method 'Bluebird.promisify' detected. Suggestion: use native 'util.promisify' or wrap in a new Promise." |
| 261 | + }, |
| 262 | + { |
| 263 | + "object": "Bluebird", |
| 264 | + "property": "promisifyAll", |
| 265 | + "message": "Bluebird-specific method 'Bluebird.promisifyAll' detected. Suggestion: consider 'util.promisify' or a similar library." |
| 266 | + }, |
| 267 | + { |
| 268 | + "object": "Bluebird", |
| 269 | + "property": "fromCallback", |
| 270 | + "message": "Bluebird-specific method 'Bluebird.fromCallback' detected. Suggestion: use new Promise(...) or 'util.promisify'." |
| 271 | + }, |
| 272 | + { |
| 273 | + "object": "Bluebird", |
| 274 | + "property": "coroutine", |
| 275 | + "message": "Bluebird-specific method 'Bluebird.coroutine' detected. Suggestion: use native async/await." |
| 276 | + }, |
| 277 | + { |
| 278 | + "object": "Bluebird", |
| 279 | + "property": "spawn", |
| 280 | + "message": "Bluebird-specific method 'Bluebird.spawn' detected. Suggestion: use native async/await." |
| 281 | + }, |
| 282 | + { |
| 283 | + "object": "Bluebird", |
| 284 | + "property": "using", |
| 285 | + "message": "Bluebird-specific method 'Bluebird.using' detected. Suggestion: use try/finally or a resource-management library." |
| 286 | + }, |
| 287 | + { |
| 288 | + "object": "Bluebird", |
| 289 | + "property": "disposer", |
| 290 | + "message": "Bluebird-specific method 'Bluebird.disposer' detected. Suggestion: use try/finally or a resource-management library." |
| 291 | + }, |
| 292 | + { |
| 293 | + "object": "Bluebird", |
| 294 | + "property": "settle", |
| 295 | + "message": "Bluebird-specific method 'Bluebird.settle' detected. Suggestion: use native 'Promise.allSettled'." |
| 296 | + } |
| 297 | + ], |
| 298 | + "no-restricted-syntax": [ |
| 299 | + "warn", |
| 300 | + { |
| 301 | + "selector": "CallExpression[callee.property.name='tap']", |
| 302 | + "message": "Bluebird-specific instance method '.tap()' detected. Suggestion: use '.then(value => { ...; return value; })'." |
| 303 | + }, |
| 304 | + { |
| 305 | + "selector": "CallExpression[callee.property.name='tapCatch']", |
| 306 | + "message": "Bluebird-specific instance method '.tapCatch()' detected. Suggestion: use '.catch(error => { ...; throw error; })'." |
| 307 | + }, |
| 308 | + { |
| 309 | + "selector": "CallExpression[callee.property.name='spread']", |
| 310 | + "message": "Bluebird-specific instance method '.spread()' detected. Suggestion: use '.then(([a, b]) => ... )' with array destructuring." |
| 311 | + }, |
| 312 | + { |
| 313 | + "selector": "CallExpression[callee.type='MemberExpression'][callee.property.name='bind'][callee.object.name=/^(Promise|Bluebird|BPromise)$/]", |
| 314 | + "message": "Bluebird-specific '.bind()' detected on a Bluebird promise. Suggestion: manually bind 'this' or use arrow functions." |
| 315 | + }, |
| 316 | + { |
| 317 | + "selector": "CallExpression[callee.property.name='delay']", |
| 318 | + "message": "Bluebird-specific instance method '.delay()' detected. Suggestion: use setTimeout() or a library (e.g., p-delay)." |
| 319 | + }, |
| 320 | + { |
| 321 | + "selector": "CallExpression[callee.property.name='timeout']", |
| 322 | + "message": "Bluebird-specific instance method '.timeout()' detected. Suggestion: use p-timeout or similar library." |
| 323 | + }, |
| 324 | + { |
| 325 | + "selector": "CallExpression[callee.property.name='return']", |
| 326 | + "message": "Bluebird-specific instance method '.return()' detected. Suggestion: use '.then(() => someValue)' or rewrite chain." |
| 327 | + }, |
| 328 | + { |
| 329 | + "selector": "CallExpression[callee.property.name='throw']", |
| 330 | + "message": "Bluebird-specific instance method '.throw()' detected. Suggestion: use '.then(() => { throw error; })'." |
| 331 | + }, |
| 332 | + { |
| 333 | + "selector": "CallExpression[callee.property.name='asCallback']", |
| 334 | + "message": "Bluebird-specific instance method '.asCallback()' detected. Suggestion: use 'util.callbackify' or rewrite manually." |
| 335 | + }, |
| 336 | + { |
| 337 | + "selector": "CallExpression[callee.property.name='nodeify']", |
| 338 | + "message": "Bluebird-specific instance method '.nodeify()' detected. Suggestion: use 'util.callbackify' or rewrite manually." |
| 339 | + }, |
| 340 | + { |
| 341 | + "selector": "CallExpression[callee.property.name='reflect']", |
| 342 | + "message": "Bluebird-specific instance method '.reflect()' detected. Suggestion: use 'Promise.allSettled' or custom handling." |
| 343 | + }, |
| 344 | + { |
| 345 | + "selector": "CallExpression[callee.property.name='caught']", |
| 346 | + "message": "Bluebird-specific instance method '.caught()' detected. Suggestion: use '.catch()' with condition or separate logic." |
| 347 | + }, |
| 348 | + { |
| 349 | + "selector": "CallExpression[callee.property.name='catchReturn']", |
| 350 | + "message": "Bluebird-specific instance method '.catchReturn()' detected. Suggestion: use '.catch(err => fallbackValue)' or similar." |
| 351 | + }, |
| 352 | + { |
| 353 | + "selector": "CallExpression[callee.property.name='catchThrow']", |
| 354 | + "message": "Bluebird-specific instance method '.catchThrow()' detected. Suggestion: use '.catch(err => { throw newError; })'." |
| 355 | + } |
121 | 356 | ] |
122 | 357 | }, |
123 | 358 | "overrides": [ |
|
142 | 377 | { |
143 | 378 | "files": [ |
144 | 379 | "plugins/content/frontend/content-blocks/**/*.js", |
145 | | - "plugins/journey_engine/frontend/builder/**/*.js", |
146 | | - "plugins/content/frontend/content-blocks/**/*.vue", |
147 | | - "plugins/journey_engine/frontend/builder/**/*.vue" |
148 | | - ], |
149 | | - "plugins": [ |
150 | | - "vue", |
151 | | - "@stylistic" |
| 380 | + "plugins/journey_engine/frontend/builder/**/*.js" |
152 | 381 | ], |
153 | 382 | "extends": [ |
154 | | - "eslint:recommended", |
155 | | - "plugin:vue/vue3-essential", |
156 | | - "plugin:vue/vue3-strongly-recommended", |
157 | | - "plugin:vue/vue3-recommended" |
| 383 | + "eslint:recommended" |
158 | 384 | ], |
159 | 385 | "rules": { |
160 | | - // override these post initial content release, to make them fit with countly convention |
161 | 386 | "no-console": ["error"], |
162 | | - "@stylistic/quotes": ["error", "single"], |
163 | | - "@stylistic/quote-props": ["error", "as-needed"], |
164 | | - "no-unused-vars": "off", |
165 | | - "vue/no-unused-vars": ["error", { |
166 | | - "ignorePattern": "^_" |
| 387 | + "no-unused-vars": ["error", { |
| 388 | + "argsIgnorePattern": "^_", // unused function args |
| 389 | + "varsIgnorePattern": "^_" // unused variables |
167 | 390 | }] |
168 | 391 | }, |
169 | 392 | "parserOptions": { |
|
0 commit comments