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

[#IP-86] tslint to eslint migration #14

Merged
merged 24 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .devops/code-review-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ stages:
displayName: 'Unit tests exec'

- bash: |
bash <(curl -s https://codecov.io/bash)
bash <(curl -s https://codecov.bash)
michaeldisaro marked this conversation as resolved.
Show resolved Hide resolved
displayName: 'Code coverage'
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Never lint node_modules
michaeldisaro marked this conversation as resolved.
Show resolved Hide resolved
node_modules

# We shouldn't lint assets nor generated files
generated

**/__tests__/*
**/__mocks__/*
Dangerfile.*
michaeldisaro marked this conversation as resolved.
Show resolved Hide resolved
37 changes: 37 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"ignorePatterns": [
"node_modules",
"generated",
"**/__tests__/*",
"**/__mocks__/*",
"Dangerfile.*",
"*.d.ts"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"extends": [
"@pagopa/eslint-config/strong",
],
"rules": {
"prefer-arrow/prefer-arrow-functions": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"no-invalid-this": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-explicit-any":"off",
"id-blacklist":"off",
"@typescript-eslint/ban-types":"off",
"sort-keys":"off",
"no-underscore-dangle":"off",
"functional/prefer-readonly-type":"off",
"@typescript-eslint/dot-notation": "off"
}
}
michaeldisaro marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ generated
*.zip

*.js
!.eslintrc.js
michaeldisaro marked this conversation as resolved.
Show resolved Hide resolved
!jest.config.js
!.release-it.js


azure-functions-core-tools

# Exclude ESLint cache file
.eslintcache
2 changes: 1 addition & 1 deletion Dangerfile.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// import custom DangerJS rules
// see http://danger.systems/js
// see https://github.com/teamdigitale/danger-plugin-digitalcitizenship/
// tslint:disable-next-line:prettier
// eslint-disable-next-line
import checkDangers from "@pagopa/danger-custom-rules";

checkDangers();
4 changes: 2 additions & 2 deletions HandleNHNotificationCall/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// tslint:disable:no-any
// eslint-disable @typescript-eslint/no-explicit-any

import * as df from "durable-functions";
import { DurableOrchestrationClient } from "durable-functions/lib/src/durableorchestrationclient";
Expand Down Expand Up @@ -92,7 +92,7 @@ describe("HandleNHNotificationCall", () => {
// kind: "WrongMessage" as any
// };

// // tslint:disable-next-line: no-let
// // eslint-disable-next-line
// let hasError = false;
// try {
// await HandleNHNotificationCall(context as any, aWrongMessage);
Expand Down
4 changes: 2 additions & 2 deletions HandleNHNotificationCallActivity/__tests__/handler.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* tslint:disable: no-any */
// tslint:disable-next-line: no-object-mutation
/* eslint-disable @typescript-eslint/no-explicit-any */
// eslint-disable-next-line
michaeldisaro marked this conversation as resolved.
Show resolved Hide resolved
import { NonEmptyString } from "italia-ts-commons/lib/strings";
import { context as contextMock } from "../../__mocks__/durable-functions";
import { PlatformEnum } from "../../generated/backend/Platform";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* tslint:disable:no-any */
// tslint:disable-next-line: no-object-mutation
/* eslint-disable @typescript-eslint/no-explicit-any */
// eslint-disable-next-line
michaeldisaro marked this conversation as resolved.
Show resolved Hide resolved
import { NonEmptyString } from "italia-ts-commons/lib/strings";
import { context as contextMock } from "../../__mocks__/durable-functions";
import { PlatformEnum } from "../../generated/backend/Platform";
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"dev": "npm-run-all --parallel start watch",
"test": "jest",
"test:coverage": "jest --coverage",
"lint": "tslint -p .",
"lint": "eslint . -c .eslintrc.js --ext .ts,.tsx",
"lint-autofix": "eslint . -c .eslintrc.js --ext .ts,.tsx --fix",
michaeldisaro marked this conversation as resolved.
Show resolved Hide resolved
"generate": "npm-run-all generate:backend:*",
"generate:backend:api-models": "shx rm -rf generated/backend && shx mkdir -p generated/backend && gen-api-models --strict 0 --api-spec https://raw.githubusercontent.com/pagopa/io-backend/master/api_backend.yaml --out-dir generated/backend",
"generate:backend:notification-models": "shx rm -rf generated/notifications && shx mkdir -p generated/notifications && gen-api-models --strict 0 --api-spec https://raw.githubusercontent.com/pagopa/io-backend/master/api_notifications.yaml --out-dir generated/notifications",
Expand All @@ -44,6 +45,7 @@
},
"devDependencies": {
"@azure/functions": "^1.2.2",
"@pagopa/eslint-config": "^1.1.1",
"@pagopa/danger-custom-rules": "^2.0.3",
"@types/azure-sb": "^0.0.38",
"@types/express": "^4.17.9",
Expand All @@ -54,7 +56,7 @@
"danger": "^10.3.0",
"dependency-check": "^4.1.0",
"dotenv-cli": "^3.1.0",
"italia-tslint-rules": "*",
"eslint-plugin-prettier": "^3.3.1",
"italia-utils": "^6.2.2",
"jest": "^24.8.0",
"jest-mock-express": "^0.1.1",
Expand All @@ -64,7 +66,6 @@
"prettier": "^1.18.2",
"shx": "^0.3.2",
"ts-jest": "^24.0.2",
"tslint": "^5.17.0",
"typescript": "^4.1.2"
},
"resolutions": {
Expand Down
11 changes: 0 additions & 11 deletions tslint.json

This file was deleted.

3 changes: 2 additions & 1 deletion utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ export const IConfig = t.interface({
AZURE_NH_ENDPOINT: NonEmptyString,
AZURE_NH_HUB_NAME: NonEmptyString,

AzureWebJobsStorage: NonEmptyString,

COSMOSDB_KEY: NonEmptyString,
COSMOSDB_NAME: NonEmptyString,
COSMOSDB_URI: NonEmptyString,

AzureWebJobsStorage: NonEmptyString,
QueueStorageConnection: NonEmptyString,

isProduction: t.boolean
Expand Down
1 change: 0 additions & 1 deletion utils/healthcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export const checkApplicationHealth = (): HealthCheck<ProblemSource, true> =>
// TODO: once we upgrade to fp-ts >= 1.19 we can use Validation to collect all errors, not just the first to happen
sequenceT(taskEither)<
ReadonlyArray<HealthProblem<ProblemSource>>,
// tslint:disable readonly-array beacuse the following is actually mutable
Array<TaskEither<ReadonlyArray<HealthProblem<ProblemSource>>, true>>
>(
// checkAzureCosmosDbHealth(config.COSMOSDB_URI, config.COSMOSDB_KEY),
Expand Down
9 changes: 5 additions & 4 deletions utils/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ class ExtendedNotificationHubService extends NotificationHubService {
constructor(hubName: string, endpointOrConnectionString: string) {
super(hubName, endpointOrConnectionString, "", "");
}
// tslint:disable-next-line: typedef

public _buildRequestOptions(
webResource: unknown,
body: unknown,
options: unknown,
// tslint:disable-next-line: ban-types
// eslint-disable-next-line @typescript-eslint/ban-types
cb: Function
) {
// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const patchedCallback = (err: any, cbOptions: any) => {
cb(err, {
...cbOptions,
agent: httpsAgent
});
};
// tslint:disable-next-line: no-string-literal no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return super["_buildRequestOptions"](
webResource,
body,
Expand Down Expand Up @@ -146,6 +146,7 @@ const successNH = () =>
kind: "SUCCESS"
});

/* eslint-disable arrow-body-style */
export const notify = (
installationId: NonEmptyString,
payload: NotifyPayload
Expand Down
Loading