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

[#174416949] Replace tslint with eslint #752

Merged
merged 13 commits into from
Jan 22, 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
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
node_modules

# We shouldn't lint assets nor generated files
generated

**/__tests__/*
**/__mocks__/*
Comment on lines +7 to +8
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't use eslint on those files as well? I mean: I see the point of not having such files to block a build, but also I'd like to enforce code conventions on test code (and, to use prettier)

Copy link
Contributor Author

@BurnedMarshal BurnedMarshal Jan 12, 2021

Choose a reason for hiding this comment

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

I like the idea. But enable the linter on these files generate 330 problems because tslint was previously disabled on mocks and tests.

Dangerfile.*
29 changes: 29 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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"
}
};
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ npm-debug.log

# Exclude typescript generated javascript files.
*.js
!.eslintrc.js
!.release-it.js
*.js.map

Expand All @@ -44,3 +45,6 @@ local.*

# Exclude Codetour plugin folder
.tours

# Exclude ESLint cache file
.eslintcache
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build": "tsc",
"build-noemit": "tsc --noEmit",
"hot-reload": "nodemon --legacy-watch --watch ./src --inspect=0.0.0.0:5859 --nolazy src/server.js",
"lint": "tslint -p . -c tslint.json -t verbose",
"lint-autofix": "tslint -p . -c tslint.json -t verbose --fix",
"lint": "eslint . -c .eslintrc.js --ext .ts,.tsx --cache",
"lint-autofix": "eslint . -c .eslintrc.js --ext .ts,.tsx --fix",
"prettify": "prettier --write \"./**/*.ts\"",
"test": "jest -i",
"test:coverage": "dotenv -e .env.example -- jest -i --coverage",
Expand Down Expand Up @@ -89,6 +89,7 @@
"xmldom": "^0.1.27"
},
"devDependencies": {
"@pagopa/eslint-config": "^1.1.1",
"@types/apicache": "^1.2.0",
"@types/dotenv": "^4.0.2",
"@types/express": "4.16.0",
Expand Down Expand Up @@ -119,7 +120,7 @@
"danger": "^4.0.2",
"danger-plugin-digitalcitizenship": "^0.3.1",
"dotenv-cli": "^3.1.0",
"italia-tslint-rules": "^1.1.3",
"eslint-plugin-prettier": "^3.3.1",
"italia-utils": "^6.3.0",
"jest": "^23.6.0",
"lolex": "4.2.0",
Expand All @@ -136,7 +137,6 @@
"swagger-parser": "^5.0.5",
"ts-jest": "^23.10.4",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"typescript": "^3.6.2"
},
"jest": {
Expand Down
1 change: 0 additions & 1 deletion src/@types/passport-auth-token/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ interface IVerifyOptions {

type VerifyFunction = (
token: string,
// tslint:disable-next-line:no-any
done: (error: any, user?: any, options?: IVerifyOptions) => void
) => void;

Expand Down
2 changes: 0 additions & 2 deletions src/__mocks__/request.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// tslint:disable:no-any

/**
* mockReq
* @returns {{header, accepts, acceptsEncodings, acceptsEncoding, acceptsCharsets, acceptsCharset, acceptsLanguages, acceptsLanguage, range, param, is, reset: resetMock}}
Expand Down
2 changes: 0 additions & 2 deletions src/__mocks__/response.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// tslint:disable:no-any

/**
* mockRes
* @returns {{append, attachment, cookie, clearCookie, download, end, format, get, json, jsonp, links, location, redirect, render, send, sendFile, sendStatus, set, status, type, vary, reset: resetMock}}
Expand Down
Loading