Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable EsLint auto fixing rules for extra-semicolons, dangling commas and tailing spaces #1669

Merged
merged 1 commit into from
Sep 14, 2021
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
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"no-case-declarations": "off",
"no-prototype-builtins": "off",
"no-useless-escape": "off", // Suppressing Error -- need to Review Later
"no-trailing-spaces": [ "warn", { "skipBlankLines": true }],// Enabled for auto fixing
"no-const-assign": "error",
"comma-dangle": [ "warn", "never" ], // Enabled for auto fixing
"security/detect-object-injection": "off", // Suppress Warning -- need to Review Later
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unused-vars": "off", // Re-enable for auto fixing
Expand All @@ -31,7 +34,7 @@
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-extra-semi": "off", // Re-enable for auto fixing
"@typescript-eslint/no-extra-semi": "warn", // Enabled for auto fixing
"@typescript-eslint/no-non-null-assertion": "error"
}
}
2 changes: 1 addition & 1 deletion AISKU/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"grunt-cli": "^1.4.3",
"grunt-contrib-qunit": "^5.0.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"@nevware21/grunt-eslint-ts": "^0.2.1",
"@nevware21/grunt-eslint-ts": "^0.2.2",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to consume the update to enable automatic eslint rule "fixing"

"globby": "^11.0.0",
"magic-string": "^0.25.7",
"pako": "^2.0.3",
Expand Down
6 changes: 3 additions & 3 deletions AISKU/src/Initialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let _internalSdkSrc: string;
// This is an exclude list of properties that should not be updated during initialization
// They include a combination of private and internal property names
const _ignoreUpdateSnippetProperties = [
"snippet", "dependencies", "properties", "_snippetVersion", "appInsightsNew", "getSKUDefaults",
"snippet", "dependencies", "properties", "_snippetVersion", "appInsightsNew", "getSKUDefaults"
];

/**
Expand All @@ -50,7 +50,7 @@ export interface IApplicationInsights extends IAppInsights, IDependenciesPlugin,
getSender: () => Sender;
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string, storeInCookie?: boolean): void;
clearAuthenticatedUserContext(): void;
};
}

// Re-exposing the Common classes as Telemetry, the list was taken by reviewing the generated code for the build while using
// the previous configuration :-
Expand Down Expand Up @@ -157,7 +157,7 @@ export class Initialization implements IApplicationInsights {
*/
public getCookieMgr(): ICookieMgr {
return this.appInsights.getCookieMgr();
};
}

/**
* Log a user action or other occurrence.
Expand Down
2 changes: 1 addition & 1 deletion AISKULight/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class ApplicationInsights {
}

private getSKUDefaults() {
this.config.diagnosticLogInterval =
this.config.diagnosticLogInterval =
this.config.diagnosticLogInterval && this.config.diagnosticLogInterval > 0 ? this.config.diagnosticLogInterval : 10000;
}
}
Expand Down
2 changes: 1 addition & 1 deletion AISKULight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"grunt-contrib-qunit": "^5.0.1",
"grunt-run": "^0.8.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"@nevware21/grunt-eslint-ts": "^0.2.1",
"@nevware21/grunt-eslint-ts": "^0.2.2",
"globby": "^11.0.0",
"magic-string": "^0.25.7",
"@rollup/plugin-commonjs": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion channels/applicationinsights-channel-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"grunt-cli": "^1.4.3",
"grunt-run": "^0.8.1",
"@nevware21/grunt-ts-plugin": "^0.4.3",
"@nevware21/grunt-eslint-ts": "^0.2.1",
"@nevware21/grunt-eslint-ts": "^0.2.2",
"globby": "^11.0.0",
"magic-string": "^0.25.7",
"@rollup/plugin-commonjs": "^18.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
IPageViewPerformanceTelemetry, CtxTagKeys,
HttpMethod, IPageViewTelemetryInternal, IWeb,
IExceptionInternal,
SampleRate,
SampleRate
} from '@microsoft/applicationinsights-common';
import {
ITelemetryItem, IDiagnosticLogger, LoggingSeverity, _InternalMessageId, hasJSON, getJSON, objForEachKey,
ITelemetryItem, IDiagnosticLogger, LoggingSeverity, _InternalMessageId, hasJSON, getJSON, objForEachKey,
isNullOrUndefined, isNumber, isString, toISOString, setValue, isTruthy, optimizeObject
} from '@microsoft/applicationinsights-core-js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export class SessionStorageSendBuffer extends BaseSendBuffer implements ISendBuf
};

_self.markAsSent = (payload: string[]) => {
_setBuffer(SessionStorageSendBuffer.BUFFER_KEY,
_setBuffer(SessionStorageSendBuffer.BUFFER_KEY,
_self._set(_removePayloadsFromBuffer(payload, _self._get())));

let sentElements = _getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);
Expand Down
12 changes: 6 additions & 6 deletions channels/applicationinsights-channel-js/src/Sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function _getDefaultAppInsightsChannelConfig(): ISenderConfig {
namePrefix: () => undefined,
samplingPercentage: () => 100,
customHeaders: () => undefined,
convertUndefined: () => undefined,
convertUndefined: () => undefined
}
}

Expand Down Expand Up @@ -774,8 +774,8 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
}

/**
* The Promise returned from fetch() won’t reject on HTTP error status even if the response is an HTTP 404 or 500.
* Instead, it will resolve normally (with ok status set to false), and it will only reject on network failure
* The Promise returned from fetch() won’t reject on HTTP error status even if the response is an HTTP 404 or 500.
* Instead, it will resolve normally (with ok status set to false), and it will only reject on network failure
* or if anything prevented the request from completing.
*/
if (!response.ok) {
Expand Down Expand Up @@ -846,7 +846,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
_setupTimer();
}

