Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 48 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# More information about envs and how the flow is set up
# can be found in src/services/appConfig/README.md

# use this for additional debug option
# possible values: true, false, 1, 0 or undefined
REACT_APP_DEBUG=

# use this for tweak API url
# possible values: string values or undefined
REACT_APP_API_URL=

# use this for API authentication
# possible values: string values or undefined
REACT_APP_API_KEY=

# the email to sign automatically in with when in dev mode
# if not specified or not in dev mode, the auto-sign-in feature is inactive
#
# possible values: string values or undefined
REACT_APP_DEV_AUTO_SIGN_IN_EMAIL=

# the password to automatically sign in with when in dev mode
# if not specified or not in dev mode, the auto-sign-in feature is inactive
#
# possible values: string values or undefined
REACT_APP_DEV_AUTO_SIGN_IN_PASSWORD=

# the boolean flag to skip input validation on login screen when in dev mode
# if not specified or not in dev mode, the input validation remains enabled
#
# possible values: true, false, 1, 0 or undefined
REACT_APP_SKIP_LOGIN_INPUTS_VALIDATION=

# the boolean flag that forces to show the login screen & make the user log in manually
# if not specified, a false is assumed by default
# useful for testing environment
#
# possible values: true, false or undefined
REACT_APP_FORCE_LOGIN_SCREEN=

# the numeric flag in ms that overrides the default
# if not specified, a default value is used
# useful for testing environment
#
# possible values: number or undefined
REACT_APP_OVERRIDE_SPLASH_SCREEN_DURATION_MS=

# REACT_APP_VERSION is set automatically by scripts/get-current-commit.sh
15 changes: 15 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Build output
build/
dist/

# Node modules
node_modules/

# Coverage directory
coverage/

# Config files
*.config.js

# Shaka Player files
src/w3cmedia/App*
src/w3cmedia/shakaplayer/dist
src/w3cmedia/polyfills

# ESLint plugins
plugins/
228 changes: 228 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
const storagePattern = {
group: ['@react-native-async-storage/*'],
message:
"\n\nImport of @react-native-async-storage is allowed only in 'src/services/storage'. \n\nUse `import { DeviceStorage } from '@AppServices/storage'` instead",
};

const deviceInfoPattern = {
group: [
'@amazon-devices/react-native-device-info',
'@amazon-devices/react-native-device-info/*',
],
message:
"\n\nImport of @amazon-devices/react-native-device-info is allowed only in 'src/services/deviceInfo'. \n\nUse `import { DeviceInfo } from '@AppServices/deviceInfo'` instead",
};

const netInfoPattern = {
group: [
'@amazon-devices/keplerscript-netmgr-lib',
'@amazon-devices/keplerscript-netmgr-lib/*',
],
message:
"\n\nImport of @amazon-devices/keplerscript-netmgr-lib is allowed only in 'src/services/netInfo'. \n\nUse `import { NetInfo } from '@AppServices/netInfo'` instead",
};

const appConfigPattern = {
group: ['@AppEnvs'],
message:
"\n\nImport envs is allowed only in 'src/services/appConfig'. \n\nUse `import { AppEnvs } from '@AppServices/appConfig'` instead",
};

const keplerUiComponentsGroup = {
group: ['@amazon-devices/kepler-ui-components'],
message:
"\n\nImport Kepler UI component is allowed only in 'src/components/core' and 'src/theme'.\n\nImport needed component from '@AppComponents/core",
};

const tvFocusGuideViewPath = {
name: '@amazon-devices/react-native-kepler',
importNames: ['TVFocusGuideView'],
message: 'Please use FocusGuideView from @AppServices/focusGuide instead',
};

const useTVEventHandlerPath = {
name: '@amazon-devices/react-native-kepler',
importNames: ['useTVEventHandler'],
message:
'Please use useFocusGuideEventHandler from @AppServices/focusGuide instead',
};

