Skip to content

Commit 47fb0d1

Browse files
chore: convert ESLint files from .js/.mjs to .ts (#109310)
Directly changes files from `.mjs` to ~`.mts`. I would have preferred the cleaner `.ts` but that will require adding `"type": "module"` to `package.json`, which is more work (which would be a great followup!).~ `.ts`, building on #109319's switching the package to be ESM by default. Imports are now TypeScript-style extension-less ones. Now that the plugin's files are typed, this applies a few types cleanups: * Uses [typescript-eslint's `RuleCreator`](https://typescript-eslint.io/developers/custom-rules#rulecreator) to create rules, which gives nicer typings than the built-in ESLint `Rule` * Updates node types from [`estree`](https://github.com/estree/estree) (only vanilla JS types) to [`@typescript-eslint/estree`](https://typescript-eslint.io/packages/typescript-estree) (full TS node types) * Converts JSDoc types to full TypeScript syntax This PR should have no changes to the lint rules' behavior. The only runtime code changes are for deleting unused parameters.
1 parent 0fc74d5 commit 47fb0d1

29 files changed

+571
-633
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ vercel.json @getsentry/owners-js-bu
118118
/.github/file-filters.yml @getsentry/owners-js-build
119119
babel.config.* @getsentry/owners-js-build
120120
build-utils/ @getsentry/owners-js-build
121-
eslint.config.js @getsentry/owners-js-build
121+
eslint.config.ts @getsentry/owners-js-build
122122
jest-balance.json @getsentry/owners-js-build
123123
jest.config.ts @getsentry/owners-js-build
124124
tsconfig.* @getsentry/owners-js-build

eslint.config.js renamed to eslint.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ import invariant from 'invariant';
4949
import typescript from 'typescript-eslint';
5050

5151
// eslint-disable-next-line boundaries/element-types
52-
import * as sentryScrapsPlugin from './static/eslint/eslintPluginScraps/index.js';
52+
import * as sentryScrapsPlugin from './static/eslint/eslintPluginScraps/index';
5353
// eslint-disable-next-line boundaries/element-types
54-
import * as sentryPlugin from './static/eslint/eslintPluginSentry/index.js';
54+
import * as sentryPlugin from './static/eslint/eslintPluginSentry/index';
5555

5656
invariant(react.configs.flat, 'For typescript');
5757
invariant(react.configs.flat.recommended, 'For typescript');
@@ -431,7 +431,7 @@ export default typescript.config([
431431
'import/no-duplicates': 'error',
432432
'import/no-extraneous-dependencies': [
433433
'error',
434-
{includeTypes: true, devDependencies: ['!eslint.config.js']},
434+
{includeTypes: true, devDependencies: ['!eslint.config.ts']},
435435
],
436436
'import/no-named-default': 'error',
437437
'import/no-nodejs-modules': 'error',

knip.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const config: KnipConfig = {
4444
...productionEntryPoints.map(entry => `${entry}!`),
4545
...testingEntryPoints,
4646
...storyBookEntryPoints,
47-
'static/eslint/**/index.js',
47+
'static/eslint/**/index.ts',
4848
// figma code connect files - consumed by Figma CLI
4949
'static/**/*.figma.{tsx,jsx}',
5050
],
@@ -60,7 +60,7 @@ const config: KnipConfig = {
6060
'!static/app/**/__stories__/*.{js,ts,tsx}!',
6161
'!static/app/stories/**/*.{js,ts,tsx}!',
6262
// ignore eslint plugins in production
63-
'!static/eslint/**/*.js!',
63+
'!static/eslint/**/*.ts!',
6464
],
6565
compilers: {
6666
mdx: async text => String(await compile(text)),

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@
204204
"@types/gettext-parser": "8.0.0",
205205
"@types/node": "^22.9.1",
206206
"@typescript/native-preview": "7.0.0-dev.20260112.1",
207+
"@typescript-eslint/utils": "8.56.1",
208+
"@typescript-eslint/rule-tester": "8.56.1",
207209
"babel-jest": "30.0.4",
208210
"eslint": "9.34.0",
209211
"eslint-config-prettier": "10.1.8",

0 commit comments

Comments
 (0)