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

chore(suite): add @typescript-eslint/strict-boolean-expressions rule as warning #10757

Closed
wants to merge 2 commits into from
Closed
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
24 changes: 20 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ module.exports = {
ecmaFeatures: {
jsx: true,
},
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
plugins: [
'import',
Expand Down Expand Up @@ -56,10 +58,24 @@ module.exports = {
'packages/connect-examples',
'ci/',
'eslint-local-rules/*',
'*.config.js',
'.eslintrc.js',
'.eslintrc.cjs',
],
rules: {
<<<<<<< HEAD
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-require-imports': 'off',
=======
'@typescript-eslint/strict-boolean-expressions': [
'warn',
{
allowString: false,
allowNumber: false,
allowNullableObject: false,
},
],
>>>>>>> 05cf6923bf (chore(suite): add @typescript-eslint/strict-boolean-expressions rule as warning)
'@typescript-eslint/prefer-ts-expect-error': 'error',
// I believe type is enforced by callers.
'@typescript-eslint/explicit-function-return-type': 'off',
Expand Down Expand Up @@ -224,10 +240,10 @@ module.exports = {
// These rules have to do with variable declarations.
'no-label-var': 'error', // disallow labels that share a name with a variable
'no-shadow': 'off', // @typescript-eslint/no-shadow will be used instead
'@typescript-eslint/no-shadow': [
'error',
{ builtinGlobals: true, allow: ['_', 'error', 'resolve', 'reject', 'fetch'] },
], // disallow declaration of variables already declared in the outer scope
// '@typescript-eslint/no-shadow': [
// 'error',
// { builtinGlobals: true, allow: ['_', 'error', 'resolve', 'reject', 'fetch'] },
// ], // disallow declaration of variables already declared in the outer scope
'no-shadow-restricted-names': 'error', // disallow shadowing of names such as arguments
'no-undefined': 'off', // disallow use of undefined variable (off by default)
'no-undef-init': 'error', // disallow use of undefined when initializing variables
Expand Down
5 changes: 5 additions & 0 deletions packages/analytics/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Every package needs to have this ti make sure the eslint uses the local tsconfig and not the global one as most of packages has some custom configurations.

},
};
5 changes: 5 additions & 0 deletions packages/auth-server/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
8 changes: 8 additions & 0 deletions packages/blockchain-link-types/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {
'import/no-extraneous-dependencies': ['error', { includeTypes: true }],
},
};
13 changes: 10 additions & 3 deletions packages/blockchain-link-types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": { "outDir": "libDev" },
"compilerOptions": {
"outDir": "libDev"
},
"include": ["src"],
"references": [
{ "path": "../type-utils" },
{ "path": "../utxo-lib" }
{
"path": "../type-utils"
},
{
"path": "../utxo-lib"
}
]
}
3 changes: 3 additions & 0 deletions packages/blockchain-link-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {
'import/no-extraneous-dependencies': ['error', { includeTypes: true }],
},
Expand Down
4 changes: 4 additions & 0 deletions packages/blockchain-link/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {
camelcase: 'off',
'no-underscore-dangle': 'off',
'no-console': 'warn',
},
ignorePatterns: ['jest.config.*.js'],
};
3 changes: 3 additions & 0 deletions packages/coinjoin/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ module.exports = {
'no-bitwise': 'off',
'no-console': 'warn',
},
parserOptions: {
tsconfigRootDir: __dirname,
},
};
8 changes: 8 additions & 0 deletions packages/components/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {
'import/no-extraneous-dependencies': ['error', { includeTypes: true }],
},
};
5 changes: 5 additions & 0 deletions packages/connect-analytics/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/connect-common/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/connect-explorer-webextension/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
3 changes: 3 additions & 0 deletions packages/connect-explorer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ module.exports = {
],
},
extends: ['plugin:mdx/recommended'],
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/connect-iframe/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/connect-plugin-ethereum/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/connect-plugin-stellar/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/connect-popup/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-shadow
import { test, expect, chromium } from '@playwright/test';
import path from 'path';

Expand Down
5 changes: 5 additions & 0 deletions packages/connect-ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
3 changes: 3 additions & 0 deletions packages/connect-web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ module.exports = {
'no-underscore-dangle': 'off', // underscore is used
camelcase: 'off', // camelcase is used
},
parserOptions: {
tsconfigRootDir: __dirname,
},
};
3 changes: 3 additions & 0 deletions packages/connect-webextension/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module.exports = {
rules: {
'no-underscore-dangle': 'off', // underscore is used
},
parserOptions: {
tsconfigRootDir: __dirname,
},
};
3 changes: 3 additions & 0 deletions packages/connect/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {
'no-bitwise': 'off', // airbnb-base: used in hardending
'no-underscore-dangle': 'off', // underscore is used
Expand Down
5 changes: 5 additions & 0 deletions packages/crypto-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/device-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/dom-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/e2e-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/env-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/ipc-proxy/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/node-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
4 changes: 4 additions & 0 deletions packages/protobuf/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {
'@typescript-eslint/ban-types': 'off', // allow {} in protobuf.d.ts
'@typescript-eslint/no-shadow': 'off',
},
ignorePatterns: ['**/scripts/*'],
};
12 changes: 9 additions & 3 deletions packages/protobuf/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": { "outDir": "libDev" },
"include": ["src"],
"references": [{ "path": "../schema-utils" }]
"compilerOptions": {
"outDir": "libDev"
},
"include": ["src", "tests"],
"references": [
{
"path": "../schema-utils"
}
]
}
5 changes: 5 additions & 0 deletions packages/protocol/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/react-native-usb/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
1 change: 0 additions & 1 deletion packages/react-native-usb/plugins/withUSBDevice.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable require-await */
const { AndroidConfig, withAndroidManifest } = require('expo/config-plugins');

Expand Down
5 changes: 5 additions & 0 deletions packages/react-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/request-manager/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
3 changes: 3 additions & 0 deletions packages/schema-utils/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
rules: {
'no-console': 'warn',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
Expand Down
5 changes: 5 additions & 0 deletions packages/styles/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/suite-analytics/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
1 change: 0 additions & 1 deletion packages/suite-analytics/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export enum AppUpdateEventStatus {
InstallAndRestart = 'install-and-restart',
InstallOnQuit = 'install-on-quit',
Closed = 'closed',
// eslint-disable-next-line @typescript-eslint/no-shadow
Error = 'error',
}

Expand Down
5 changes: 5 additions & 0 deletions packages/suite-build/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
6 changes: 6 additions & 0 deletions packages/suite-data/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
ignorePatterns: ['browser-detection.webpack.ts'],
};
5 changes: 5 additions & 0 deletions packages/suite-desktop-api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
6 changes: 6 additions & 0 deletions packages/suite-desktop-core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
ignorePatterns: ['core.webpack.config.ts', 'scripts'],
};
5 changes: 5 additions & 0 deletions packages/suite-desktop-ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
6 changes: 6 additions & 0 deletions packages/suite-desktop/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
ignorePatterns: ['electron-builder-config.js'],
};
1 change: 1 addition & 0 deletions packages/suite-desktop/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// just here to force ESLint to not complain about not checking anything
5 changes: 5 additions & 0 deletions packages/suite-storage/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
5 changes: 5 additions & 0 deletions packages/suite-web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
},
};
3 changes: 3 additions & 0 deletions packages/suite/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module.exports = {
rules: {
'react/style-prop-object': ['error', { allow: ['FormattedNumber'] }],
},
parserOptions: {
tsconfigRootDir: __dirname,
},
};
Loading
Loading