Conversation
45dd4ee to
324c1f9
Compare
There was a problem hiding this comment.
Pull request overview
This pull request migrates the frontend codebase from CommonJS to ECMAScript Modules (ESM). The migration involves updating package.json to declare the module type, converting all require/module.exports statements to import/export syntax, and updating file references in configuration files.
Changes:
- Added
"type": "module"to package.json files to enable ESM - Converted all script files from CommonJS require/module.exports to ESM import/export syntax
- Updated builder files (dev.js, prod.js, esbuild-relay.js) to use ESM imports
- Updated ESLint plugin files to use ESM exports
- Renamed vite.config.mts to vite.config.ts and updated references
- Updated eslint.config.js reference from .mjs to .js extension
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 28 comments.
Show a summary per file
| File | Description |
|---|---|
| opencti-platform/opencti-front/package.json | Added "type": "module" field and updated eslint.config reference from .mjs to .js |
| opencti-platform/opencti-front/vite.config.ts | New Vite configuration file with ESM syntax (converted from .mts) |
| opencti-platform/opencti-front/tsconfig.node.json | Updated reference from vite.config.mts to vite.config.ts |
| opencti-platform/opencti-front/eslint.config.js | Updated vite.config reference from .mts to .ts |
| opencti-platform/opencti-front/script/verify-translation.js | Converted from CommonJS to ESM with top-level await |
| opencti-platform/opencti-front/script/sort-translation-files.js | Converted from CommonJS to ESM with async/await pattern |
| opencti-platform/opencti-front/script/extract-label-keyword.js | Converted from CommonJS to ESM with top-level await |
| opencti-platform/opencti-front/script/extract-i18n-keyword.js | Converted from CommonJS to ESM with top-level await |
| opencti-platform/opencti-front/script/auto-translate.js | Converted from CommonJS to ESM with top-level await |
| opencti-platform/opencti-front/builder/prod/prod.js | Converted builder script to use ESM imports |
| opencti-platform/opencti-front/builder/dev/dev.js | Converted dev server to use ESM imports |
| opencti-platform/opencti-front/builder/plugin/esbuild-relay.js | Converted plugin imports to ESM (partial conversion) |
| opencti-platform/opencti-front/packages/eslint-plugin-custom-rules/package.json | Added "type": "module" to enable ESM |
| opencti-platform/opencti-front/packages/eslint-plugin-custom-rules/lib/index.js | Converted to ESM export syntax |
| opencti-platform/opencti-front/packages/eslint-plugin-custom-rules/lib/rules/classes-rule.js | Converted to ESM export default syntax |
| opencti-platform/opencti-front/packages/eslint-plugin-custom-rules/tests/lib/rules/classes-rule.test.js | Converted to ESM import syntax |
| .github/copilot-instructions.md | Updated documentation references from .mjs to .js |
Comments suppressed due to low confidence (1)
opencti-platform/opencti-front/script/extract-i18n-keyword.js:37
- Avoid automated semicolon insertion (90% of all statements in the enclosing function have an explicit semicolon).
})
| sortedJSON[key] = json[key]; | ||
| }); | ||
| return sortedJSON; | ||
| } |
There was a problem hiding this comment.
Missing semicolon at the end of the statement. For consistency with the rest of the codebase, add a semicolon after the closing brace.
opencti-platform/opencti-front/packages/eslint-plugin-custom-rules/lib/index.js
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-front/packages/eslint-plugin-custom-rules/lib/rules/classes-rule.js
Show resolved
Hide resolved
...tform/opencti-front/packages/eslint-plugin-custom-rules/tests/lib/rules/classes-rule.test.js
Outdated
Show resolved
Hide resolved
2c2c685 to
ab3f2b5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 18 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (3)
opencti-platform/opencti-front/script/sort-translation-files.js:22
- The code references
fs.writeFileSyncbutfsis not imported. The file importsreadFileandreaddirfrom 'node:fs/promises' but needs to also importwriteFileto use the async API consistently. Changefs.writeFileSync(...)toawait writeFile(...)and update the import statement to includewriteFile.
fs.writeFileSync(filePath, JSON.stringify(sortedJSON, null, 2));
opencti-platform/opencti-front/eslint.config.js:66
- The custom-rules plugin export structure appears incorrect. ESLint plugins should export an object with a
rulesproperty, but here you're wrapping the importedcustomRules(which should already be the rules object) in another object with arulesproperty. Based on the updated lib/index.js which exports a plain object mapping rule names to rule implementations, this line should be'custom-rules': customRulesinstead.
opencti-platform/opencti-front/script/extract-i18n-keyword.js:37 - Avoid automated semicolon insertion (90% of all statements in the enclosing function have an explicit semicolon).
})
opencti-platform/opencti-front/script/sort-translation-files.js
Outdated
Show resolved
Hide resolved
...tform/opencti-front/packages/eslint-plugin-custom-rules/tests/lib/rules/classes-rule.test.js
Outdated
Show resolved
Hide resolved
73624fb to
f865fe0
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #14045 +/- ##
=======================================
Coverage 32.36% 32.36%
=======================================
Files 3096 3096
Lines 210891 210891
Branches 38200 38200
=======================================
Hits 68263 68263
Misses 142628 142628
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Proposed changes
Related issues
Checklist