This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch js-to-ts
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a1242bd80e9ad49676b512af0b6867466d531699
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Sun Sep 7 14:49:57 2025 -0700

    feat(migration): improve js-to-ts command and migrate 
timeGrainSqlaAnimationOverrides
    
    Script improvements:
    - Add ESLint validation step for each migrated file
    - Clarify TypeScript compilation commands for per-file validation
    - Update success report format to include validation steps
    
    Migration completed:
    - Convert timeGrainSqlaAnimationOverrides.js to TypeScript
    - Add proper ControlPanelState and Dataset types from 
@superset-ui/chart-controls
    - Implement TimeGrainOverrideState interface for return type
    - Use type guards and proper casting for type safety
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <[email protected]>
---
 .claude/commands/js-to-ts.md                            | 15 ++++++++++-----
 ...nOverrides.js => timeGrainSqlaAnimationOverrides.ts} | 17 +++++++++++++----
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/.claude/commands/js-to-ts.md b/.claude/commands/js-to-ts.md
index ff9c0ab36a..c34726faaf 100644
--- a/.claude/commands/js-to-ts.md
+++ b/.claude/commands/js-to-ts.md
@@ -73,11 +73,13 @@ SUCCESS: Atomic Migration of {core-filename}
 - NO_DOCUMENTATION: {TypeName} - {reason}
 
 ## Quality Validation
-- File-level TypeScript compilation: ✅ PASS  
+- File-level TypeScript compilation: ✅ PASS (using `npx tscw --noEmit 
--allowJs --composite false --project tsconfig.json {files}`)
+- ESLint validation: ✅ PASS (using `npm run eslint -- {files}`)
 - Zero any types: ✅ PASS
 - Local imports resolved: ✅ PASS
 - Functionality preserved: ✅ PASS
 - Tests pass (if test file): ✅ PASS
+- Project-wide compilation note: {PASS/ISSUES-UNRELATED/ISSUES-RELATED} (from 
`npm run type`)
 - Coordinator action required: {YES/NO}
 
 ## Migration Learnings
@@ -110,10 +112,13 @@ DEPENDENCY_BLOCK: Cannot migrate {filename}
 1. **Use git mv** - Run `git mv file.js file.ts` to preserve git history, but 
NO `git commit`
 2. **NO global import changes** - Don't update imports across codebase
 3. **Type files OK** - Can modify existing type files to improve/align types
-4. **Targeted validation** - Run `tsc --noEmit` on modified files only
-5. Zero `any` types - use proper TypeScript types
-6. Search existing types before creating new ones
-7. Follow patterns from INSTRUCTIONS.md
+4. **TypeScript validation** - Use proper TypeScript compilation commands:
+   - **Per-file validation**: `cd superset-frontend && npx tscw --noEmit 
--allowJs --composite false --project tsconfig.json {relative-path-to-file}`
+   - **Project-wide scan**: `npm run type` (only consider errors related to 
your files - other agents may be working in parallel)
+5. **ESLint validation** - Run `npm run eslint -- {file}` for each migrated 
file to ensure formatting/linting
+6. Zero `any` types - use proper TypeScript types
+7. Search existing types before creating new ones
+8. Follow patterns from INSTRUCTIONS.md
 
 ---
 
diff --git 
a/superset-frontend/src/explore/controlPanels/timeGrainSqlaAnimationOverrides.js
 
b/superset-frontend/src/explore/controlPanels/timeGrainSqlaAnimationOverrides.ts
similarity index 64%
rename from 
superset-frontend/src/explore/controlPanels/timeGrainSqlaAnimationOverrides.js
rename to 
superset-frontend/src/explore/controlPanels/timeGrainSqlaAnimationOverrides.ts
index b7338e10cf..1aef2dbf67 100644
--- 
a/superset-frontend/src/explore/controlPanels/timeGrainSqlaAnimationOverrides.js
+++ 
b/superset-frontend/src/explore/controlPanels/timeGrainSqlaAnimationOverrides.ts
@@ -16,11 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+import type { ControlPanelState, Dataset } from '@superset-ui/chart-controls';
+
+interface TimeGrainOverrideState {
+  choices: [string, string][] | null;
+}
+
 export default {
   default: null,
-  mapStateToProps: state => ({
-    choices: state.datasource
-      ? state.datasource.time_grain_sqla.filter(o => o[0] !== null)
-      : null,
+  mapStateToProps: (state: ControlPanelState): TimeGrainOverrideState => ({
+    choices:
+      state.datasource && 'time_grain_sqla' in state.datasource
+        ? ((state.datasource as Dataset).time_grain_sqla?.filter(
+            (o: [string, string]) => o[0] !== null,
+          ) ?? null)
+        : null,
   }),
 };

Reply via email to