Skip to content

Commit

Permalink
Merge pull request #40778 from software-mansion-labs/ts/eslint-typesc…
Browse files Browse the repository at this point in the history
…ript-config

[No QA][TS migration] Adjust ESLint and TS configs
  • Loading branch information
roryabraham authored May 14, 2024
2 parents 819e610 + 6f2f703 commit b7dcc5e
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 242 deletions.
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,
"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
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'],
},
};

0 comments on commit b7dcc5e

Please sign in to comment.