Skip to content
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
46 changes: 46 additions & 0 deletions eslint.changed.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {defineConfig} from 'eslint/config';
import mainConfig from './eslint.config.mjs';

const config = defineConfig([
...mainConfig,

{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/no-deprecated': 'error',
'rulesdir/no-default-id-values': 'error',
'rulesdir/provide-canBeMissing-in-useOnyx': 'error',
'rulesdir/no-unstable-hook-defaults': 'error',
'no-restricted-syntax': [
'error',
{
selector: 'ImportNamespaceSpecifier[parent.source.value=/^@libs/]',
message: 'Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"',
},
{
selector: 'ImportNamespaceSpecifier[parent.source.value=/^@userActions/]',
message: 'Namespace imports from @userActions are not allowed. Use named imports instead. Example: import { action } from "@userActions/module"',
},
],
},
},

{
files: ['**/libs/**/*.{ts,tsx}'],
rules: {
'no-restricted-syntax': [
'error',
{
selector: 'ImportNamespaceSpecifier[parent.source.value=/^\\.\\./]',
message: 'Namespace imports are not allowed. Use named imports instead. Example: import { method } from "../libs/module"',
},
{
selector: 'ImportNamespaceSpecifier[parent.source.value=/^\\./]',
message: 'Namespace imports are not allowed. Use named imports instead. Example: import { method } from "./libs/module"',
},
],
},
},
]);

export default config;
106 changes: 0 additions & 106 deletions eslint.config.changed.js

This file was deleted.

