-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,234 changed files
with
101,300 additions
and
42,831 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**/node_modules/* | ||
**/dist/* | ||
.github/actions/**/index.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,167 @@ | ||
const restrictedImportPaths = [ | ||
{ | ||
name: 'react-native', | ||
importNames: ['useWindowDimensions', 'StatusBar', 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', 'Pressable'], | ||
message: [ | ||
'', | ||
"For 'useWindowDimensions', please use 'src/hooks/useWindowDimensions' instead.", | ||
"For 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', 'Pressable', please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from 'src/components/Pressable' instead.", | ||
"For 'StatusBar', please use 'src/libs/StatusBar' instead.", | ||
].join('\n'), | ||
}, | ||
{ | ||
name: 'react-native-gesture-handler', | ||
importNames: ['TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight'], | ||
message: "Please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from 'src/components/Pressable' instead.", | ||
}, | ||
]; | ||
|
||
const restrictedImportPatterns = [ | ||
{ | ||
group: ['**/assets/animations/**/*.json'], | ||
message: "Do not import animations directly. Please use the 'src/components/LottieAnimations' import instead.", | ||
}, | ||
]; | ||
|
||
module.exports = { | ||
extends: ['expensify', 'plugin:storybook/recommended', 'plugin:react-hooks/recommended', 'prettier'], | ||
plugins: ['react-hooks'], | ||
extends: ['expensify', 'plugin:storybook/recommended', 'plugin:react-hooks/recommended', 'prettier', 'plugin:react-native-a11y/basic'], | ||
plugins: ['react-hooks', 'react-native-a11y'], | ||
parser: 'babel-eslint', | ||
ignorePatterns: ['!.*', 'src/vendor', '.github/actions/**/index.js', 'desktop/dist/*.js', 'dist/*.js', 'node_modules/.bin/**', '.git/**'], | ||
ignorePatterns: ['!.*', 'src/vendor', '.github/actions/**/index.js', 'desktop/dist/*.js', 'dist/*.js', 'node_modules/.bin/**', 'node_modules/.cache/**', '.git/**'], | ||
env: { | ||
jest: true, | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.website.js', '.desktop.js', '.native.js', '.ios.js', '.android.js', '.config.js'], | ||
}, | ||
}, | ||
}, | ||
globals: { | ||
__DEV__: 'readonly', | ||
}, | ||
rules: { | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
paths: [ | ||
overrides: [ | ||
{ | ||
files: ['*.js', '*.jsx', '*.ts', '*.tsx'], | ||
rules: { | ||
'rulesdir/onyx-props-must-have-default': 'off', | ||
'react-native-a11y/has-accessibility-hint': ['off'], | ||
'react-native-a11y/has-valid-accessibility-descriptors': [ | ||
'error', | ||
{ | ||
name: 'react-native', | ||
importNames: ['useWindowDimensions'], | ||
message: 'Please use useWindowDimensions from src/hooks/useWindowDimensions instead', | ||
touchables: ['PressableWithoutFeedback', 'PressableWithFeedback'], | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['*.js', '*.jsx'], | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.website.js', '.desktop.js', '.native.js', '.ios.js', '.android.js', '.config.js', '.ts', '.tsx'], | ||
}, | ||
}, | ||
}, | ||
rules: { | ||
'import/extensions': [ | ||
'error', | ||
'ignorePackages', | ||
{ | ||
name: 'react-native', | ||
importNames: ['TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight'], | ||
message: 'Please use PressableWithFeedback and/or PressableWithoutFeedback from src/components/Pressable instead', | ||
js: 'never', | ||
jsx: 'never', | ||
ts: 'never', | ||
tsx: 'never', | ||
}, | ||
], | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
name: 'react-native', | ||
importNames: ['StatusBar'], | ||
message: 'Please use StatusBar from src/libs/StatusBar instead', | ||
paths: restrictedImportPaths, | ||
patterns: restrictedImportPatterns, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['*.ts', '*.tsx'], | ||
extends: [ | ||
'airbnb-typescript', | ||
'plugin:@typescript-eslint/recommended-type-checked', | ||
'plugin:@typescript-eslint/stylistic-type-checked', | ||
'plugin:you-dont-need-lodash-underscore/all', | ||
'prettier', | ||
], | ||
plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
rules: { | ||
// TODO: Remove the following rules after TypeScript migration is complete. | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
|
||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: ['variable', 'property'], | ||
format: ['camelCase', 'UPPER_CASE', 'PascalCase'], | ||
}, | ||
{ | ||
selector: 'function', | ||
format: ['camelCase', 'PascalCase'], | ||
}, | ||
{ | ||
selector: ['typeLike', 'enumMember'], | ||
format: ['PascalCase'], | ||
}, | ||
{ | ||
selector: ['parameter', 'method'], | ||
format: ['camelCase'], | ||
}, | ||
], | ||
'@typescript-eslint/ban-types': [ | ||
'error', | ||
{ | ||
types: { | ||
object: "Use 'Record<string, T>' instead.", | ||
}, | ||
extendDefaults: true, | ||
}, | ||
], | ||
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}], | ||
'@typescript-eslint/prefer-enum-initializers': 'error', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'error', | ||
'@typescript-eslint/switch-exhaustiveness-check': 'error', | ||
'@typescript-eslint/consistent-type-definitions': ['error', 'type'], | ||
'@typescript-eslint/no-floating-promises': 'off', | ||
'es/no-nullish-coalescing-operators': 'off', | ||
'es/no-optional-chaining': 'off', | ||
'valid-jsdoc': 'off', | ||
'jsdoc/no-types': 'error', | ||
'import/no-extraneous-dependencies': 'off', | ||
'rulesdir/prefer-underscore-method': 'off', | ||
'rulesdir/prefer-import-module-contents': 'off', | ||
'react/require-default-props': 'off', | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: 'TSEnumDeclaration', | ||
message: "Please don't declare enums, use union types instead.", | ||
}, | ||
], | ||
'no-restricted-imports': [ | ||
'error', | ||
{ | ||
paths: [ | ||
...restrictedImportPaths, | ||
{ | ||
name: 'underscore', | ||
message: 'Please use the corresponding method from lodash instead', | ||
}, | ||
], | ||
patterns: restrictedImportPatterns, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
name: Design Doc Project Issue Template | ||
about: A template to follow when creating a new issue related to a design doc project | ||
--- | ||
|
||
# Part of the <Project Name> project | ||
Main issue: <Issue Link> | ||
Doc section: <Doc Link> | ||
Project: <Project Link> | ||
|
||
# Feature Description | ||
<!-- Describe the section of the doc that this issue is covering, along with any relevant screenshots --> | ||
|
||
# Manual Test Steps | ||
|
||
# Automated Tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.