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

[No QA][TS migration] Adjust ESLint and TS configs #40778

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
51f2ed3
Update .github eslint config
blazejkustra Apr 23, 2024
422e872
Update tests eslint config
blazejkustra Apr 23, 2024
8d61837
Create workflow tests eslint config
blazejkustra Apr 23, 2024
df3e91c
Remove overrides for workflow tests
blazejkustra Apr 23, 2024
bce33e4
Remove overrides for tests
blazejkustra Apr 23, 2024
b65414b
Move no-restricted-imports to common ruleset
blazejkustra Apr 23, 2024
0748762
fix no-restricted-imports, put it in the right section
blazejkustra Apr 23, 2024
2d214d7
Remove ignorePatterns from eslint config and update eslintignore
blazejkustra Apr 23, 2024
6e8a2be
Fix android build ignore line
blazejkustra Apr 23, 2024
c5a1f72
Clean up eslint config
blazejkustra Apr 23, 2024
25b2935
Add temporary config for js files
blazejkustra Apr 23, 2024
af17bf5
Ignore config files and docs/assets
blazejkustra Apr 23, 2024
b6f605d
Ignore other js eslint errors
blazejkustra Apr 23, 2024
57d2950
Clean up tsconfig
blazejkustra Apr 23, 2024
56395cd
Fix imports inside eslint config
blazejkustra Apr 23, 2024
76b1780
Add missing endline
blazejkustra Apr 23, 2024
a06de12
Build GH actions
blazejkustra Apr 23, 2024
85ff452
Add gtm.js to eslintignore
blazejkustra Apr 24, 2024
b47c28b
Add comments with explanation about last JS components
blazejkustra Apr 24, 2024
88a1e5b
Merge branch 'main' into ts/eslint-typescript-config
blazejkustra Apr 24, 2024
d5083d2
Merge branch 'main' into ts/eslint-typescript-config
blazejkustra Apr 25, 2024
a37b660
Merge branch 'main' into ts/eslint-typescript-config
blazejkustra Apr 26, 2024
4c00bca
Merge branch 'main' into ts/eslint-typescript-config
blazejkustra May 6, 2024
7e7be1d
Add testing-library rules that were removed in the last merge
blazejkustra May 6, 2024
9cdbda3
Rerun GH workflows
blazejkustra May 6, 2024
5f36384
Add empty lien to eslintignore
blazejkustra May 6, 2024
84117ae
Merge branch 'main' into ts/eslint-typescript-config
blazejkustra May 6, 2024
2cb2c5f
Bring back module: commonjs in tsconfig
blazejkustra May 6, 2024
3468278
Merge branch 'main' into ts/eslint-typescript-config
blazejkustra May 6, 2024
ccfd44b
Fix failing workflow
blazejkustra May 6, 2024
5ebca88
Merge branch 'main' into ts/eslint-typescript-config
blazejkustra May 13, 2024
7f6763c
Adjust ESLint configuration
blazejkustra May 13, 2024
6f2f703
Merge branch 'main' into ts/eslint-typescript-config
blazejkustra May 13, 2024
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
14 changes: 10 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
**/node_modules/*
**/dist/*
android/**/build/*
.github/actions/**/index.js"
!.storybook
!.github
.github/actions/**/index.js
*.config.js
**/.eslintrc.js
**/node_modules/**
**/dist/**
android/**/build/**
docs/vendor/**
docs/assets/**
web/gtm.js
371 changes: 164 additions & 207 deletions .eslintrc.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .github/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// For all these Node.js scripts, we do not want to disable `console` statements
module.exports = {
rules: {
// For all these Node.js scripts, we do not want to disable `console` statements
'no-console': 'off',

'@lwc/lwc/no-async-await': 'off',
'no-await-in-loop': 'off',
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],
},
};
1 change: 1 addition & 0 deletions src/components/tagPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const tagListPropTypes = PropTypes.shape({
enabled: PropTypes.bool.isRequired,

/** "General Ledger code" that corresponds to this tag in an accounting system. Similar to an ID. */
// eslint-disable-next-line @typescript-eslint/naming-convention
'GL Code': PropTypes.string,
});

