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

[RUMF-324] Replace TSLint with ESLint #681

Merged
merged 73 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
ed9b01f
🔨 Replace TSLint by ESLint
webNeat Jan 7, 2021
7e79271
🔨 Fix rule import/order
webNeat Jan 12, 2021
8d8066e
🔨 Fix rule arrow-body-style
webNeat Jan 12, 2021
c1b4569
🔨 Fix rule @typescript-eslint/dot-notation
webNeat Jan 12, 2021
6afb031
🔨 Fix rule @typescript-eslint/no-unnecessary-type-assertion
webNeat Jan 12, 2021
f92c9d1
Update licences of 3rd party dependencies
webNeat Jan 12, 2021
8212bc3
🎨 Fix prettier format
webNeat Jan 12, 2021
671a965
🔨 Ignore special cases of @typescript-eslint/no-unnecessary-type-asse…
webNeat Jan 12, 2021
cf13c1c
👌 Add new line at the end of file
webNeat Jan 14, 2021
55659d8
👌 Reuse tsconfig files for ESLint
webNeat Jan 14, 2021
23bf1b8
👌 Enable ESLint for packages/core/src/domain/tracekit.spec.ts
webNeat Jan 14, 2021
c1368b8
👌 Ignore test/app/dist and sandbox from ESLint
webNeat Jan 14, 2021
5dcb4e6
👌 Remove unused plugins
webNeat Jan 18, 2021
60684ce
👌 Refactor ESLint comments
webNeat Jan 18, 2021
3048877
Ignore coverage directory
webNeat Jan 18, 2021
94796df
🔨 Fix rule @typescript-eslint/array-type
webNeat Jan 18, 2021
2f9a76a
🔨 Fix rule @typescript-eslint/no-shadow
webNeat Jan 18, 2021
ce40fbb
🔨 Fix rule @typescript-eslint/no-redeclare
webNeat Jan 18, 2021
bbb9b45
🔨 Fix rule no-throw-literal
webNeat Jan 18, 2021
0afa54e
🔨 Fix rule unicorn/filename-case
webNeat Jan 18, 2021
10df551
🔨 Fix rule jsdoc/check-indentation
webNeat Jan 18, 2021
75f654e
🔨 Fix rule @typescript-eslint/await-thenable
webNeat Jan 18, 2021
6420b62
🔨 Fix rule @typescript-eslint/no-unused-vars
webNeat Jan 18, 2021
2d7f5bd
🔨 Fix rule @typescript-eslint/ban-ts-comment
webNeat Jan 18, 2021
ed14e2b
🔨 Fix rule @typescript-eslint/no-unsafe-call
webNeat Jan 19, 2021
95a57e0
🔨 Fix rule @typescript-eslint/no-for-in-array
webNeat Jan 19, 2021
a3b30ff
🔨 Fix rule @typescript-eslint/member-ordering
webNeat Jan 19, 2021
187c541
🔨 Fix rule @typescript-eslint/no-var-requires
webNeat Jan 19, 2021
aa055e0
🔨 Fix rule @typescript-eslint/no-unsafe-return
webNeat Jan 19, 2021
8006b2e
🔨 Fix rule no-underscore-dangle
webNeat Jan 20, 2021
e32b490
🔨 Fix rule @typescript-eslint/require-await
webNeat Jan 20, 2021
bf00750
🔨 Fix rule @typescript-eslint/no-empty-interface
webNeat Jan 20, 2021
2daaf1f
🔨 Fix rule @typescript-eslint/prefer-regexp-exec
webNeat Jan 20, 2021
9087a92
🔨 Fix rule @typescript-eslint/no-inferrable-types
webNeat Jan 20, 2021
e7c9dd2
🔨 Fix rule @typescript-eslint/no-floating-promises
webNeat Jan 21, 2021
5eea344
🔨 Fix rule @typescript-eslint/restrict-plus-operands
webNeat Jan 21, 2021
5cb20dc
🔨 Fix rule @typescript-eslint/restrict-template-expressions
webNeat Jan 21, 2021
6ff288d
🔨 Fix rule @typescript-eslint/ban-types
webNeat Jan 21, 2021
29ab003
🔨 Disable rule no-param-reassign
webNeat Jan 21, 2021
6a9c3c6
🔨 Fix rule @typescript-eslint/unbound-method
webNeat Jan 21, 2021
845055c
👌 Sort ESLint rules
webNeat Jan 21, 2021
c7eeb35
🎨 Remove rules already on @typescript-eslint/recommended
webNeat Jan 21, 2021
f885d05
Merge master changes
webNeat Jan 21, 2021
97fcc7c
Fix ESLint errors
webNeat Jan 21, 2021
ae39b4f
🔨 Remove Useless TSLint comments
webNeat Jan 21, 2021
7061df9
Merge master changes
webNeat Jan 21, 2021
e2f81c9
Merge branch 'master' into amine/eslint
webNeat Jan 21, 2021
a957dee
Remove uneeded operators and comments
webNeat Jan 22, 2021
c72e449
Use Regexp.test() instead of .exec()
webNeat Jan 22, 2021
8ddaa7a
👌 Remove useless void operator
webNeat Jan 22, 2021
f686c07
👌 Handle the promise correctly
webNeat Jan 22, 2021
f1ee182
👌 Ignore the rule for the entire file
webNeat Jan 22, 2021
3832333
👌 Remove useless type cast
webNeat Jan 22, 2021
2547539
👌 Restore original monitor implementation
webNeat Jan 22, 2021
5b3c3c1
👌 Remove unused function
webNeat Jan 22, 2021
6adc190
👌 Remove unused rule
webNeat Jan 22, 2021
3d4f979
👌 Refactor jsdoc comments
webNeat Jan 22, 2021
fd49cec
👌 Ignore the rule for the entire test file
webNeat Jan 22, 2021
1ab9bf4
👌 Ignore the rule only when needed
webNeat Jan 22, 2021
ed9bad3
👌 Regenrate rumEvent.types
webNeat Jan 22, 2021
0c9c76d
👌 Remove uneeded comment
webNeat Jan 22, 2021
c4b5626
👌 Log fetch errors
webNeat Jan 22, 2021
ce62e60
👌 Handle fetch promise error
webNeat Jan 22, 2021
1ab5aa4
👌 Simplify tsconfigs
webNeat Jan 22, 2021
11afd6d
👌 Undo uneeded change
webNeat Jan 22, 2021
930aec0
Fix typescript config
webNeat Jan 22, 2021
c1ee3cd
👌 Use spaced comments
webNeat Jan 25, 2021
04d1cb9
👌 Disable all rules for deflateWorker.js
webNeat Jan 25, 2021
60d934d
👌 Remove uneeded comment
webNeat Jan 25, 2021
70f2f47
Merge master changes
webNeat Jan 25, 2021
7b9c6d8
Fix lint on CI
webNeat Jan 25, 2021
11020ea
👌 Improve tests readability
webNeat Jan 26, 2021
b63aa1f
Remove unused import
webNeat Jan 26, 2021
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
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bundle
bcaudan marked this conversation as resolved.
Show resolved Hide resolved
cjs
esm
bcaudan marked this conversation as resolved.
Show resolved Hide resolved
237 changes: 237 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
module.exports = {
env: {
browser: true,
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
'prettier/@typescript-eslint',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.eslint.json',
bcaudan marked this conversation as resolved.
Show resolved Hide resolved
sourceType: 'module',
},
plugins: [
'eslint-plugin-unicorn',
BenoitZugmeyer marked this conversation as resolved.
Show resolved Hide resolved
'eslint-plugin-import',
'eslint-plugin-no-null',
BenoitZugmeyer marked this conversation as resolved.
Show resolved Hide resolved
'eslint-plugin-jsdoc',
'eslint-plugin-prefer-arrow',
'eslint-plugin-react',
'@typescript-eslint',
],
rules: {
'no-shadow': 0,
bcaudan marked this conversation as resolved.
Show resolved Hide resolved
'import/order': 0,
'no-redeclare': 0,
'no-null/no-null': 0,
'arrow-body-style': 0,
'no-throw-literal': 0,
'prefer-rest-params': 0,
'no-underscore-dangle': 0,
'unicorn/filename-case': 0,
'jsdoc/check-indentation': 0,
'@typescript-eslint/indent': 0,
'import/no-internal-modules': 0,
'@typescript-eslint/array-type': 0,
'@typescript-eslint/dot-notation': 0,
'jsdoc/newline-after-description': 0,
'@typescript-eslint/no-extra-semi': 0,
'@typescript-eslint/require-await': 0,
'@typescript-eslint/await-thenable': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-unsafe-call': 0,
'import/no-extraneous-dependencies': 0,
'@typescript-eslint/unbound-method': 0,
'@typescript-eslint/member-ordering': 0,
'@typescript-eslint/no-for-in-array': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-unsafe-return': 0,
'@typescript-eslint/naming-convention': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/prefer-regexp-exec': 0,
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/no-floating-promises': 0,
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/promise-function-async': 0,
'@typescript-eslint/restrict-plus-operands': 0,
'@typescript-eslint/no-unsafe-member-access': 0,
'@typescript-eslint/restrict-template-expressions': 0,
'@typescript-eslint/no-unnecessary-type-assertion': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/ban-types': [
0,
{
types: {
Object: {
message: 'Avoid using the `Object` type. Did you mean `object`?',
},
Function: {
message: 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.',
},
// eslint-disable-next-line id-blacklist
Boolean: {
message: 'Avoid using the `Boolean` type. Did you mean `boolean`?',
},
// eslint-disable-next-line id-blacklist
Number: {
message: 'Avoid using the `Number` type. Did you mean `number`?',
},
// eslint-disable-next-line id-blacklist
String: {
message: 'Avoid using the `String` type. Did you mean `string`?',
},
Symbol: {
message: 'Avoid using the `Symbol` type. Did you mean `symbol`?',
},
},
},
],
BenoitZugmeyer marked this conversation as resolved.
Show resolved Hide resolved

'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/explicit-member-accessibility': [
'off',
{
accessibility: 'explicit',
},
],
'@typescript-eslint/member-delimiter-style': [
'off',
{
multiline: {
delimiter: 'none',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-implied-eval': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',

'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/quotes': 'off',
'@typescript-eslint/semi': ['off', null],
'@typescript-eslint/triple-slash-reference': [
'error',
{
path: 'always',
types: 'prefer-import',
lib: 'always',
},
],
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/unified-signatures': 'error',
'arrow-parens': ['off', 'always'],
'brace-style': ['off', 'off'],
'comma-dangle': 'off',
complexity: 'off',
'constructor-super': 'error',
curly: 'error',
'eol-last': 'off',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'error',
'id-blacklist': [
'error',
'any',
'Number',
'number',
'String',
'string',
'Boolean',
'boolean',
'Undefined',
'undefined',
],
'id-match': 'error',
'import/no-default-export': 'error',
'jsdoc/check-alignment': 'error',
'linebreak-style': 'off',
'max-classes-per-file': 'off',
'max-len': [
'error',
{
code: 120,
},
],
'new-parens': 'off',
'newline-per-chained-call': 'off',
'no-array-constructor': 'off',
'no-bitwise': 'error',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'off',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-else-return': 'error',
'no-empty': 'error',
'no-empty-function': 'off',
'no-eval': 'error',
'no-extra-bind': 'error',
'no-extra-semi': 'off',
'no-fallthrough': 'off',
'no-implied-eval': 'off',
'no-invalid-this': 'off',
'no-irregular-whitespace': 'off',
'no-multiple-empty-lines': 'off',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-param-reassign': 'error',
'no-return-await': 'error',
'no-sequences': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-trailing-spaces': 'off',
'no-undef-init': 'error',
'no-unsafe-finally': 'error',
'no-unused-labels': 'error',
'no-unused-vars': 'off',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'prefer-const': 'error',
'prefer-object-spread': 'error',
'prefer-template': 'error',
'quote-props': 'off',
radix: 'error',
'react/jsx-curly-spacing': 'off',
'react/jsx-equals-spacing': 'off',
'react/jsx-wrap-multilines': 'off',
BenoitZugmeyer marked this conversation as resolved.
Show resolved Hide resolved
'require-await': 'off',
'space-before-function-paren': 'off',
'space-in-parens': ['off', 'never'],
'spaced-comment': [
'error',
'always',
{
markers: ['/'],
},
],
'use-isnan': 'error',
'valid-typeof': 'off',
},
}
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "lerna run build --stream",
"build:bundle": "lerna run build:bundle --stream",
"format": "prettier --check .",
"lint": "scripts/cli lint . && scripts/cli lint test/e2e",
"lint": "scripts/cli lint .",
"typecheck": "scripts/cli typecheck . && scripts/cli typecheck test/e2e",
"dev": "node scripts/dev-server.js",
"release": "lerna version --exact",
Expand All @@ -31,6 +31,8 @@
"@types/express": "4.17.8",
"@types/jasmine": "3.5.10",
"@types/sinon": "9.0.10",
"@typescript-eslint/eslint-plugin": "4.12.0",
"@typescript-eslint/parser": "4.12.0",
"@wdio/browserstack-service": "6.1.4",
"@wdio/cli": "6.1.4",
"@wdio/jasmine-framework": "6.1.3",
Expand All @@ -44,6 +46,14 @@
"codecov": "3.7.1",
"cors": "2.8.5",
"emoji-name-map": "1.2.8",
"eslint": "7.17.0",
"eslint-config-prettier": "7.1.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.13",
"eslint-plugin-no-null": "1.0.2",
"eslint-plugin-prefer-arrow": "1.2.2",
"eslint-plugin-react": "7.22.0",
"eslint-plugin-unicorn": "25.0.1",
"express": "4.17.1",
"istanbul-instrumenter-loader": "3.0.1",
"jasmine-core": "3.5.0",
Expand All @@ -67,12 +77,7 @@
"ts-loader": "6.2.2",
"ts-node": "8.8.1",
"tsconfig-paths-webpack-plugin": "3.2.0",
"tslint": "5.18.0",
"tslint-config-airbnb": "5.11.1",
"tslint-config-prettier": "1.18.0",
"tslint-eslint-rules": "5.4.0",
"typescript": "3.8.3",
"typescript-tslint-plugin": "0.5.4",
"webdriverio": "6.1.4",
"webpack": "4.42.1",
"webpack-cli": "3.3.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/browser/fetchProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function proxyFetch() {

originalFetch = window.fetch

// tslint:disable promise-function-async
// eslint-disable @typescript-eslint/promise-function-async
window.fetch = monitor(function (this: WindowOrWorkerGlobalScope['fetch'], input: RequestInfo, init?: RequestInit) {
const method = (init && init.method) || (typeof input === 'object' && input.method) || 'GET'
const url = normalizeUrl((typeof input === 'object' && input.url) || (input as string))
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/domain/internalMonitoring.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('internal monitoring', () => {

@monitored
monitoredStringErrorThrowing() {
// tslint:disable-next-line: no-string-throw
// eslint-disable-next-line no-throw-literal
throw 'string error'
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/domain/internalMonitoring.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// tslint:disable ban-types
// eslint-disable @typescript-eslint/ban-types
import { combine, Context } from '../tools/context'
import { toStackTraceString } from '../tools/error'
import * as utils from '../tools/utils'
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/domain/tracekit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// tslint:disable no-unsafe-any
// eslint-disable
bcaudan marked this conversation as resolved.
Show resolved Hide resolved

import { computeStackTrace, Handler, report } from './tracekit'

Expand Down Expand Up @@ -112,7 +112,7 @@ Error: foo
expect(computeStackTrace(2).message).toBeUndefined()
expect(computeStackTrace({ foo: 'bar' }).message).toBeUndefined()
expect(computeStackTrace(undefined).message).toBeUndefined()
// tslint:disable-next-line:no-null-keyword
// eslint-disable-next-line no-null/no-null
bcaudan marked this conversation as resolved.
Show resolved Hide resolved
expect(computeStackTrace(null).message).toBeUndefined()
})
})
Expand Down
14 changes: 7 additions & 7 deletions packages/core/src/domain/tracekit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// tslint:disable no-unsafe-any
// eslint-disable

import { monitor } from './internalMonitoring'

Expand Down Expand Up @@ -53,7 +53,7 @@ export interface StackTrace {
const UNKNOWN_FUNCTION = '?'

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
// tslint:disable-next-line max-line-length
// eslint-disable-next-line max-len
const ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/

/**
Expand Down Expand Up @@ -87,7 +87,7 @@ function isUndefined(what: any) {
* @return {Function} The wrapped func
* @memberof TraceKit
*/
// tslint:disable-next-line ban-types
// eslint-disable-next-line @typescript-eslint/ban-types
export function wrap(func: Function) {
function wrapped(this: any) {
try {
Expand Down Expand Up @@ -499,11 +499,11 @@ export const computeStackTrace = (function computeStackTraceWrapper() {
return
}

// tslint:disable-next-line max-line-length
// eslint-disable-next-line max-len
const chrome = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i
// tslint:disable-next-line max-line-length
// eslint-disable-next-line max-len
const gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i
// tslint:disable-next-line max-line-length
// eslint-disable-next-line max-len
const winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i

// Used to additionally parse URL/line/column from eval frames
Expand Down Expand Up @@ -605,7 +605,7 @@ export const computeStackTrace = (function computeStackTraceWrapper() {
}

const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i
// tslint:disable-next-line max-line-length
// eslint-disable-next-line max-len
const opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i
const lines = stacktrace.split('\n')
const stack = []
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/domain/tracekitHandler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// tslint:disable no-unsafe-any
// eslint-disable

import { report, StackFrame, wrap } from './tracekit'

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/domain/tracekitParser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// tslint:disable no-unsafe-any
// eslint-disable

import * as CapturedExceptions from '../../test/capturedExceptions'
import { isSafari } from '../tools/specHelper'
Expand Down Expand Up @@ -1120,7 +1120,7 @@ describe('Parser', () => {
func: 'this',
line: 74,
url:
// tslint:disable-next-line max-line-length
// eslint-disable-next-line max-len
'/home/username/sample-workspace/sampleapp.collect.react/node_modules/react-native/Libraries/Renderer/src/renderers/native/ReactNativeBaseComponent.js',
})
})
Expand Down
Loading