/**
/**
* Calculates the time to wait before retrying in case of an error based on
* http://en.wikipedia.org/wiki/Exponential_backoff
*/
Expand Down Expand Up @@ -979,7 +979,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {

/**
* Validate UUID Format
* Specs taken from https://tools.ietf.org/html/rfc4122 and breeze repo
* Specs taken from https://tools.ietf.org/html/rfc4122 and breeze repo
*/
function _validateInstrumentationKey(config: IConfiguration & IConfig) :boolean {
const disableIKeyValidationFlag = isNullOrUndefined(config.disableInstrumentationKeyValidation) ? false : config.disableInstrumentationKeyValidation;
Expand All @@ -989,7 +989,7 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
const UUID_Regex = '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$';
const regexp = new RegExp(UUID_Regex);
return regexp.test(config.instrumentationKey);
}
}

});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ISerializable, FieldType } from '@microsoft/applicationinsights-common';
import {
import {
IDiagnosticLogger, LoggingSeverity, _InternalMessageId, getJSON, objForEachKey, isFunction, isObject, isArray
} from '@microsoft/applicationinsights-core-js';
import dynamicProto from '@microsoft/dynamicproto-js'
Expand Down
4 changes: 2 additions & 2 deletions common/Tests/Framework/src/AITestClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class AITestClass {

const steps = testInfo.steps;
const trigger = () => {
// The callback which activates the next test step.
// The callback which activates the next test step.
let nextTestStepTrigger = () => {
AITestClass.orgSetTimeout(() => {
trigger();
Expand Down Expand Up @@ -378,7 +378,7 @@ export class AITestClass {

/**** end: Sinon methods and properties ***/

/**
/**
* Sends a JSON response to the provided request.
* @param request The request to respond to.
* @param data Data to respond with.
Expand Down
60 changes: 30 additions & 30 deletions common/Tests/Framework/src/Assert.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/// <reference path="../../External/qunit.d.ts" />

/**
/**
* Wrapper around QUnit asserts. This class has two purposes:
* - Make Assertion methods easy to discover.
* - Make them consistent with XUnit assertions in the order of the actual and expected parameter values.
*/
export class Assert {
/**
* A deep recursive comparison assertion, working on primitive types, arrays, objects,
* A deep recursive comparison assertion, working on primitive types, arrays, objects,
* regular expressions, dates and functions.
*
* The deepEqual() assertion can be used just like equal() when comparing the value of
* objects, such that { key: value } is equal to { key: value }. For non-scalar values,
* The deepEqual() assertion can be used just like equal() when comparing the value of
* objects, such that { key: value } is equal to { key: value }. For non-scalar values,
* identity will be disregarded by deepEqual.
*
* @param expected Known comparison value
Expand All @@ -22,14 +22,14 @@ export class Assert {
return QUnit.assert.deepEqual(actual, expected, message);
}

/**
/**
* A non-strict comparison assertion, roughly equivalent to JUnit assertEquals.
*
* The equal assertion uses the simple comparison operator (==) to compare the actual
* and expected arguments. When they are equal, the assertion passes: any; otherwise, it fails.
* When it fails, both actual and expected values are displayed in the test result,
* The equal assertion uses the simple comparison operator (==) to compare the actual
* and expected arguments. When they are equal, the assertion passes: any; otherwise, it fails.
* When it fails, both actual and expected values are displayed in the test result,
* in addition to a given message.
*
*
* @param expected Known comparison value
* @param actual Expression being tested
* @param message A short description of the assertion
Expand All @@ -39,13 +39,13 @@ export class Assert {
}

/**
* An inverted deep recursive comparison assertion, working on primitive types,
* An inverted deep recursive comparison assertion, working on primitive types,
* arrays, objects, regular expressions, dates and functions.
*
* The notDeepEqual() assertion can be used just like equal() when comparing the
* value of objects, such that { key: value } is equal to { key: value }. For non-scalar
* The notDeepEqual() assertion can be used just like equal() when comparing the
* value of objects, such that { key: value } is equal to { key: value }. For non-scalar
* values, identity will be disregarded by notDeepEqual.
*
*
* @param expected Known comparison value
* @param actual Object or Expression being tested
* @param message A short description of the assertion
Expand All @@ -57,11 +57,11 @@ export class Assert {
/**
* A non-strict comparison assertion, checking for inequality.
*
* The notEqual assertion uses the simple inverted comparison operator (!=) to compare
* the actual and expected arguments. When they aren't equal, the assertion passes: any;
* otherwise, it fails. When it fails, both actual and expected values are displayed
* The notEqual assertion uses the simple inverted comparison operator (!=) to compare
* the actual and expected arguments. When they aren't equal, the assertion passes: any;
* otherwise, it fails. When it fails, both actual and expected values are displayed
* in the test result, in addition to a given message.
*
*
* @param expected Known comparison value
* @param actual Expression being tested
* @param message A short description of the assertion
Expand All @@ -81,11 +81,11 @@ export class Assert {
/**
* A non-strict comparison assertion, checking for inequality.
*
* The notStrictEqual assertion uses the strict inverted comparison operator (!==)
* to compare the actual and expected arguments. When they aren't equal, the assertion
* passes: any; otherwise, it fails. When it fails, both actual and expected values are
* The notStrictEqual assertion uses the strict inverted comparison operator (!==)
* to compare the actual and expected arguments. When they aren't equal, the assertion
* passes: any; otherwise, it fails. When it fails, both actual and expected values are
* displayed in the test result, in addition to a given message.
*
*
* @param expected Known comparison value
* @param actual Expression being tested
* @param message A short description of the assertion
Expand All @@ -95,13 +95,13 @@ export class Assert {
}

/**
* A boolean assertion, equivalent to CommonJS's assert.ok() and JUnit's assertTrue().
* A boolean assertion, equivalent to CommonJS's assert.ok() and JUnit's assertTrue().
* Passes if the first argument is truthy.
*
* The most basic assertion in QUnit, ok() requires just one argument. If the argument
* evaluates to true, the assertion passes; otherwise, it fails. If a second message
* The most basic assertion in QUnit, ok() requires just one argument. If the argument
* evaluates to true, the assertion passes; otherwise, it fails. If a second message
* argument is provided, it will be displayed in place of the result.
*
*
* @param state Expression being tested
* @param message A short description of the assertion
*/
Expand All @@ -112,9 +112,9 @@ export class Assert {
/**
* A strict type and value comparison assertion.
*
* The strictEqual() assertion provides the most rigid comparison of type and value with
* The strictEqual() assertion provides the most rigid comparison of type and value with
* the strict equality operator (===)
*
*
* @param expected Known comparison value
* @param actual Expression being tested
* @param message A short description of the assertion
Expand All @@ -125,10 +125,10 @@ export class Assert {

/**
* Assertion to test if a callback throws an exception when run.
*
* When testing code that is expected to throw an exception based on a specific set of
*
* When testing code that is expected to throw an exception based on a specific set of
* circumstances, use throws() to catch the error object for testing and comparison.
*
*
* @param block Function to execute
* @param expected Error Object to compare
* @param message A short description of the assertion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class CommonValidator implements ITypeValidator {
// verify item has data, iKey, name, tags, and time fields
if (!item.data || !item.iKey || !item.name || !item.tags || !item.time) {
return false;
};
}

if (item.data.baseData.ver !== 2) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export class EventValidator implements ITypeValidator {
}

// verify item has ver, name, properties, and measurement fields
if (!item.data.baseData ||
!item.data.baseData.ver ||
!item.data.baseData.name ||
!item.data.baseData.properties ||
if (!item.data.baseData ||
!item.data.baseData.ver ||
!item.data.baseData.name ||
!item.data.baseData.properties ||
!item.data.baseData.measurements) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export class MetricValidator implements ITypeValidator {
}

// verify item has ver, metrics, and properties fields
if (!item.data.baseData ||
!item.data.baseData.ver ||
!item.data.baseData.metrics ||
if (!item.data.baseData ||
!item.data.baseData.ver ||
!item.data.baseData.metrics ||
!item.data.baseData.properties) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export class PageViewPerformanceValidator implements ITypeValidator {
}

// verify item has ver, url, perfTotal, name, duration, networkConnect, sentRequest, receivedResponse, and domProcessing fields
if (!item.data.baseData ||
!item.data.baseData.ver ||
!item.data.baseData.url ||
if (!item.data.baseData ||
!item.data.baseData.ver ||
!item.data.baseData.url ||
!item.data.baseData.perfTotal ||
!item.data.baseData.name ||
!item.data.baseData.duration ||
!item.data.baseData.networkConnect ||
!item.data.baseData.sentRequest ||
!item.data.baseData.receivedResponse ||
!item.data.baseData.duration ||
!item.data.baseData.networkConnect ||
!item.data.baseData.sentRequest ||
!item.data.baseData.receivedResponse ||
!item.data.baseData.domProcessing) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export class PageViewValidator implements ITypeValidator {
}

// verify item has ver, url, name, duration, id, properties, and measurements fields
if (!item.data.baseData ||
!item.data.baseData.ver ||
!item.data.baseData.url ||
if (!item.data.baseData ||
!item.data.baseData.ver ||
!item.data.baseData.url ||
!item.data.baseData.name ||
!item.data.baseData.duration ||
!item.data.baseData.id ||
!item.data.baseData.properties ||
!item.data.baseData.duration ||
!item.data.baseData.id ||
!item.data.baseData.properties ||
!item.data.baseData.measurements) {
return false;
}
Expand Down
Loading