chore: remove glboal nx/workspace link scripts (it shall be run only globally) + resolve ugly igonores for devDependencies in import/no-extraneous-dependencies

This commit is contained in:
Peter Sanderson
2024-11-11 14:02:02 +01:00
committed by Peter Sanderson
parent 59ff843b61
commit abb41f8033
173 changed files with 285 additions and 191 deletions

View File

@@ -1,3 +1,18 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [...eslint];
export default [
...eslint,
{
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/connect-examples/**', // This must be here, connect-examples are not a package
],
},
],
},
},
];

View File

@@ -44,11 +44,6 @@
],
"cache": true
},
"lint:js": {
"inputs": ["default", "{workspaceRoot}/eslint.config.mjs"],
"outputs": ["{projectRoot}/.eslintcache"],
"cache": true
},
"lint:styles": {
"inputs": ["default", "{workspaceRoot}/.stylelintrc"],
"outputs": ["{projectRoot}/.stylelintcache"],

View File

@@ -137,6 +137,7 @@
"jest-environment-jsdom": "29.7.0",
"jest-expo": "^50.0.2",
"metro-react-native-babel-preset": "0.77.0",
"node-fetch": "^2.6.4",
"nx": "^18.0.3",
"patch-package": "8.0.0",
"prettier": "^3.3.2",

View File

@@ -0,0 +1,13 @@
import { eslint } from '@trezor/eslint';
export default [
...eslint,
{
ignores: [
// This is a JS only codebase written in JS, wo we are not checking it
// Todo: reconsider this decision as most of the ESLint issues are auto-fixable
'src/**/*.js',
'tests/**/*.js',
],
},
];

View File

@@ -19,6 +19,7 @@
"lodash": "^4.17.15"
},
"devDependencies": {
"@trezor/eslint": "workspace:*",
"rimraf": "^6.0.1"
}
}

View File

@@ -3,6 +3,7 @@ declare module '@trezor/address-validator' {
name: string;
symbol: string;
}
export type AddressType =
| 'address'
| 'p2pkh'
@@ -11,16 +12,20 @@ declare module '@trezor/address-validator' {
| 'p2sh'
| 'p2tr'
| 'pw-unknown';
export function validate(
address: string,
currencyNameOrSymbol?: string,
networkType?: string,
): boolean;
export function getAddressType(
address: string,
currencyNameOrSymbol?: string,
networkType?: string,
): AddressType | undefined;
export function getCurrencies(): Currency[];
export function findCurrency(symbol: string): Currency;
}

View File

@@ -12,7 +12,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c ../../jest.config.base.js",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
}

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"dev": "yarn g:tsx watch ./src/index.ts",

View File

@@ -12,7 +12,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",

View File

@@ -12,7 +12,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c ../../jest.config.base.js",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",

View File

@@ -1,4 +1,4 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -8,6 +8,16 @@ export default [
'no-underscore-dangle': 'off',
'no-console': 'warn',
'import/no-default-export': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/tests/**',
'**/webpack/**',
],
},
],
},
},
];

View File

@@ -56,7 +56,6 @@
"build:workers": "yarn g:rimraf build && yarn build:workers-web && yarn build:workers-module",
"build:workers-web": "webpack --config ./webpack/workers.web.js",
"build:workers-module": "webpack --config ./webpack/workers.module.js",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest --verbose -c jest.config.unit.js",
"test:integration": "yarn g:jest -c jest.config.integration.js",
"type-check": "yarn g:tsc --build tsconfig.json",

View File

@@ -16,7 +16,6 @@
"sideEffects": false,
"main": "src/index.ts",
"scripts": {
"lint:js": "eslint '**/*.{ts,js}'",
"test:unit": "yarn g:jest",
"test:discovery": "yarn g:tsx ./tests/tools/discovery-test.ts",
"test:anonymity": "yarn g:tsx ./tests/tools/anonymity-test.ts",

View File

@@ -1,4 +1,4 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -9,4 +9,18 @@ export default [
'import/no-default-export': 'off',
},
},
{
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/*.stories.*',
'**/.storybook/**',
],
},
],
},
},
];

View File

@@ -8,7 +8,6 @@
"sideEffects": false,
"scripts": {
"lint": "yarn lint:js && yarn lint:styles",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"lint:styles": "npx stylelint './src/**/*{.ts,.tsx}' --cache --config ../../.stylelintrc",
"lint-fix": "npx eslint ./src --fix",
"type-check": "yarn g:tsc --build tsconfig.json",
@@ -56,6 +55,7 @@
"@storybook/react": "^7.6.13",
"@storybook/react-webpack5": "^7.6.13",
"@storybook/theming": "^7.6.13",
"@trezor/eslint": "workspace:*",
"@types/react": "18.2.79",
"@types/react-date-range": "^1.4.9",
"postcss-styled-syntax": "^0.6.4",

View File

@@ -12,7 +12,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"build:lib": "yarn g:rimraf lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib"

View File

@@ -31,7 +31,6 @@
"typings": "lib/index.d.ts"
},
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest",
"build:lib": "yarn g:rimraf lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
"type-check": "yarn g:tsc --build tsconfig.json",