Expand Down
2 changes: 1 addition & 1 deletion src/pages/EnablePayments/IdologyQuestions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {useState} from 'react';
import {View} from 'react-native';
import type {WalletAdditionalQuestionDetails} from 'src/types/onyx';
import FormProvider from '@components/Form/FormProvider';
import InputWrapper from '@components/Form/InputWrapper';
import type {FormInputErrors, FormOnyxValues} from '@components/Form/types';
Expand All @@ -13,6 +12,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import * as BankAccounts from '@userActions/BankAccounts';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {WalletAdditionalQuestionDetails} from '@src/types/onyx';
import type {Errors} from '@src/types/onyx/OnyxCommon';

const MAX_SKIP = 1;
Expand Down
16 changes: 16 additions & 0 deletions tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
module.exports = {
extends: ['plugin:testing-library/react'],
rules: {
'no-import-assign': 'off',
'@lwc/lwc/no-async-await': 'off',
'no-await-in-loop': 'off',
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],

// This helps disable the `prefer-alias` rule for tests
'@dword-design/import-alias/prefer-alias': ['off'],

'testing-library/await-async-queries': 'error',
'testing-library/await-async-utils': 'error',
'testing-library/no-debugging-utils': 'error',
'testing-library/no-manual-cleanup': 'error',
'testing-library/no-unnecessary-act': 'error',
'testing-library/prefer-find-by': 'error',
'testing-library/prefer-presence-queries': 'error',
'testing-library/prefer-screen-queries': 'error',
},
};
30 changes: 2 additions & 28 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,12 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "expo/tsconfig.base",
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"types": ["react-native", "jest"],
"lib": [
"DOM",
"es2019",
"es2020.bigint",
"es2020.date",
"es2020.number",
"es2020.promise",
"es2020.string",
"es2020.symbol.wellknown",
"es2021.promise",
"es2021.string",
"es2021.weakref",
"es2022.array",
"es2022.object",
"es2022.string",
"ES2021.Intl",
"ES2023.Array"
],
"allowJs": true,
"checkJs": false,
"jsx": "react-native",
"noEmit": true,
"isolatedModules": true,
"strict": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
blazejkustra marked this conversation as resolved.
Show resolved Hide resolved
"incremental": true,
"baseUrl": ".",
"paths": {
Expand All @@ -48,7 +23,6 @@
"@userActions/*": ["./src/libs/actions/*"]
}
},
"exclude": ["**/node_modules/*", "**/dist/*", ".github/actions/**/index.js", "**/docs/*"],
"include": ["src", "desktop", "web", "website", "docs", "assets", "config", "tests", "jest", "__mocks__", ".github/**/*", ".storybook/**/*", "workflow_tests", "scripts"],
"extends": "expo/tsconfig.base"
"exclude": ["**/node_modules/*", "**/dist/*", ".github/actions/**/index.js", "**/docs/*"]
}
1 change: 0 additions & 1 deletion web/gtm.js
blazejkustra marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign, prefer-template */
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
Expand Down
7 changes: 7 additions & 0 deletions workflow_tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
rules: {
'@lwc/lwc/no-async-await': 'off',
'no-await-in-loop': 'off',
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],
},
};
8 changes: 4 additions & 4 deletions workflow_tests/assertions/platformDeployAssertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@ function assertPostGithubCommentJobExecuted(workflowResult: Step[], didExecute =
{key: 'IS_PRODUCTION_DEPLOY', value: isProduction ? 'true' : 'false'},
{key: 'DEPLOY_VERSION', value: '1.2.3'},
{key: 'GITHUB_TOKEN', value: '***'},
{key: 'ANDROID', value: didDeploy ? 'success' : ''},
{key: 'DESKTOP', value: didDeploy ? 'success' : ''},
{key: 'IOS', value: didDeploy ? 'success' : ''},
{key: 'WEB', value: didDeploy ? 'success' : ''},
{key: 'ANDROID', value: didDeploy ? 'success' : 'skipped'},
{key: 'DESKTOP', value: didDeploy ? 'success' : 'skipped'},
{key: 'IOS', value: didDeploy ? 'success' : 'skipped'},
{key: 'WEB', value: didDeploy ? 'success' : 'skipped'},
]),
] as const;

Expand Down
Loading