Skip to content

Commit

Permalink
[Cosmos] Remove tslint usage (#14018)
Browse files Browse the repository at this point in the history
* [Cosmos] Remove tslint usage

* edit
  • Loading branch information
deyaaeldeen authored Mar 1, 2021
1 parent fff7691 commit a02b2c9
Show file tree
Hide file tree
Showing 20 changed files with 9 additions and 120 deletions.
13 changes: 2 additions & 11 deletions sdk/cosmosdb/cosmos/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"plugins": ["@azure/azure-sdk", "@typescript-eslint/tslint"],
"plugins": ["@azure/azure-sdk"],
"extends": ["plugin:@azure/azure-sdk/recommended"],
"parserOptions": {
"createDefaultProgram": true
Expand All @@ -19,15 +19,6 @@
"@azure/azure-sdk/ts-package-json-module": "warn",
"@azure/azure-sdk/ts-doc-internal": "warn",
// https://github.com/benmosher/eslint-plugin-import/issues/1816
"import/no-extraneous-dependencies": "off",
"@typescript-eslint/tslint/config": [
"error",
{
"rules": {
"import-blacklist": [true, "assert", "util"],
"no-floating-promises": true
}
}
]
"import/no-extraneous-dependencies": "off"
}
}
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ available via `npm run-script`:
clean
rimraf lib
lint
tslint --project tsconfig.json
eslint package.json api-extractor.json src samples --ext .ts
format
prettier --write --config .prettierrc.json "src/**/*.ts"
check-format
Expand Down
5 changes: 1 addition & 4 deletions sdk/cosmosdb/cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"build:src": "echo Using TypeScript && tsc --version && tsc -b --pretty",
"build:test": "tsc",
"build:types": "downlevel-dts dist/types/latest dist/types/3.1",
"build": "npm run clean && tslint --project ./tsconfig.json && npm run extract-api && npm run build:types && node writeSDKVersion.js && npm run bundle",
"build": "npm run clean && npm run extract-api && npm run build:types && node writeSDKVersion.js && npm run bundle",
"bundle": "rollup -c",
"bundle-types": "node bundle-types.js",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
Expand Down Expand Up @@ -116,7 +116,6 @@
"@types/tunnel": "^0.0.1",
"@types/underscore": "^1.8.8",
"@types/uuid": "^8.0.0",
"@typescript-eslint/eslint-plugin-tslint": "^4.8.1",
"cross-env": "^7.0.2",
"dotenv": "^8.2.0",
"downlevel-dts": "~0.4.0",
Expand All @@ -135,8 +134,6 @@
"snap-shot-it": "^7.9.1",
"source-map-support": "^0.5.9",
"ts-node": "^8.3.0",
"tslint": "^5.0.0",
"tslint-config-prettier": "^1.14.0",
"typedoc": "0.15.2",
"typescript": "4.1.2"
}
Expand Down
13 changes: 2 additions & 11 deletions sdk/cosmosdb/cosmos/samples/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"plugins": ["@azure/azure-sdk", "@typescript-eslint/tslint"],
"plugins": ["@azure/azure-sdk"],
"extends": ["plugin:@azure/azure-sdk/recommended"],
"parserOptions": {
"createDefaultProgram": true
Expand All @@ -10,15 +10,6 @@
"dot-notation": "off",
"some-rule": "off",
// ChangeFeed.ts has problems with this rule
"no-irregular-whitespace": "off",
"@typescript-eslint/tslint/config": [
"error",
{
"rules": {
"import-blacklist": [true, "assert", "util"],
"no-floating-promises": true
}
}
]
"no-irregular-whitespace": "off"
}
}
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/samples/DatabaseManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { handleError, logStep, logSampleHeader, finish } from "./Shared/handleError";
import { CosmosClient } from "../dist";
import { endpoint, key, database as databaseId } from "./Shared/config";
// eslint-disable-next-line @typescript-eslint/tslint/config
import assert from "assert";

logSampleHeader("Database Management");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// tslint:disable:no-console

