Skip to content

Commit d6d698a

Browse files
committed
refactor(linter/plugins): convert generated files to TS
1 parent 4be9062 commit d6d698a

File tree

9 files changed

+9
-17
lines changed

9 files changed

+9
-17
lines changed

.github/generated/ast_changes_watch_list.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
src:
55
- '.github/generated/ast_changes_watch_list.yml'
6-
- 'apps/oxlint/src-js/generated/constants.js'
6+
- 'apps/oxlint/src-js/generated/constants.ts'
77
- 'apps/oxlint/src-js/generated/deserialize.js'
88
- 'apps/oxlint/src-js/generated/keys.js'
9-
- 'apps/oxlint/src-js/generated/type_ids.js'
9+
- 'apps/oxlint/src-js/generated/type_ids.ts'
1010
- 'apps/oxlint/src-js/generated/types.d.ts'
1111
- 'apps/oxlint/src-js/generated/visitor.d.ts'
1212
- 'apps/oxlint/src-js/generated/walk.js'

apps/oxlint/src-js/plugins/lint.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import { addVisitorToCompiled, compiledVisitor, finalizeCompiledVisitor, initCom
66

77
// Lazy implementation
88
/*
9-
// @ts-expect-error we need to generate `.d.ts` file for this module.
109
import { TOKEN } from '../../dist/src-js/raw-transfer/lazy-common.js';
11-
// @ts-expect-error we need to generate `.d.ts` file for this module.
1210
import { walkProgram } from '../generated/walk.js';
1311
*/
1412

apps/oxlint/src-js/plugins/source_code.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import { createRequire } from 'node:module';
2-
import {
3-
DATA_POINTER_POS_32,
4-
SOURCE_LEN_OFFSET,
5-
// TODO(camc314): we need to generate `.d.ts` file for this module.
6-
// @ts-expect-error
7-
} from '../generated/constants.js';
8-
// @ts-expect-error we need to generate `.d.ts` file for this module
2+
import { DATA_POINTER_POS_32, SOURCE_LEN_OFFSET } from '../generated/constants.js';
3+
94
// We use the deserializer which removes `ParenthesizedExpression`s from AST,
105
// and with `range`, `loc`, and `parent` properties on AST nodes, to match ESLint
6+
// @ts-expect-error we need to generate `.d.ts` file for this module
117
import { deserializeProgramOnly } from '../../dist/generated/deserialize.js';
128

139
import {

apps/oxlint/src-js/plugins/visitor.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@
7272
// for objects created by user code in visitors. If ephemeral user-created objects all fit in new space,
7373
// it will avoid full GC runs, which should greatly improve performance.
7474

75-
// TODO(camc314): we need to generate `.d.ts` file for this module.
76-
// @ts-expect-error
7775
import { LEAF_NODE_TYPES_COUNT, NODE_TYPE_IDS_MAP, NODE_TYPES_COUNT } from '../generated/type_ids.js';
7876
import { assertIs } from './utils.js';
7977

apps/oxlint/test/compile-visitor.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2-
// TODO(camc314): we need to generate `.d.ts` file for this module
3-
// @ts-expect-error
42
import { NODE_TYPE_IDS_MAP } from '../src-js/generated/type_ids.js';
53
import {
64
addVisitorToCompiled,

tasks/ast_tools/src/generators/estree_visit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ impl Generator for ESTreeVisitGenerator {
7878
code: visitor_keys,
7979
},
8080
Output::Javascript {
81-
path: format!("{OXLINT_APP_PATH}/src-js/generated/type_ids.js"),
81+
// This file is also valid as TS
82+
path: format!("{OXLINT_APP_PATH}/src-js/generated/type_ids.ts"),
8283
code: type_ids_map,
8384
},
8485
Output::Javascript {

tasks/ast_tools/src/generators/raw_transfer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ impl Generator for RawTransferGenerator {
8686
code: constants_js.clone(),
8787
},
8888
Output::Javascript {
89-
path: format!("{OXLINT_APP_PATH}/src-js/generated/constants.js"),
89+
// This file is also valid as TS
90+
path: format!("{OXLINT_APP_PATH}/src-js/generated/constants.ts"),
9091
code: constants_js,
9192
},
9293
Output::Rust {

0 commit comments

Comments
 (0)