Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ This is the **Microsoft Application Insights JavaScript SDK** - a browser-based

## Code Style & Patterns

### Required Before Each Commit
- Do not commit any changes that are only end-of-file whitespace changes
- Ensure all TypeScript files are formatted and imports are reordered correctly by running `npm run lint-fix` before committing
- This will apply ESLint fixes to all TypeScript files
- It will also reorder imports to maintain consistent style

### TypeScript/JavaScript Conventions
- Use **ES5-compatible** syntax for browser support and target ES5 for modern browsers
- Prefer `function` declarations over arrow functions for better IE compatibility
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { BehaviorEnumValidator, BehaviorMapValidator, BehaviorValueValidator, ClickAnalyticsPlugin } from "./ClickAnalyticsPlugin";
import { IClickAnalyticsConfiguration, IValueCallback, ICustomDataTags, ICoreData, IPageTags, IPageActionTelemetry, IContent, IOverrideValues, IPageActionOverrideValues } from "./Interfaces/Datamodel";
import { Behavior } from "./Behaviours";
import { BehaviorEnumValidator, BehaviorMapValidator, BehaviorValueValidator, ClickAnalyticsPlugin } from "./ClickAnalyticsPlugin";
import {
IClickAnalyticsConfiguration, IContent, ICoreData, ICustomDataTags, IOverrideValues, IPageActionOverrideValues, IPageActionTelemetry,
IPageTags, IValueCallback
} from "./Interfaces/Datamodel";

// Re-export ICustomProperties from core
export { ICustomProperties } from "@microsoft/applicationinsights-core-js";
Expand Down
22 changes: 21 additions & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,23 @@ module.exports = function (grunt) {
}
}
}));

// Additional setup for lint-fix task
function getLintFixTasks() {
let packages = [
"core", "common", "appinsights", "aisku", "aiskulite", "perfmarkmeasure", "properties",
"cfgsync", "deps", "debugplugin", "aichannel", "offlinechannel", "teechannel",
"1dsCore", "1dsPost", "rollupuglify", "rollupes5", "shims", "chrome-debug-extension",
"applicationinsights-web-snippet", "clickanalytics", "osplugin"
];

let tasks = [];
packages.forEach(function(pkg) {
tasks.push("eslint-ts:" + pkg + "-lint-fix");
});

return tasks;
}

grunt.event.on('qunit.testStart', function (name) {
grunt.log.ok('Running test: ' + name);
Expand All @@ -823,8 +840,8 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-copy');

grunt.loadTasks('./tools/grunt-tasks');
grunt.registerTask("default", ["ts:rollupuglify", "ts:rollupes5", "ts:rollupes5test", "qunit:rollupes5", "ts:shims", "ts:shimstest", "qunit:shims", "ts:default", "uglify:ai", "uglify:snippet"]);

grunt.registerTask("default", ["ts:rollupuglify", "ts:rollupes5", "ts:rollupes5test", "qunit:rollupes5", "ts:shims", "ts:shimstest", "qunit:shims", "ts:default", "uglify:ai", "uglify:snippet"]);

grunt.registerTask("core", tsBuildActions("core", true));
grunt.registerTask("core-min", minTasks("core"));
Expand Down Expand Up @@ -964,6 +981,9 @@ module.exports = function (grunt) {
grunt.registerTask("example-aisku", tsBuildActions("example-aisku"));
grunt.registerTask("example-dependency", tsBuildActions("example-dependency"));
grunt.registerTask("example-cfgsync", tsBuildActions("example-cfgsync"));

// Register the lint-fix task to run ESLint fix on all packages
grunt.registerTask("lint-fix", getLintFixTasks());
} catch (e) {
console.error(e);
console.error("stack: '" + e.stack + "', message: '" + e.message + "', name: '" + e.name + "'");
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"test": "node common/scripts/install-run-rush.js test --verbose",
"mintest": "node common/scripts/install-run-rush.js mintest --verbose",
"lint": "node common/scripts/install-run-rush.js lint --verbose",
"lint-fix": "npm run ai-restore && grunt lint-fix",
"perftest": "node common/scripts/install-run-rush.js perftest --verbose",
"rollupes5": "grunt rollupes5",
"rupdate": "node common/scripts/install-run-rush.js update --recheck --purge --full",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ export interface IConfiguration {
* [Optional] An array of the page unload events that you would like to be ignored, special note there must be at least one valid unload
* event hooked, if you list all or the runtime environment only supports a listed "disabled" event it will still be hooked, if required by the SDK.
* Unload events include "beforeunload", "unload", "visibilitychange" (with 'hidden' state) and "pagehide".
*
*
* This can be used to avoid jQuery 3.7.1+ deprecation warnings and Chrome warnings about the unload event:
* @example
* ```javascript
* {
* disablePageUnloadEvents: ["unload"]
* }
* ```
*
*
* For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
*/
disablePageUnloadEvents?: string[];
Expand All @@ -174,14 +174,14 @@ export interface IConfiguration {
* [Optional] An array of page show events that you would like to be ignored, special note there must be at lease one valid show event
* hooked, if you list all or the runtime environment only supports a listed (disabled) event it will STILL be hooked, if required by the SDK.
* Page Show events include "pageshow" and "visibilitychange" (with 'visible' state).
*
*
* @example
* ```javascript
* {
* disablePageShowEvents: ["pageshow"]
* }
* ```
*
*
* For more details, see the [Page Unload Events documentation](https://microsoft.github.io/ApplicationInsights-JS/PageUnloadEvents.html).
*/
disablePageShowEvents?: string[];
Expand Down