diff --git a/eslint.config.mjs b/eslint.config.mjs index 952ce4eb43a260..1a662e10d34d6f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -289,11 +289,7 @@ export default typescript.config([ 'no-import-assign': 'off', // TODO(ryan953): Fix violations and delete this line 'no-loss-of-precision': 'off', // TODO(ryan953): Fix violations and delete this line 'no-prototype-builtins': 'off', // TODO(ryan953): Fix violations and delete this line - 'no-redeclare': 'off', // TODO(ryan953): Fix violations and delete this line - 'no-self-assign': 'off', // TODO(ryan953): Fix violations and delete this line - 'no-undef': 'off', // TODO(ryan953): Fix violations and delete this line 'no-unsafe-optional-chaining': 'off', // TODO(ryan953): Fix violations and delete this line - 'no-unused-vars': 'off', // TODO(ryan953): Fix violations and delete this line 'no-useless-catch': 'off', // TODO(ryan953): Fix violations and delete this line 'no-useless-escape': 'off', // TODO(ryan953): Fix violations and delete this line 'valid-typeof': 'off', // TODO(ryan953): Fix violations and delete this line @@ -611,6 +607,46 @@ export default typescript.config([ name: 'plugin/prettier', ...prettier, }, + { + name: 'files/*.config.*', + files: ['*.config.*'], + languageOptions: { + globals: { + ...globals.commonjs, + ...globals.node, + }, + }, + }, + { + name: 'files/scripts', + files: ['scripts/**/*.{js,ts}', 'tests/js/test-balancer/index.js'], + languageOptions: { + sourceType: 'commonjs', + globals: { + ...globals.commonjs, + ...globals.node, + }, + }, + rules: { + 'no-console': 'off', + }, + }, + { + name: 'files/jest related', + files: [ + 'tests/js/jest-pegjs-transform.js', + 'tests/js/sentry-test/echartsMock.js', + 'tests/js/sentry-test/importStyleMock.js', + 'tests/js/sentry-test/svgMock.js', + ], + languageOptions: { + sourceType: 'commonjs', + globals: { + ...globals.commonjs, + }, + }, + rules: {}, + }, { name: 'files/devtoolbar', files: ['static/app/components/devtoolbar/**/*.{ts,tsx}'], diff --git a/scripts/build-js-loader.ts b/scripts/build-js-loader.ts index 233636c0a3109a..04d00f2c507e1d 100644 --- a/scripts/build-js-loader.ts +++ b/scripts/build-js-loader.ts @@ -1,4 +1,5 @@ -/* eslint-disable no-console */ +'use strict'; + import fs from 'node:fs'; import {minify} from 'terser'; import * as ts from 'typescript'; diff --git a/scripts/extract-android-device-names.js b/scripts/extract-android-device-names.js index 3c0f11e22dba44..9a6ae5e6a06c46 100644 --- a/scripts/extract-android-device-names.js +++ b/scripts/extract-android-device-names.js @@ -1,3 +1,5 @@ +'use strict'; + const csv = require('csv-parser'); const fs = require('node:fs'); diff --git a/scripts/extract-ios-device-names.ts b/scripts/extract-ios-device-names.ts index c7241479d96cb2..9446740838551b 100644 --- a/scripts/extract-ios-device-names.ts +++ b/scripts/extract-ios-device-names.ts @@ -1,4 +1,4 @@ -/* eslint-env node */ +'use strict'; import {existsSync, unlinkSync} from 'node:fs'; import fs from 'node:fs/promises'; import path from 'node:path'; @@ -103,6 +103,4 @@ async function run() { await fs.rename(tmpOutputPath, outputPath); } -run() - // eslint-disable-next-line no-console - .catch(error => console.error(`Failed to run extract-ios-device-names`, error)); +run().catch(error => console.error(`Failed to run extract-ios-device-names`, error)); diff --git a/scripts/test.js b/scripts/test.js index 156608c4ceeb17..ad877559f925fe 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -1,4 +1,4 @@ -/* global process */ +'use strict'; // Do this as the first thing so that any code reading it knows the right env. // process.env.BABEL_ENV = 'test'; @@ -13,8 +13,6 @@ process.on('unhandledRejection', err => { throw err; }); -const jest = require('jest'); - let argv = process.argv.slice(2); // Remove watch if in CI or in coverage mode @@ -22,4 +20,4 @@ if (process.env.CI || process.env.SENTRY_PRECOMMIT || argv.includes('--coverage' argv = argv.filter(arg => arg !== '--watch'); } -jest.run(argv); +require('jest').run(argv); diff --git a/static/app/components/autoplayVideo.spec.tsx b/static/app/components/autoplayVideo.spec.tsx index 38a9702457ffec..6160b8ecf3dc7b 100644 --- a/static/app/components/autoplayVideo.spec.tsx +++ b/static/app/components/autoplayVideo.spec.tsx @@ -26,10 +26,7 @@ const makeProxyMock = (video: Partial) => { get(obj, prop) { return obj[prop]; }, - set(obj, prop) { - if (prop === 'current') { - obj.current = obj.current; - } + set(_obj, _prop) { return true; }, } diff --git a/static/app/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager.tsx b/static/app/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager.tsx index 7334eb165ddda4..ce1e850053f9a1 100644 --- a/static/app/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager.tsx +++ b/static/app/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager.tsx @@ -1778,11 +1778,9 @@ export class VirtualizedList { } } else { // If no anchor is provided, we default to 'auto' - if (position < top) { - position = position; - } else if (position > top + height) { + if (position > top + height) { position = index * 24 - height + 24; - } else { + } else if (position >= top) { return; } } diff --git a/static/app/views/routeError.tsx b/static/app/views/routeError.tsx index 530d986187cd4f..64a3923a802758 100644 --- a/static/app/views/routeError.tsx +++ b/static/app/views/routeError.tsx @@ -114,7 +114,7 @@ function RouteError({error, disableLogSentry, disableReport, project}: Props) { link: ( { - window.location.href = window.location.href; + window.location.href = String(window.location.href); }} /> ), diff --git a/tests/js/jest-pegjs-transform.js b/tests/js/jest-pegjs-transform.js index b235f12bace1d8..05cd39a2b5280e 100644 --- a/tests/js/jest-pegjs-transform.js +++ b/tests/js/jest-pegjs-transform.js @@ -1,10 +1,10 @@ -/* eslint-env node */ +'use strict'; -const crypto = require('node:crypto'); +const nodeCrypto = require('node:crypto'); const peggy = require('peggy'); function getCacheKey(fileData, _filePath, config, _options) { - return crypto + return nodeCrypto .createHash('md5') .update(fileData) .update(config.configString) diff --git a/tests/js/sentry-test/echartsMock.js b/tests/js/sentry-test/echartsMock.js index d24fcca2f4c107..8ebec2e2da28fa 100644 --- a/tests/js/sentry-test/echartsMock.js +++ b/tests/js/sentry-test/echartsMock.js @@ -1,3 +1,4 @@ +'use strict'; // empty stub file for echarts with jest module.exports = {default: {id: 'echarts'}, use: () => {}}; diff --git a/tests/js/sentry-test/importStyleMock.js b/tests/js/sentry-test/importStyleMock.js index f053ebf7976e37..648a166645e633 100644 --- a/tests/js/sentry-test/importStyleMock.js +++ b/tests/js/sentry-test/importStyleMock.js @@ -1 +1,2 @@ +'use strict'; module.exports = {}; diff --git a/tests/js/sentry-test/svgMock.js b/tests/js/sentry-test/svgMock.js index 9bddbeab7c8f64..ff0b38ca3f4812 100644 --- a/tests/js/sentry-test/svgMock.js +++ b/tests/js/sentry-test/svgMock.js @@ -1 +1,2 @@ +'use strict'; module.exports = {default: {id: 'test', viewBox: {}}}; diff --git a/tests/js/test-balancer/index.js b/tests/js/test-balancer/index.js index 2d31daf423a0fa..28514d18a21e98 100644 --- a/tests/js/test-balancer/index.js +++ b/tests/js/test-balancer/index.js @@ -1,4 +1,5 @@ -/* eslint-env node */ +'use strict'; + const fs = require('node:fs'); const path = require('node:path');