Skip to content

Commit

Permalink
Merge pull request #2840 from Bilb/replace-tslint-with-eslint
Browse files Browse the repository at this point in the history
Replace tslint with eslint
  • Loading branch information
Bilb committed Aug 7, 2023
2 parents 940c3f6 + a23f532 commit 953897c
Show file tree
Hide file tree
Showing 413 changed files with 3,946 additions and 5,086 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
build/**
components/**
dist/**
mnemonic_languages/**

Expand All @@ -13,3 +12,5 @@ ts/**/*.js
playwright.config.js
preload.js
stylesheets/dist/
compiled.d.ts
.eslintrc.js
66 changes: 61 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
// For reference: https://github.com/airbnb/javascript

module.exports = {
root: true,
settings: {
'import/core-modules': ['electron'],
react: {
version: 'detect',
},
},

extends: ['airbnb-base', 'prettier'],
extends: [
'airbnb-base',
'prettier',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],

plugins: ['mocha', 'more'],
plugins: ['mocha', 'more', '@typescript-eslint'],
parser: '@typescript-eslint/parser',
parserOptions: { project: ['tsconfig.json'] },

rules: {
'comma-dangle': [
Expand Down Expand Up @@ -47,10 +57,38 @@ module.exports = {
'linebreak-style': ['error', 'unix'],

quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'@typescript-eslint/no-floating-promises': ['error'],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
'@typescript-eslint/no-misused-promises': 'error',

// Prettier overrides:
'arrow-parens': 'off',
'no-nested-ternary': 'off',
'function-paren-newline': 'off',

'import/prefer-default-export': 'off',
'operator-linebreak': 'off',
'prefer-destructuring': 'off',
'max-classes-per-file': 'off',
'lines-between-class-members': 'off',
'@typescript-eslint/no-explicit-any': 'off', // to reenable later
'arrow-body-style': 'off',
'no-plusplus': 'off',
'no-continue': 'off',
'no-void': 'off',
'default-param-last': 'off',

'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'class-methods-use-this': 'off',
camelcase: 'off',

'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
// 'no-unused-expressions': 'off',
// '@typescript-eslint/no-unused-expressions': 'error',

'max-len': [
'error',
{
Expand All @@ -59,10 +97,28 @@ module.exports = {
// high value as a buffer to let Prettier control the line length:
code: 999,
// We still want to limit comments as before:
comments: 150,
comments: 200,
ignoreUrls: true,
ignoreRegExpLiterals: true,
},
],
},
overrides: [
{
files: ['*_test.ts'],
rules: {
'no-unused-expressions': 'off',
'no-await-in-loop': 'off',
'no-empty': 'off',
},
},
{
files: ['ts/state/ducks/*.tsx', 'ts/state/ducks/*.ts'],
rules: { 'no-param-reassign': ['error', { props: false }] },
},
{
files: ['ts/node/**/*.ts', 'ts/test/**/*.ts'],
rules: { 'no-console': 'off', 'import/no-extraneous-dependencies': 'off' },
},
],
};
1 change: 1 addition & 0 deletions about_preload.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* global window */

const { ipcRenderer } = require('electron');
Expand Down
1 change: 1 addition & 0 deletions debug_log_preload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global window */
/* eslint-disable @typescript-eslint/no-var-requires */

const { ipcRenderer } = require('electron');
const url = require('url');
Expand Down
1 change: 1 addition & 0 deletions libsession.worker.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');

module.exports = {
Expand Down
73 changes: 27 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,16 @@
"build-everything": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && tsc && yarn build:workers",
"build-everything:watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:workers && tsc -w",
"build:workers": "yarn worker:utils && yarn worker:libsession",
"watch": "yarn clean && yarn protobuf && yarn update-git-info && concurrently 'yarn build-everything:watch'",
"watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn build-everything:watch",
"protobuf": "pbjs --target static-module --wrap commonjs --out ts/protobuf/compiled.js protos/*.proto && pbts --out ts/protobuf/compiled.d.ts ts/protobuf/compiled.js --force-long",
"sass": "rimraf 'stylesheets/dist/' && webpack --config=./sass.config.js",
"clean": "rimraf 'ts/**/*.js' 'ts/*.js' 'ts/*.js.map' 'ts/**/*.js.map' && rimraf tsconfig.tsbuildinfo;",
"lint-full": "yarn format-full && eslint . && tslint --format stylish --project .",
"lint-full": "yarn format-full && eslint .",
"format-full": "prettier --list-different --write \"*.{css,js,json,scss,ts,tsx}\" \"./**/*.{css,js,json,scss,ts,tsx}\"",
"integration-test": "npx playwright test",
"start-prod-test": "cross-env NODE_ENV=production NODE_APP_INSTANCE=$MULTI electron .",

"integration-test-snapshots": "npx playwright test -g 'profile picture' --update-snapshots",
"test": "mocha -r jsdom-global/register --recursive --exit --timeout 10000 \"./ts/test/**/*_test.js\"",
"coverage": "nyc --reporter=html mocha -r jsdom-global/register --recursive --exit --timeout 10000 \"./ts/test/**/*_test.js\"",
"build-release": "run-script-os",
"build-release-non-linux": "yarn build-everything && cross-env SIGNAL_ENV=production electron-builder --config.extraMetadata.environment=production --publish=never --config.directories.output=release",
"build-release:win32": "yarn build-release-non-linux",
Expand All @@ -71,29 +69,27 @@
"worker:libsession": "rimraf 'ts/webworker/workers/node/libsession/*.node' && webpack --config=./libsession.worker.config.js"
},
"dependencies": {
"@emoji-mart/data": "^1.0.6",
"@emoji-mart/react": "^1.0.1",
"@emoji-mart/data": "^1.1.2",
"@emoji-mart/react": "^1.1.1",
"@reduxjs/toolkit": "1.8.5",
"@signalapp/better-sqlite3": "^8.4.3",
"@types/react-mentions": "^4.1.8",
"abort-controller": "3.0.0",
"auto-bind": "^4.0.0",
"backbone": "1.3.3",
"blob-util": "2.0.2",
"blueimp-canvas-to-blob": "^3.29.0",
"blueimp-load-image": "5.14.0",
"buffer-crc32": "0.2.13",
"bunyan": "^1.8.15",
"bytebuffer": "^5.0.1",
"classnames": "2.2.5",
"color": "^3.1.2",
"config": "1.28.1",
"country-code-lookup": "^0.0.19",
"curve25519-js": "https://github.com/oxen-io/curve25519-js",
"dompurify": "^2.0.7",
"electron-localshortcut": "^3.2.1",
"electron-updater": "^4.2.2",
"emoji-mart": "^5.2.2",
"emoji-mart": "^5.5.2",
"filesize": "3.6.1",
"firstline": "1.2.1",
"fs-extra": "9.0.0",
Expand All @@ -107,37 +103,35 @@
"long": "^4.0.0",
"mic-recorder-to-mp3": "^2.2.2",
"moment": "^2.29.4",
"mustache": "2.3.0",
"node-fetch": "^2.6.7",
"os-locale": "5.0.0",
"p-retry": "^4.2.0",
"pify": "3.0.0",
"protobufjs": "^6.11.2",
"queue-promise": "^2.2.1",
"rc-slider": "^8.7.1",
"protobufjs": "^7.2.4",
"rc-slider": "^10.2.1",
"react": "^17.0.2",
"react-contexify": "5.0.0",
"react-dom": "^17.0.2",
"react-draggable": "^4.4.4",
"react-h5-audio-player": "^3.2.0",
"react-intersection-observer": "^8.30.3",
"react-mentions": "^4.4.9",
"react-portal": "^4.2.0",
"react-qr-svg": "^2.2.1",
"react-redux": "8.0.4",
"react-toastify": "^6.0.9",
"react-use": "^17.2.1",
"react-virtualized": "9.22.3",
"react-use": "^17.4.0",
"react-virtualized": "^9.22.4",
"read-last-lines-ts": "^1.2.1",
"redux": "4.2.0",
"redux-logger": "3.0.6",
"redux-persist": "^6.0.0",
"redux-promise-middleware": "^6.1.2",
"rimraf": "2.6.2",
"sanitize.css": "^12.0.1",
"semver": "5.4.1",
"semver": "^7.5.4",
"styled-components": "5.1.1",
"uuid": "8.3.2"
"uuid": "8.3.2",
"webrtc-adapter": "^4.1.1"
},
"devDependencies": {
"@electron/notarize": "^2.1.0",
Expand All @@ -150,26 +144,20 @@
"@types/chai": "4.2.18",
"@types/chai-as-promised": "^7.1.2",
"@types/classnames": "2.2.3",
"@types/color": "^3.0.0",
"@types/config": "0.0.34",
"@types/dompurify": "^2.0.0",
"@types/electron-localshortcut": "^3.1.0",
"@types/emoji-mart": "3.0.9",
"@types/filesize": "3.6.0",
"@types/firstline": "^2.0.2",
"@types/fs-extra": "5.0.5",
"@types/libsodium-wrappers-sumo": "^0.7.5",
"@types/linkify-it": "^3.0.2",
"@types/lodash": "^4.14.194",
"@types/mocha": "5.0.0",
"@types/mustache": "^4.1.2",
"@types/node-fetch": "^2.5.7",
"@types/pify": "3.0.2",
"@types/rc-slider": "^8.6.5",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"@types/react-mic": "^12.4.1",
"@types/react-portal": "^4.0.2",
"@types/react-redux": "^7.1.24",
"@types/react-virtualized": "9.18.12",
"@types/redux-logger": "3.0.7",
Expand All @@ -178,53 +166,43 @@
"@types/sinon": "9.0.4",
"@types/styled-components": "^5.1.4",
"@types/uuid": "8.3.4",
"asar": "3.1.0",
"buffer": "^6.0.3",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"chai-bytes": "^0.1.2",
"cmake-js": "^7.2.1",
"concurrently": "^7.4.0",
"cross-env": "^6.0.3",
"css-loader": "^6.7.2",
"dmg-builder": "23.6.0",
"electron": "25.3.0",
"electron-builder": "23.0.8",
"esbuild": "^0.14.29",
"eslint": "^8.15.0",
"eslint": "^8.45.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-more": "^1.0.5",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react-hooks": "^4.6.0",
"events": "^3.3.0",
"jsdom": "^19.0.0",
"jsdom": "^22.1.0",
"jsdom-global": "^3.0.2",
"mini-css-extract-plugin": "^2.7.5",
"mocha": "10.0.0",
"nan": "^2.17.0",
"node-gyp": "9.0.0",
"node-loader": "^2.0.0",
"nyc": "^15.1.0",
"patch-package": "^6.4.7",
"playwright": "1.16.3",
"postcss-loader": "^7.0.2",
"postinstall-prepare": "^1.0.1",
"prettier": "1.19.0",
"process": "^0.11.10",
"protobufjs-cli": "^1.1.1",
"run-script-os": "^1.1.6",
"sass": "^1.60.0",
"sass-loader": "^13.2.2",
"sinon": "9.0.2",
"style-loader": "^3.3.1",
"ts-loader": "^9.4.2",
"ts-mock-imports": "^1.3.0",
"tslint": "5.19.0",
"tslint-microsoft-contrib": "6.0.0",
"tslint-react": "3.6.0",
"typescript": "^4.6.3",
"typescript": "^5.1.6",
"webpack": "^5.76.3",
"webpack-cli": "^5.0.1"
"webpack-cli": "^5.1.4"
},
"engines": {
"node": "18.15.0"
Expand Down Expand Up @@ -361,9 +339,12 @@
"!build/*.js",
"build/afterPackHook.js",
"build/launcher-script.sh",
"!node_modules/better-sqlite3/deps/*",
"!node_modules/better-sqlite3/src/*",
"node_modules/better-sqlite3/build/Release/better_sqlite3.node",
"!node_modules/@signalapp/better-sqlite3/deps/*",
"!node_modules/@signalapp/better-sqlite3/src/*",
"!node_modules/@signalapp/better-sqlite3/build/Release/obj/*",
"node_modules/@signalapp/better-sqlite3/build/Release/better_sqlite3.node",
"!node_modules/libsession_util_nodejs/libsession-util/*",
"!node_modules/libsession_util_nodejs/src/*",
"ts/webworker/workers/node/libsession/*.node",
"!dev-app-update.yml"
]
Expand Down
1 change: 1 addition & 0 deletions password_preload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global window */
/* eslint-disable @typescript-eslint/no-var-requires */

const { ipcRenderer } = require('electron');
const url = require('url');
Expand Down
13 changes: 0 additions & 13 deletions patches/component-classes+1.2.6.patch

This file was deleted.

3 changes: 2 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// tslint:disable-next-line: no-implicit-dependencies
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable import/no-import-module-exports */
import { PlaywrightTestConfig } from '@playwright/test';
import { toNumber } from 'lodash';

Expand Down
3 changes: 1 addition & 2 deletions preload.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint:disable: no-require-imports no-var-requires
const { clipboard, ipcRenderer, webFrame } = require('electron/main');
const { Storage } = require('./ts/util/storage');

Expand All @@ -15,7 +16,6 @@ if (config.environment !== 'production') {
if (config.appInstance) {
title += ` - ${config.appInstance}`;
}
// tslint:disable: no-require-imports no-var-requires

window.platform = process.platform;
window.getTitle = () => title;
Expand Down Expand Up @@ -240,7 +240,6 @@ const { getConversationController } = require('./ts/session/conversations/Conver
window.getConversationController = getConversationController;
// Linux seems to periodically let the event loop stop, so this is a global workaround
setInterval(() => {
// tslint:disable-next-line: no-empty
window.nodeSetImmediate(() => {});
}, 1000);

Expand Down
4 changes: 2 additions & 2 deletions sass.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');

// eslint-disable-next-line import/no-extraneous-dependencies
const sass = require('sass'); // Prefer `dart-sass`

// eslint-disable-next-line import/no-extraneous-dependencies
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion ts/OS.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import os from 'os';
import _ from 'lodash';
import semver from 'semver';

export const isMacOS = () => process.platform === 'darwin';
Expand Down
Loading

0 comments on commit 953897c

Please sign in to comment.