import { v4 as guid } from "uuid";
import {
CosmosClient,
Expand Down
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/samples/MultiRegionWrite/Worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { v4 as guid } from "uuid";
import { Container } from "../../dist";

// tslint:disable:no-console
export class Worker {
constructor(private readonly regionName: string, private readonly container: Container) {}

Expand Down
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/samples/MultiRegionWrite/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license.
import { MultiRegionWriteScenario } from "./MultiRegionWriteScenario";

// tslint:disable:no-console
async function run(): Promise<void> {
const scenarios = new MultiRegionWriteScenario();
await scenarios.init();
Expand Down
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/samples/MultiRegionWrite/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const endpoint = process.env["endpoint"];
const key = process.env["key"];

if (!endpoint || !key) {
// tslint:disable-next-line:no-console
console.error("Missing endpoint and key environment variables. Exiting...");
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmosdb/cosmos/src/CosmosClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class CosmosClient {
* Creates a new {@link CosmosClient} object. See {@link CosmosClientOptions} for more details on what options you can use.
* @param options - bag of options; require at least endpoint and auth to be configured
*/
constructor(options: CosmosClientOptions); // tslint:disable-line:unified-signatures
constructor(options: CosmosClientOptions);
constructor(optionsOrConnectionString: string | CosmosClientOptions) {
if (typeof optionsOrConnectionString === "string") {
optionsOrConnectionString = parseConnectionString(optionsOrConnectionString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export class DocumentProducer {
this.continuationToken = undefined;
this.respHeaders = getInitialHeader();

// tslint:disable-next-line:no-shadowed-variable
this.internalExecutionContext = new DefaultQueryExecutionContext(options, this.fetchFunction);
}
/**
Expand Down
2 changes: 0 additions & 2 deletions sdk/cosmosdb/cosmos/src/queryMetrics/runtimeExecutionTimes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,10 @@ export class RuntimeExecutionTimes {
* Output the RuntimeExecutionTimes as a delimited string.
*/
public toDelimitedString(): string {
// tslint:disable-next-line:max-line-length
return (
`${
QueryMetricsConstants.SystemFunctionExecuteTimeInMs
}=${this.systemFunctionExecutionTime.totalMilliseconds()};` +
// tslint:disable-next-line:max-line-length
`${
QueryMetricsConstants.UserDefinedFunctionExecutionTimeInMs
}=${this.userDefinedFunctionExecutionTime.totalMilliseconds()}`
Expand Down
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/src/queryMetrics/timeSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const minMilliSeconds = Number.MIN_SAFE_INTEGER / ticksPerMillisecond;
* @hidden
*/
export class TimeSpan {
// tslint:disable-next-line:variable-name
protected _ticks: number;
constructor(days: number, hours: number, minutes: number, seconds: number, milliseconds: number) {
// Constructor
Expand Down
3 changes: 0 additions & 3 deletions sdk/cosmosdb/cosmos/src/request/defaultAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { Agent } from "http";
*/
export let defaultHttpsAgent: Agent;

// tslint:disable-next-line:no-var-requires
const https = require("https"); // eslint-disable-line @typescript-eslint/no-require-imports
// tslint:disable-next-line:no-var-requires
const tls = require("tls"); // eslint-disable-line @typescript-eslint/no-require-imports

// minVersion only available in Node 10+
Expand All @@ -25,7 +23,6 @@ if (tls.DEFAULT_MIN_VERSION) {
secureProtocol: "TLSv1_2_method"
});
}
// tslint:disable-next-line:no-var-requires
const http = require("http"); // eslint-disable-line @typescript-eslint/no-require-imports
/**
* @internal
Expand Down
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/src/routing/QueryRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export class QueryRange {
this.isMaxInclusive = isMaxInclusive;
}
public overlaps(other: QueryRange): boolean {
// tslint:disable-next-line:no-this-assignment
const range1 = this; // eslint-disable-line @typescript-eslint/no-this-alias
const range2 = other;
if (range1 === undefined || range2 === undefined) {
Expand Down
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/src/utils/globalCrypto.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
// isomorphic-webcrypto is not listed as a dependency in package.json because
// doing so requires adding a bunch of react packages as peer dependencies. So,
// it is being loaded dynamically here to not cause compiler error.
// tslint:disable-next-line:no-var-requires
const globalCrypto = require("isomorphic-webcrypto"); // eslint-disable-line import/no-extraneous-dependencies, @typescript-eslint/no-require-imports
export { globalCrypto };
10 changes: 1 addition & 9 deletions sdk/cosmosdb/cosmos/test/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
"rules": {
"no-console": "off",
"no-invalid-this": "off",
"space-before-function-paren": "off",
"@typescript-eslint/tslint/config": [
"error",
{
"rules": {
"no-implicit-dependencies": [true, "dev"]
}
}
]
"space-before-function-paren": "off"
}
}
35 changes: 0 additions & 35 deletions sdk/cosmosdb/cosmos/test/public/functional/sproc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ describe("NodeJS CRUD Tests", function() {
});

it("nativeApi should do stored procedure operations successfully with create/replace", async function() {
// tslint:disable:no-var-keyword
// tslint:disable:prefer-const
// tslint:disable:curly
// tslint:disable:no-string-throw
// tslint:disable:object-literal-shorthand
const sproc1: StoredProcedureDefinition = {
id: "storedProcedure1",
body: function() {
Expand Down Expand Up @@ -138,12 +133,6 @@ describe("NodeJS CRUD Tests", function() {
}
};

// tslint:enable:no-var-keyword
// tslint:enable:prefer-const
// tslint:enable:curly
// tslint:enable:no-string-throw
// tslint:enable:object-literal-shorthand

const { resource: retrievedSproc } = await container.scripts.storedProcedures.create(sproc1);
const { resource: result } = await container.scripts
.storedProcedure(retrievedSproc.id)
Expand Down Expand Up @@ -178,12 +167,6 @@ describe("NodeJS CRUD Tests", function() {
});
const container = await database.container(containerResult.id);

// tslint:disable:no-var-keyword
// tslint:disable:prefer-const
// tslint:disable:curly
// tslint:disable:no-string-throw
// tslint:disable:no-shadowed-variable
// tslint:disable:object-literal-shorthand
const querySproc = {
id: "querySproc",
body: function() {
Expand All @@ -204,12 +187,6 @@ describe("NodeJS CRUD Tests", function() {
if (!accept) throw "Unable to read player details, abort ";
}
};
// tslint:enable:no-var-keyword
// tslint:enable:prefer-const
// tslint:enable:curly
// tslint:enable:no-string-throw
// tslint:enable:no-shadowed-variable
// tslint:enable:object-literal-shorthand

const documents = [
{ id: "document1" },
Expand Down Expand Up @@ -246,12 +223,6 @@ describe("NodeJS CRUD Tests", function() {
});

const container = await database.container(containerResult.id);

// tslint:disable:curly
// tslint:disable:no-string-throw
// tslint:disable:no-shadowed-variable
// tslint:disable:one-line
// tslint:disable:object-literal-shorthand
const sproc1 = {
id: "storedProcedure",
body: function() {
Expand All @@ -270,12 +241,6 @@ describe("NodeJS CRUD Tests", function() {
}
};

// tslint:enable:curly
// tslint:enable:no-string-throw
// tslint:enable:no-shadowed-variable
// tslint:enable:one-line
// tslint:enable:object-literal-shorthand

const { resource: retrievedSproc } = await container.scripts.storedProcedures.create(sproc1);
const { resource: result1, headers: headers1 } = await container.scripts
.storedProcedure(retrievedSproc.id)
Expand Down
14 changes: 0 additions & 14 deletions sdk/cosmosdb/cosmos/test/public/functional/trigger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@ describe("NodeJS CRUD Tests", function() {

// create a trigger
const beforeCreateTriggersCount = triggers.length;
// tslint:disable:no-var-keyword
// tslint:disable:prefer-const
const triggerDefinition: TriggerDefinition = {
id: "sample trigger",
body: "serverScript() { var x = 10; }",
triggerType: TriggerType.Pre,
triggerOperation: TriggerOperation.All
};
// tslint:enable:no-var-keyword
// tslint:enable:prefer-const

const { resource: trigger } = await container.scripts.triggers.create(triggerDefinition);

Expand Down Expand Up @@ -99,11 +95,6 @@ describe("NodeJS CRUD Tests", function() {
const triggers: TriggerDefinition[] = [
{
id: "t1",
// tslint:disable:no-var-keyword
// tslint:disable:prefer-const
// tslint:disable:curly
// tslint:disable:no-string-throw
// tslint:disable:object-literal-shorthand
body: function() {
const item = getContext()
.getRequest()
Expand Down Expand Up @@ -158,11 +149,6 @@ describe("NodeJS CRUD Tests", function() {
triggerOperation: TriggerOperation.Delete
}
];
// tslint:enable:no-var-keyword
// tslint:enable:prefer-const
// tslint:enable:curly
// tslint:enable:no-string-throw
// tslint:enable:object-literal-shorthand

it("should do trigger operations successfully with create", async function() {
for (const trigger of triggers) {
Expand Down
20 changes: 0 additions & 20 deletions sdk/cosmosdb/cosmos/tslint.json

This file was deleted.

0 comments on commit a02b2c9

Please sign in to comment.