const rules = {
'react-compiler/react-compiler': 'error',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
pathGroups: [
{
pattern: '@App*',
group: 'parent',
position: 'before',
},
{
pattern: '@App*/**',
group: 'parent',
position: 'before',
},
{
pattern: './**',
group: 'parent',
position: 'after',
},
],
alphabetize: {
order: 'asc',
caseInsensitive: false,
},
distinctGroup: false,
'newlines-between': 'always',
warnOnUnassignedImports: true,
},
],
'no-restricted-imports': [
'error',
{
paths: [tvFocusGuideViewPath, useTVEventHandlerPath],
patterns: [
storagePattern,
deviceInfoPattern,
netInfoPattern,
appConfigPattern,
keplerUiComponentsGroup,
],
},
],
'react-native/no-raw-text': [
'error',
{
skip: ['Typography'],
},
],
'no-console': 'error',
'no-restricted-properties': [
'error',
{
object: 'console',
property: 'log',
message: 'Please use `logDebug` from `@AppUtils/logging`',
},
{
object: 'console',
property: 'warn',
message: 'Please use `logWarning` from `@AppUtils/logging`',
},
{
object: 'console',
property: 'error',
message: 'Please use `logError` from `@AppUtils/logging`',
},
],
curly: ['error'],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'react-native-a11y/has-accessibility-hint': 'off',
'react-native-a11y/has-valid-accessibility-descriptors': 'off', // eslint-plugin-amzn-a11y rule is used instead
'amzn-a11y/no-inferior-a11y-props': 'error',
'amzn-a11y/no-missing-a11y-props': 'error',
};

const overrides = [
{
files: ['src/services/storage/**/*'],
rules: {
'no-restricted-imports': [
'off',
{
patterns: [storagePattern],
},
],
},
},
{
files: ['src/services/deviceInfo/**/*'],
rules: {
'no-restricted-imports': [
'off',
{
patterns: [deviceInfoPattern],
},
],
},
},
{
files: ['src/services/netInfo/**/*'],
rules: {
'no-restricted-imports': [
'off',
{
patterns: [netInfoPattern],
},
],
},
},
{
files: ['src/services/appConfig/**/*'],
rules: {
'no-restricted-imports': [
'off',
{
patterns: [appConfigPattern],
},
],
},
},
{
files: ['src/components/core/**/*', 'src/theme/**/*'],
rules: {
'no-restricted-imports': [
'off',
{
patterns: [keplerUiComponentsGroup],
},
],
},
},
{
files: ['src/**/*.test.tsx', 'src/**/*.spec.tsx'],
rules: {
'react-native/no-color-literals': ['off'],
'react-native/no-inline-styles': ['off'],
},
},
{
files: ['src/services/focusGuide/**/*'],
rules: {
'no-restricted-imports': [
'off',
{
paths: [tvFocusGuideViewPath, useTVEventHandlerPath],
},
],
},
},
];

module.exports = {
root: true,
extends: ['@callstack', 'plugin:react-native-a11y/basic'],
plugins: [
'@typescript-eslint',
'import',
'amzn-a11y',
'eslint-plugin-react-compiler',
],
rules,
overrides,
parserOptions: {
project: './tsconfig.json',
},
parser: '@typescript-eslint/parser',
settings: {
'import/resolver': 'typescript',
/**
* below is to make all `@` imports internal to make sure we can
* group them (external imports cannot be group with `groupPath`)
*/
'import/internal-regex': '^@(.*?)/',
},
};
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
legacy-peer-deps
engine-strict=true
unsafe-perm=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.18.1
18 changes: 17 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
src/w3cmedia/shakaplayer/dist
# Build output
build/
dist/

# Node modules
node_modules/

# Coverage directory
coverage/

# Logs
*.log

# Shaka Player files
src/w3cmedia/polyfills/*
src/w3cmedia/shakaplayer/dist/*
src/w3cmedia/App*.tsx
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
bracketSameLine: true,
bracketSpacing: true,
singleQuote: true,
trailingComma: "all",
tabWidth: 2,
};
Loading