2 changes: 1 addition & 1 deletion eslint.config.js → eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ const config = defineConfig([
// Rulesdir specific rules
'rulesdir/no-default-props': 'error',
'rulesdir/prefer-type-fest': 'error',
'rulesdir/no-multiple-onyx-in-file': 'off',
'rulesdir/prefer-underscore-method': 'off',
'rulesdir/prefer-import-module-contents': 'off',
'rulesdir/no-beta-handler': 'error',
Expand Down Expand Up @@ -571,6 +570,7 @@ const config = defineConfig([
'docs/assets/**/*',
'web/gtm.js',
'**/.expo/**/*',
'**/.rock/**/*',
'src/libs/SearchParser/searchParser.js',
'src/libs/SearchParser/autocompleteParser.js',
'help/_scripts/**/*',
Expand Down
1 change: 0 additions & 1 deletion scripts/combine-web-sourcemaps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/await-thenable */
import fs from 'fs';
import path from 'path';
import type {RawSourceMap} from 'source-map';
Expand Down
2 changes: 1 addition & 1 deletion scripts/lintChanged.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi
# Run eslint on the changed files
if [[ -n "$GIT_DIFF_OUTPUT" ]] ; then
# shellcheck disable=SC2086 # For multiple files in variable
eslint --max-warnings=0 --config ./eslint.config.changed.js $GIT_DIFF_OUTPUT
eslint --max-warnings=241 --config ./eslint.changed.config.mjs $GIT_DIFF_OUTPUT

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@QichenZhu Is there a reason for raising the warning count again here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

else
info "No TypeScript files changed"
fi
16 changes: 3 additions & 13 deletions src/components/ProductTrainingContext/TOOLTIPS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,10 @@ import {dismissProductTraining} from '@libs/actions/Welcome';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';

const {
CONCIERGE_LHN_GBR,
RENAME_SAVED_SEARCH,
SCAN_TEST_TOOLTIP,
SCAN_TEST_TOOLTIP_MANAGER,
SCAN_TEST_CONFIRMATION,
OUTSTANDING_FILTER,
ACCOUNT_SWITCHER,
SCAN_TEST_DRIVE_CONFIRMATION,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
MULTI_SCAN_EDUCATIONAL_MODAL,
} = CONST.PRODUCT_TRAINING_TOOLTIP_NAMES;
const {CONCIERGE_LHN_GBR, RENAME_SAVED_SEARCH, SCAN_TEST_TOOLTIP, SCAN_TEST_TOOLTIP_MANAGER, SCAN_TEST_CONFIRMATION, OUTSTANDING_FILTER, ACCOUNT_SWITCHER, SCAN_TEST_DRIVE_CONFIRMATION} =
CONST.PRODUCT_TRAINING_TOOLTIP_NAMES;

type ProductTrainingTooltipName = Exclude<ValueOf<typeof CONST.PRODUCT_TRAINING_TOOLTIP_NAMES>, typeof MULTI_SCAN_EDUCATIONAL_MODAL>;
type ProductTrainingTooltipName = Exclude<ValueOf<typeof CONST.PRODUCT_TRAINING_TOOLTIP_NAMES>, typeof CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.MULTI_SCAN_EDUCATIONAL_MODAL>;

type ShouldShowConditionProps = {
shouldUseNarrowLayout: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({

Check warning on line 697 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand Down Expand Up @@ -771,13 +771,13 @@
};

let allBetas: OnyxEntry<OnyxTypes.Beta[]>;
Onyx.connect({

Check warning on line 774 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 780 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -791,7 +791,7 @@
});

let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 794 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -800,7 +800,7 @@
});

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
Onyx.connect({

Check warning on line 803 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -814,7 +814,7 @@
});

let allNextSteps: NonNullable<OnyxCollection<OnyxTypes.ReportNextStep>> = {};
Onyx.connect({

Check warning on line 817 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -823,14 +823,14 @@
});

let allPolicyCategories: OnyxCollection<OnyxTypes.PolicyCategories> = {};
Onyx.connect({

Check warning on line 826 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_CATEGORIES,
waitForCollectionCallback: true,
callback: (val) => (allPolicyCategories = val),
});

const allPolicies: OnyxCollection<OnyxTypes.Policy> = {};
Onyx.connect({

Check warning on line 833 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
callback: (val, key) => {
if (!key) {
Expand Down Expand Up @@ -866,14 +866,14 @@
// `allRecentlyUsedTags` was moved here temporarily from `src/libs/actions/Policy/Tag.ts` during the `Deprecate Onyx.connect` refactor.
// All uses of this variable should be replaced with `useOnyx`.
let allRecentlyUsedTags: OnyxCollection<RecentlyUsedTags> = {};
Onyx.connect({

Check warning on line 869 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS,
waitForCollectionCallback: true,
callback: (val) => (allRecentlyUsedTags = val),
});

let allReports: OnyxCollection<OnyxTypes.Report>;
Onyx.connect({

Check warning on line 876 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -12048,7 +12048,8 @@
onFailure: () => void,
) {
if (!receiptFilename || !receiptPath) {
return;
onFailure();
return Promise.resolve();
}

return readFileAsync(receiptPath.toString(), receiptFilename, onSuccess, onFailure, receiptType);
Expand Down
3 changes: 1 addition & 2 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ function IOURequestStepConfirmation({
let isScanFilesCanBeRead = true;

Promise.all(
// eslint-disable-next-line @typescript-eslint/await-thenable
transactions.map((item) => {
const itemReceiptFilename = getReceiptFilenameFromTransaction(item);
const itemReceiptPath = item.receipt?.source;
Expand All @@ -421,7 +420,7 @@ function IOURequestStepConfirmation({
if (item.receipt) {
newReceiptFiles = {...newReceiptFiles, [item.transactionID]: item.receipt};
}
return;
return Promise.resolve();
}

const onSuccess = (file: File) => {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/iou/request/step/IOURequestStepScan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,12 @@ function IOURequestStepScan({
let isAllScanFilesCanBeRead = true;

Promise.all(
// eslint-disable-next-line @typescript-eslint/await-thenable
transactions.map((item) => {
const itemReceiptPath = item.receipt?.source;
const isLocalFile = isLocalFileFileUtils(itemReceiptPath);

if (!isLocalFile) {
return;
return Promise.resolve();
}

const onFailure = () => {
Expand Down
Loading