View File

@@ -52,9 +52,7 @@
}
},
"dependencies": {
"@trezor/connect": "workspace:*"
},
"devDependencies": {
"@trezor/connect": "workspace:*",
"electron": "33.1.0",
"electron-builder": "25.1.8"
}

View File

@@ -1,6 +1,7 @@
const { app, ipcMain, BrowserWindow } = require('electron');
const path = require('path');
const url = require('url');
const { initTrezorConnect, callTrezorConnect } = require('./trezor-connect-ipc');
let mainWindow;
@@ -34,7 +35,7 @@ app.on('ready', init);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// On macOS, it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();

View File

@@ -57,6 +57,7 @@
},
"devDependencies": {
"@trezor/connect": "workspace:*",
"@trezor/connect-web": "workspace:*",
"babel-loader": "^9.1.3",
"concurrently": "^8.2.2",
"copy-webpack-plugin": "^12.0.2",
@@ -68,6 +69,7 @@
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"webpack-plugin-serve": "^1.6.0",
"worker-loader": "^3.0.8"
}
}

View File

@@ -66,11 +66,13 @@ rootPaths.forEach(dir => {
const isJustCopied = ['.png'].some(ext => p.endsWith(ext));
if (isJustCopied) {
fs.copyFileSync(path.join(rootPath, 'src', p), path.join(rootPath, buildFolder, p));
return;
}
fs.readFile(path.join(rootPath, 'src', p), 'utf-8', (err, contents) => {
if (err) {
console.log(err);
return;
}
@@ -79,6 +81,7 @@ rootPaths.forEach(dir => {
fs.writeFile(path.join(rootPath, buildFolder, p), replaced, 'utf-8', err => {
if (err) {
console.log(err);
return;
}
});

View File

@@ -41,7 +41,7 @@ rootPaths.forEach(dir => {
const usbPermissionsScriptPath = path.join(vendorPath, 'trezor-usb-permissions.js');
const usbPermissionsHtmlPath = path.join(rootPath, 'trezor-usb-permissions.html');
const contentScriptPath = path.join(vendorPath, 'trezor-content-script.js');
const backgroundScriptPath = path.join(rootPath, 'background.js');
// const backgroundScriptPath = path.join(rootPath, 'background.js');
fs.rmSync(buildPath, { recursive: true, force: true });
if (!fs.existsSync(buildPath)) {
@@ -105,11 +105,13 @@ rootPaths.forEach(dir => {
const isJustCopied = ['.png'].some(ext => p.endsWith(ext));
if (isJustCopied) {
fs.copyFileSync(path.join(rootPath, 'src', p), path.join(rootPath, buildFolder, p));
return;
}
fs.readFile(path.join(rootPath, 'src', p), 'utf-8', (err, contents) => {
if (err) {
console.log(err);
return;
}
@@ -118,6 +120,7 @@ rootPaths.forEach(dir => {
fs.writeFile(path.join(rootPath, buildFolder, p), replaced, 'utf-8', err => {
if (err) {
console.log(err);
return;
}
});

View File

@@ -1,8 +1,8 @@
/**
TrezorConnect is loaded in background script but it is triggered from content script.
- call for TrezorConnect action
- show a notification with response
*/
TrezorConnect is loaded in background script but it is triggered from content script.
- call for TrezorConnect action
- show a notification with response
*/
const DEFAULT_SRC = 'https://connect.trezor.io/9/';
@@ -25,14 +25,16 @@ function getAddress() {
async function sendMessageToContentScript(tabID, type, data = null) {
try {
const response = await chrome.tabs.sendMessage(tabID, { type, data });
return response;
} catch (error) {
} catch {
return null;
}
}
chrome.runtime.onMessage.addListener((message, sender) => {
const { tab } = sender;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { type, data } = message;
if (type === 'getAddress') {
getAddress().then(response => {

View File

@@ -1,9 +1,11 @@
async function sendMessageToBackground(type, data = null) {
try {
const response = await chrome.runtime.sendMessage({ type, data });
return response;
} catch (error) {
console.error('sendMessageToBackground error: ', error);
return null;
}
}

View File

@@ -0,0 +1,21 @@
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
{
rules: {
'no-console': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/src/**', // Examples are just for development
'**/webpack.config.js',
],
},
],
},
},
];

View File

@@ -7,7 +7,6 @@
"main": "src/index",
"scripts": {
"depcheck": "yarn g:depcheck",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build",
"build": "webpack --mode production"
},
@@ -15,6 +14,7 @@
"@trezor/connect-webextension": "workspace:^"
},
"devDependencies": {
"@trezor/eslint": "workspace:^",
"copy-webpack-plugin": "^12.0.2",
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.96.1"

View File

@@ -32,12 +32,14 @@ chrome.runtime.onInstalled.addListener((details: chrome.runtime.InstalledDetails
}).then(res => {
sendResponse(res); // Send the response back to the sender
});
// Return true to indicate you want to send a response asynchronously
return true;
} else if (message.action === 'getFeatures') {
TrezorConnect.getFeatures().then(res => {
sendResponse(res); // Send the response back to the sender
});
// Return true to indicate you want to send a response asynchronously
return true;
}

View File

@@ -30,12 +30,14 @@ chrome.runtime.onInstalled.addListener(details => {
}).then(res => {
sendResponse(res); // Send the response back to the sender
});
// Return true to indicate you want to send a response asynchronously
return true;
} else if (message.action === 'getFeatures') {
TrezorConnect.getFeatures().then(res => {
sendResponse(res); // Send the response back to the sender
});
// Return true to indicate you want to send a response asynchronously
return true;
}

View File

@@ -1,6 +1,6 @@
import * as mdx from 'eslint-plugin-mdx';
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -39,6 +39,15 @@ export default [
extensions: ['.tsx', '.mdx'],
},
],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/webpack/**',
],
},
],
},
},
];

View File

@@ -7,7 +7,6 @@
"dev:explorer": "next -p 8088",
"build": "next build && rm -rf build && mv out build",
"build:webextension": "BUILD_TARGET=webextension yarn build && yarn g:rimraf build-webextension && TS_NODE_PROJECT=\"tsconfig.json\" yarn webpack --config ./webpack/webextension.webpack.config.ts && bash ./webpack/replace-next-filenames.sh",
"lint:js": "yarn g:eslint '**/*{.ts,.tsx}'",
"lint:styles": "npx stylelint './src/**/*{.ts,.tsx}' --cache --config ../../.stylelintrc",
"type-check": "yarn g:tsc --build tsconfig.json"
},

View File

@@ -1,10 +1,20 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
{
rules: {
'import/no-default-export': 'off', // Todo: shall be fixed
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/webpack/**',
],
},
],
},
},
];

View File

@@ -3,7 +3,6 @@
"version": "9.0.0",
"private": true,
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"build:iframe": "TS_NODE_PROJECT=\"tsconfig.json\" yarn webpack --config ./webpack/prod.webpack.config.ts --stats-children",
"build:core-module": "TS_NODE_PROJECT=\"tsconfig.json\" yarn webpack --config ./webpack/core.webpack.config.ts --stats-children",
"build": "yarn rimraf build && yarn build:iframe && yarn build:core-module",

View File

@@ -12,7 +12,6 @@
"lib/"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",

View File

@@ -33,7 +33,6 @@
"@metamask/eth-sig-util": "^8.0.0"
},
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c ../../jest.config.base.js",
"type-check": "yarn g:tsc --build tsconfig.json",
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib"

View File

@@ -38,7 +38,6 @@
"@trezor/utils": "workspace:*"
},
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "jest -c ../../jest.config.base.js",
"type-check": "yarn g:tsc --build tsconfig.json",
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib"

View File

@@ -1,4 +1,4 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -6,6 +6,15 @@ export default [
rules: {
'no-console': 'off',
'no-restricted-syntax': 'off', // Todo: fix and solve
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/webpack/**',
],
},
],
},
},
];

View File

@@ -4,7 +4,6 @@
"private": true,
"sideEffects": false,
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"lint:styles": "npx stylelint './src/**/*{.ts,.tsx}' --cache --config ../../.stylelintrc",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"lint:styles": "npx stylelint './src/**/*{.ts,.tsx}' --cache --config ../../.stylelintrc",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"

View File

@@ -1,4 +1,4 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -8,6 +8,15 @@ export default [
camelcase: 'off', // camelcase is used
'jest/valid-expect': 'off', // because of cypress tests
'import/no-default-export': 'off', // Todo: shall be fixed
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/webpack/**',
],
},
],
},
},
];

View File

@@ -29,7 +29,6 @@
],
"scripts": {
"predev": "node webpack/generate_dev_cert.js",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"test:unit": "yarn g:jest",

View File

@@ -1,10 +1,19 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
{
rules: {
'no-underscore-dangle': 'off', // underscore is used
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/webpack/**',
],
},
],
},
},
];

View File

@@ -30,7 +30,6 @@
"!lib/proxy"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
"build:content-script": "TS_NODE_PROJECT=\"tsconfig.lib.json\" webpack --config ./webpack/content-script.webpack.config.ts",
"build:inline": "TS_NODE_PROJECT=\"tsconfig.lib.json\" webpack --config ./webpack/inline.webpack.config.ts",

View File

@@ -52,7 +52,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "jest --version && jest",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
}

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"test:unit": "yarn g:jest -c ../../jest.config.base.js"

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
}

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},

View File

@@ -21,7 +21,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",

View File

@@ -5,6 +5,18 @@ import pluginImport from 'eslint-plugin-import';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export const globalNoExtraneousDependenciesDevDependencies = [
// ----------------------------------------------------------------
// !!! DO NOT PUT STUFF THAT BELONGS TO THE PACKAGE ITSELF HERE !!!
// Only shared stuff (like tests.*.ts(x) or fixtures shall be here)
// ----------------------------------------------------------------
'**/*fixtures*/**',
'**/*.test.{tsx,ts,js}',
'**/eslint.config.mjs',
'**/*e2e/**', // Todo: This shall be only in packages that has e2e tests
];
export const importConfig = [
pluginImport.flatConfigs.recommended,
{
@@ -49,21 +61,7 @@ export const importConfig = [
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*fixtures*/**',
'**/*.test.{tsx,ts,js}',
'**/blockchain-link/tests/**',
'**/blockchain-link/webpack/**',
'**/suite-desktop-core/**',
'**/*e2e/**',
'**/suite/src/support/tests/**',
'**/suite-data/**',
'**/*.stories.*',
'**/*webpack.config*',
'**/webpack/**',
'**/.storybook/**',
],
devDependencies: globalNoExtraneousDependenciesDevDependencies,
includeTypes: true,
},
],

View File

@@ -4,12 +4,14 @@ import jsxA11y from 'eslint-plugin-jsx-a11y';
import { reactConfig } from './reactConfig.mjs';
import { javascriptConfig } from './javascriptConfig.mjs';
import { typescriptConfig } from './typescriptConfig.mjs';
import { importConfig } from './importConfig.mjs';
import { importConfig, globalNoExtraneousDependenciesDevDependencies } from './importConfig.mjs';
import { jestConfig } from './jestConfig.mjs';
import { javascriptNodejsConfig } from './javascriptNodejsConfig.mjs';
import { localRulesConfig } from './localRulesConfig.mjs';
import { chaiFriendlyConfig } from './chaiFriendlyConfig.mjs';
export { globalNoExtraneousDependenciesDevDependencies };
export const eslint = [
{
ignores: [
@@ -22,10 +24,6 @@ export const eslint = [
'**/build-electron/*',
'**/node_modules/*',
'**/public/*',
// 'packages/suite-data/files/*', // Todo: fix or ignore locally in repo
// 'packages/protobuf/scripts/protobuf-patches/*', // Todo: ignore locally in repo
// 'packages/address-validator', // Todo: fix or ignore locally in repo
// 'packages/connect-examples', // Todo: fix or ignore locally in repo
'**/ci/',
'eslint-local-rules/*',
],
@@ -64,7 +62,6 @@ export const eslint = [
files: ['eslint.config.mjs'],
rules: {
'import/no-default-export': 'off',
'import/no-extraneous-dependencies': 'off',
},
},
];

View File

@@ -16,7 +16,6 @@
"main": "src/index",
"browser": "src/proxy",
"scripts": {
"lint:js": "eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest --verbose -c ../../jest.config.base.js",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"

View File

@@ -1,5 +1,6 @@
import { create } from '@storybook/theming/create';
// eslint-disable-next-line import/no-default-export
export default create({
base: 'light',
fontBase: 'TT Satoshi',

View File

@@ -1,10 +1,26 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
{
files: ['**/*.stories.tsx'],
rules: {
'no-console': 'off',
'import/no-default-export': 'off',
},
},
{
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/*.stories.*',
'**/.storybook/**',
],
},
],
},
},
];

View File

@@ -8,7 +8,6 @@
"sideEffects": false,
"scripts": {
"lint": "yarn lint:js && yarn lint:styles",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"lint:styles": "npx stylelint './src/**/*{.ts,.tsx}' --cache --config ../../.stylelintrc",
"lint-fix": "npx eslint ./src --fix",
"type-check": "yarn g:tsc --build tsconfig.json",

View File

@@ -24,7 +24,6 @@
"messages.json"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c ../../jest.config.base.js",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",

View File

@@ -20,7 +20,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c ../../jest.config.base.js",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",

View File

@@ -4,7 +4,6 @@
"description": "React Native WebUSB implementation",
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build tsconfig.json",
"open:ios": "open -a \"Xcode\" example/ios",
"open:android": "open -a \"Android Studio\" example/android"

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index.ts",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:e2e": "yarn g:jest --runInBand -c ../../jest.config.base.js",
"type-check": "yarn g:tsc --build tsconfig.json",
"test:stress": "ts-node -O '{\"module\": \"commonjs\"}' ./e2e/identities-stress.ts"
@@ -17,6 +16,7 @@
"socks-proxy-agent": "8.0.4"
},
"devDependencies": {
"@trezor/eslint": "workspace:*",
"ts-node": "^10.9.1",
"ws": "^8.18.0"
}

View File

@@ -13,7 +13,6 @@
],
"scripts": {
"test:unit": "yarn g:jest",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",

View File

@@ -8,7 +8,6 @@
"scripts": {
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c ../../jest.config.base.js"
},
"dependencies": {

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},

View File

@@ -1,4 +1,4 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -6,6 +6,17 @@ export default [
rules: {
'no-console': 'off',
'import/no-default-export': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/webpack/**',
'**/builds/**',
'**/configs/**',
],
},
],
},
},
];

View File

@@ -17,7 +17,6 @@
"desktop": "PROJECT=desktop yarn run base",
"dev:desktop": "yarn run desktop",
"build:desktop": "NODE_ENV=production yarn run desktop",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build tsconfig.json",
"type-check:watch": "yarn type-check -- --watch"
},

View File

@@ -1,4 +1,4 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -8,6 +8,16 @@ export default [
{
rules: {
'no-console': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/postcss.config.js',
'**/src/**', // Todo: reconsider, this whole package is probably just "dev"
],
},
],
},
},
];

View File

@@ -14,7 +14,6 @@
"browser-detection": "webpack --config ./browser-detection.webpack.ts",
"guide-pull-content": "yarn tsx ./src/guide/index.ts",
"update-coinjoin-middleware": "./files/bin/coinjoin/update.sh",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build tsconfig.json"
},
"dependencies": {
@@ -27,6 +26,7 @@
},
"devDependencies": {
"@mobily/ts-belt": "^3.13.1",
"@trezor/eslint": "workspace:*",
"@types/fs-extra": "^11.0.4",
"autoprefixer": "^10.4.17",
"babel-loader": "^9.1.3",

View File

@@ -14,7 +14,6 @@
"main": "./src/main.ts",
"browser": "./src/renderer.ts",
"scripts": {
"lint:js": "yarn g:eslint '**/*{.ts,.tsx}'",
"test:unit": "yarn g:jest --verbose -c jest.config.js",
"type-check": "yarn g:tsc --build tsconfig.json"
},

View File

@@ -0,0 +1,20 @@
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
{
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/webpack/**',
'**/src/**', // Todo: reconsider, this whole package is probably just "dev"
'**/scripts/**', // Todo: reconsider, this whole package is probably just "dev"
],
},
],
},
},
];

View File

@@ -8,7 +8,6 @@
"main": "src/app.ts",
"scripts": {
"build:core": "yarn g:rimraf dist && TS_NODE_PROJECT=\"tsconfig.json\" yarn webpack --config ./webpack/core.webpack.config.ts",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build tsconfig.json",
"test:unit": "yarn g:jest",
"test:e2e": "yarn xvfb-maybe -- playwright test --config=./e2e/playwright.config.ts"
@@ -25,6 +24,7 @@
"@trezor/connect": "workspace:*",
"@trezor/connect-common": "workspace:*",
"@trezor/env-utils": "workspace:*",
"@trezor/eslint": "workspace:*",
"@trezor/ipc-proxy": "workspace:*",
"@trezor/node-utils": "workspace:*",
"@trezor/request-manager": "workspace:*",

View File

@@ -8,7 +8,6 @@
"scripts": {
"type-check": "yarn g:tsc --build tsconfig.json",
"type-check:watch": "yarn type-check -- --watch",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"lint:styles": "npx stylelint './src/**/*{.ts,.tsx}' --cache --config ../../.stylelintrc"
},
"dependencies": {

View File

@@ -19,8 +19,7 @@
"build:app:electron": "yarn electron-builder --config electron-builder-config.js",
"build:linux": "yarn clean && yarn build:ui && yarn build:app && yarn build:app:electron --publish never --linux --x64 --arm64",
"build:mac": "yarn clean && yarn build:ui && yarn build:app && yarn build:app:electron --publish never --mac --x64 --arm64",
"build:win": "yarn clean && yarn build:ui && yarn build:app && yarn build:app:electron --publish never --win --x64",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'"
"build:win": "yarn clean && yarn build:ui && yarn build:app && yarn build:app:electron --publish never --win --x64"
},
"dependencies": {
"blake-hash": "^2.0.0",

View File

@@ -10,7 +10,6 @@
"license": "SEE LICENSE IN LICENSE.md",
"description": "trezor suite storage",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build tsconfig.json",
"type-check:watch": "yarn type-check -- --watch"
},

View File

@@ -5,7 +5,6 @@
"scripts": {
"type-check": "yarn g:tsc --build tsconfig.json",
"type-check:watch": "yarn type-check -- --watch",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"lint:styles": "npx stylelint './src/**/*{.ts,.tsx}' --cache --config ../../.stylelintrc",
"dev": "yarn rimraf ./build && yarn workspace @trezor/suite-build run dev:web",
"analyze": "ANALYZE=true yarn build",

View File

@@ -1,4 +1,4 @@
import { eslint } from '@trezor/eslint';
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
@@ -13,6 +13,16 @@ export default [
'no-restricted-syntax': 'off', // Todo: this should be fixed in codebase and this line removed
'import/no-default-export': 'off', // Todo: shall be solved one day, usually its legacy Components
'no-console': 'off', // Todo: we use it a lot, shall be disabled more granulary I think
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/src/support/tests/**',
],
},
],
},
},
];

View File

@@ -5,7 +5,6 @@
"private": true,
"scripts": {
"lint": "yarn lint:styles && yarn lint:js",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"lint:styles": "npx stylelint './src/**/*{.ts,.tsx}' --cache --config ../../.stylelintrc",
"translations:format": "yarn g:prettier --write \"../suite-data/files/translations/*\"",
"translations:extract": "formatjs extract src/support/messages.ts --format simple > ../suite-data/files/translations/master.json",

View File

@@ -13,7 +13,7 @@ export const configureStore = <S, DispatchExts = {}>(
reduxMockStore([thunk.withExtraArgument(extraDependencies), ...(middlewares || [])]);
/*
* This function is useful, because lot of test fixtures doesn't count with added thunk pending/fulfilled action that are now
* This function is useful, because a lot of test fixtures doesn't count with added thunk pending/fulfilled action that are now
* dispatched everytime. This will filter out these action so we don't need to fix fixtures everywhere.
* It should be used only in /packages/suite everything migrated to suite-common/ should be adjusted to work with new thunk API!!!
*/

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},

View File

@@ -0,0 +1,18 @@
import { eslint, globalNoExtraneousDependenciesDevDependencies } from '@trezor/eslint';
export default [
...eslint,
{
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
...globalNoExtraneousDependenciesDevDependencies,
'**/webpack/**',
],
},
],
},
},
];

View File

@@ -9,7 +9,6 @@
"test:unit": "yarn g:jest",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"build:node:bin": "yarn esbuild ./src/bin.ts --bundle --outfile=dist/bin.js --platform=node --target=node18 --external:usb",
"build:node:module": "yarn esbuild ./src/index.ts --bundle --outfile=dist/index.js --platform=node --target=node18 --external:usb",
"build:node": "yarn build:node:bin && yarn build:node:module",
@@ -28,6 +27,7 @@
},
"dependencies": {
"@trezor/components": "workspace:*",
"@trezor/eslint": "workspace:*",
"@trezor/node-utils": "workspace:*",
"@trezor/protocol": "workspace:*",
"@trezor/theme": "workspace:*",

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"scripts": {
"depcheck": "yarn g:depcheck",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build",
"test:e2e:bridge": "ts-node -T -O '{\"module\": \"commonjs\", \"esModuleInterop\": true}' ./e2e/bridge/run.ts",
"test:e2e:old-bridge:hw": "USE_HW=true USE_NODE_BRIDGE=false yarn test:e2e:bridge",

View File

@@ -42,7 +42,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build tsconfig.json",
"build:lib": "yarn g:rimraf -rf lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
"publish:lib": "./scripts/publish-lib.sh",

View File

@@ -5,7 +5,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},

View File

@@ -9,7 +9,6 @@
],
"scripts": {
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
}

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"test:e2e": "yarn g:jest -c ../../jest.config.base.js"

View File

@@ -23,7 +23,6 @@
"!**/*.map"
],
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest --verbose -c ./jest.config.js",
"type-check": "yarn g:tsc --build tsconfig.json",
"build:lib": "yarn g:rimraf ./lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",

View File

@@ -31,7 +31,6 @@
"typings": "lib/index.d.ts"
},
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest --verbose -c jest.config.js",
"type-check": "yarn g:tsc --build tsconfig.json",
"build:lib": "yarn g:rimraf lib && yarn g:tsc --build tsconfig.lib.json && ../../scripts/replace-imports.sh ./lib",

View File

@@ -8,7 +8,6 @@
"scripts": {
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "jest -c ../../jest.config.base.js"
},
"dependencies": {}

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},

View File

@@ -8,7 +8,6 @@
"scripts": {
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "jest -c ../../jest.config.base.js"
}
}

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"type-check": "yarn g:tsc --build tsconfig.json",
"test:unit": "yarn g:jest -c ./jest.config.js",
"test-unit:watch": "yarn g:jest -c ../../jest.config.base.js -o --watch"

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c ./jest.config.js",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"test:unit": "yarn g:jest -c ../../jest.config.base.js"

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c=../../jest.config.base.js",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"test:unit": "yarn g:jest -c ../../jest.config.base.js",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"generate-icons": "yarn g:tsx generateIcons.js",

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build",
"generate-icons": "yarn g:tsx generateIcons.js && yarn g:tsx generateIconFont.ts",

View File

@@ -6,7 +6,6 @@
"sideEffects": false,
"main": "src/index",
"scripts": {
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
"depcheck": "yarn g:depcheck",
"type-check": "yarn g:tsc --build"
},

Some files were not shown because too many files have changed in this diff Show More