Skip to content

Commit

Permalink
chore: explicitly set remaining prettier options (brave#20597)
Browse files Browse the repository at this point in the history
* chore: explicitly set remaining prettier options

* chore: apply prettier formatting to Brave Wallet

* chore: reduce long lines in Brave Wallet
  • Loading branch information
josheleonard authored Nov 1, 2023
1 parent 8771908 commit b2a19a6
Show file tree
Hide file tree
Showing 748 changed files with 22,526 additions and 19,053 deletions.
29 changes: 27 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,37 @@ module.exports = {
'@typescript-eslint/consistent-type-definitions': 0,
'multiline-ternary': 0,
'@typescript-eslint/prefer-readonly': 0,
'@typescript-eslint/key-spacing': 0,
/* TODO(nullhook): ENABLE the below rules in the future */
'no-useless-call': 0,
'@typescript-eslint/consistent-type-assertions': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-invalid-void-type': 0,
'prefer-const': 0,
'@typescript-eslint/return-await': 0
}
'@typescript-eslint/return-await': 0,
},
"overrides": [
{
// opt-in directories for line length warnings
"files": [
"components/brave_wallet/**/*.js",
"components/brave_wallet/**/*.ts",
"components/brave_wallet/**/*.tsx",
"components/brave_wallet_ui/**/*.js",
"components/brave_wallet_ui/**/*.ts",
"components/brave_wallet_ui/**/*.tsx"
],
"rules": {
'max-len': [
1,
{
'code': 80,
'ignoreStrings': true, // to allow long import paths
'ignoreUrls': true, // allow URLs to be clickable
'ignoreRegExpLiterals': true,
}
],
}
}
]
}
83 changes: 83 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Ignored files identified within .gitignore:
/vendor/*
/components/brave_new_tab_ui/data/LICENSE
/components/brave_webtorrent/extension/out/
/components/brave_rewards/resources/extension/brave_rewards/out/
/components/third_party/adblock/LICENSE
/components/third_party/local_data/LICENSE
/dist/
/out/
node_modules/
/third_party/
.vs/
.vscode/
.npmrc
.env
cmake-build-debug/
coverage/
/build/rustup/
venv/
.storybook-out

# Ignore version control files
**/.git
**/.svn
**/.hg

# Ignore node_modules
**/node_modules


# Ignore HTML Files - incompatable with presubmit rules
*.html

# Ignore non-component top level folders (remove to opt-in):
/android
/app
/base
/brave_domains
/browser
/build
/chromium_src
/common
/content
/coverage
/docs
/extensions
/fuzzers
/installer
/ios
/mojo
/mojo/brave_ast_patcher
/net
/node_modules
/patches
/renderer
/resources
/sandbox
/script
/services
/test
/third_party
/tools
/ui
/utility
/v8
/vector_icons
/vendor
/win_build_output

# Ignore github .yml files:
.github/**/*.yml

# Ignored markdown files:
.github/PULL_REQUEST_TEMPLATE.md
CONTRIBUTING.md
README.md

# Ignored top-level files:
.clang-tidy
chromium_presubmit_config.json5

# Ignored minified javascript
components/brave_wallet/resources/solana_web3_script.js
21 changes: 20 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,31 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

/** @type {import("prettier").Config} */
module.exports = {
'trailingComma': 'none',
'tabWidth': 2,
'semi': false,
'singleQuote': true,
'jsxSingleQuote': true,
'bracketSameLine': false,
'quoteProps': 'preserve'
'quoteProps': 'preserve',
'arrowParens': 'always',
'bracketSpacing': true,
'embeddedLanguageFormatting': 'auto',
'endOfLine': 'lf',
'htmlWhitespaceSensitivity': 'css',
'insertPragma': false,
'plugins': [],
'pluginSearchDirs': false,
'printWidth': 80,
'proseWrap': 'always',
'rangeEnd': Infinity,
'rangeStart': 0,
'requirePragma': false,
'useTabs': false,
'vueIndentScriptAndStyle': false,
'jsxBracketSameLine': false,
'singleAttributePerLine': true,
'overrides': undefined
}
6 changes: 2 additions & 4 deletions .storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"presets": [
"@babel/preset-react"
],
"presets": ["@babel/preset-react"],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-syntax-dynamic-import"
]
}
}
4 changes: 3 additions & 1 deletion .storybook/chrome-resources-mock/js/cr.m.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export function addWebUIListener(eventName: string, handler: Function) {}
export function sendWithPromise(message: string, ...args: any[]): Promise<any> { return new Promise(resolve => console.log('sendWithPromise', message, args)) }
export function sendWithPromise(message: string, ...args: any[]): Promise<any> {
return new Promise((resolve) => console.log('sendWithPromise', message, args))
}
107 changes: 69 additions & 38 deletions .storybook/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
let locale: Record<string, string> = {
about: 'about',
accept: 'Accept',
activityCopy: ' Brave Software. Brave is a registered trademark of Brave Software. Site names may be trademarks or registered trademarks of the site owner.',
activityNote: 'To protect your privacy, this Brave Rewards statement is not saved, recorded or logged anywhere other than on your device (this computer). It cannot be retrieved from Brave in the event of data loss on your device.',
activityCopy:
' Brave Software. Brave is a registered trademark of Brave Software. Site names may be trademarks or registered trademarks of the site owner.',
activityNote:
'To protect your privacy, this Brave Rewards statement is not saved, recorded or logged anywhere other than on your device (this computer). It cannot be retrieved from Brave in the event of data loss on your device.',
ads: 'Ads',
ad: 'Ad',
adsCurrentlyViewing: 'Your setting: maximum ads per hour: ',
adsEarnings: 'earned from ads',
adsHistoryFilterAll: 'All',
adsHistoryFilterSaved: 'Saved',
adsHistorySubTitle: 'Ads you\'ve received in the past {{totalDays}} days',
adsHistorySubTitle: "Ads you've received in the past {{totalDays}} days",
adsHistoryTitle: 'Ads History',
adsNotSupportedRegion: 'Sorry! Ads are not yet available in your region.',
all: 'All',
Expand All @@ -24,14 +26,17 @@ let locale: Record<string, string> = {
backupWalletTitle: 'Backup Wallet',
balanceUnavailable: 'Unavailable',
bat: 'BAT',
braveAdsDesc: 'No action required. Just collect tokens. Your data is safe with our Shields.',
braveAdsDesc:
'No action required. Just collect tokens. Your data is safe with our Shields.',
braveAdsTitle: 'Brave Ads',
braveAdsLaunchTitle: 'Brave Ads has arrived!',
braveContributeDesc: 'Set budget and browse normally. Your favorite sites get paid automatically.',
braveContributeDesc:
'Set budget and browse normally. Your favorite sites get paid automatically.',
braveContributeTitle: 'Auto-Contribute',
braveRewards: 'Brave Rewards',
braveRewardsDesc: 'Earn tokens for viewing privacy-respecting ads, and pay it forward by supporting content creators you love!',
braveRewardsOptInText: 'Yes, I\'m In!',
braveRewardsDesc:
'Earn tokens for viewing privacy-respecting ads, and pay it forward by supporting content creators you love!',
braveRewardsOptInText: "Yes, I'm In!",
braveRewardsSubTitle: 'Get Rewarded for Browsing!',
braveRewardsTeaser: 'How it works...',
braveRewardsTitle: 'Brave Rewards',
Expand All @@ -56,9 +61,12 @@ let locale: Record<string, string> = {
details: 'Details',
disabledPanelOff: 'Off',
disabledPanelSettings: 'Settings.',
disabledPanelPrivateText: 'Brave Rewards is not available while in a Private Window.',
disabledPanelText: 'You are not currently accruing any Rewards benefits while browsing. Turn Rewards back on in',
disabledPanelTextTwo: 'Earn by viewing privacy-respecting ads, and pay it forward to support content creators you love.',
disabledPanelPrivateText:
'Brave Rewards is not available while in a Private Window.',
disabledPanelText:
'You are not currently accruing any Rewards benefits while browsing. Turn Rewards back on in',
disabledPanelTextTwo:
'Earn by viewing privacy-respecting ads, and pay it forward to support content creators you love.',
disabledPanelTitle: 'Brave Rewards is',
dismiss: 'Closed',
dndCaptchaText1: 'Drag and drop the token logo onto the',
Expand All @@ -82,7 +90,8 @@ let locale: Record<string, string> = {
grants: 'Grants',
grantAmountTitleUGP: 'New Token Grant',
grantDateTitleUGP: 'Grant Expiration Date',
grantDisclaimer: 'Unused tokens by the expiration date will be automatically returned to the Brave User Growth Pool.',
grantDisclaimer:
'Unused tokens by the expiration date will be automatically returned to the Brave User Growth Pool.',
grantExpire: 'Grant Expiration Date',
import: 'import',
includeInAuto: 'Include in Auto-Contribute',
Expand Down Expand Up @@ -122,18 +131,21 @@ let locale: Record<string, string> = {
payment: 'Payment',
paymentNotMade: 'Payment not made.',
pinnedSitesHeader: 'Pinned sites are now',
pinnedSitesMsg: 'Here\'s how monthly tips work:',
pinnedSitesOne: 'Monthly tips do not come out of your Auto-Contribute payment. They\'re separate.',
pinnedSitesMsg: "Here's how monthly tips work:",
pinnedSitesOne:
"Monthly tips do not come out of your Auto-Contribute payment. They're separate.",
pinnedSitesTwo: 'Each site is paid a fixed amount monthly.',
pinnedSitesThree: 'Monthly tips are paid out all at once, each month. If you\'re using Auto-Contribute, tips go out at the same time as your monthly Auto-Contribute payment.',
pinnedSitesFour: 'You can remove any site receiving monthly tips from inside of the Tips panel.',
pinnedSitesThree:
"Monthly tips are paid out all at once, each month. If you're using Auto-Contribute, tips go out at the same time as your monthly Auto-Contribute payment.",
pinnedSitesFour:
'You can remove any site receiving monthly tips from inside of the Tips panel.',
pleaseNote: 'Please note:',
print: 'Print',
privacyPolicy: 'Privacy Policy',
processingRequest: 'You will be redirected shorty to verify your wallet.',
processingRequestButton: 'Try again',
readyToTakePart: 'Ready to get started?',
readyToTakePartOptInText: 'Yes I\'m Ready!',
readyToTakePartOptInText: "Yes I'm Ready!",
readyToTakePartStart: 'You can start with the',
reconnectWallet: 'Reconnect wallet',
recurring: 'Recurring',
Expand All @@ -146,10 +158,11 @@ let locale: Record<string, string> = {
clearExcludeList: 'Clear exclude list',
removeFromExcluded: 'Remove from excluded',
reviewSitesMsg: 'Your pinned sites have been moved to',
rewardsBannerText1: 'Thanks for stopping by. We joined Brave’s vision of protecting your privacy because we believe that fans like you would support us in our effort to keep the web a clean and safe place to be.',
rewardsBannerText1:
'Thanks for stopping by. We joined Brave’s vision of protecting your privacy because we believe that fans like you would support us in our effort to keep the web a clean and safe place to be.',
rewardsContribute: 'Auto-Contribute',
rewardsContributeAttention: 'Attention',
rewardsExcludedText1: 'You\'ve excluded',
rewardsExcludedText1: "You've excluded",
rewardsExcludedText2: 'sites from Auto-Contribute.',
rewardsSummary: 'Rewards Summary',
rewardsWidgetBraveRewards: 'Brave Rewards',
Expand All @@ -159,11 +172,16 @@ let locale: Record<string, string> = {
seeAllSites: 'See all {{numSites}} sites',
sendDonation: 'Send my donation',
sendTip: 'Send my Contribution',
serviceText: 'By clicking \'Enable Brave Rewards\', you indicate that you have read and agree to the',
serviceTextToggle: 'By turning on Brave Rewards, you indicate that you have read and agree to the',
serviceTextPanelWelcome: 'By clicking ‘Join Rewards’, you indicate that you have read and agree to the',
serviceTextWelcome: 'By clicking ‘Yes, I\'m in!’, you indicate that you have read and agree to the',
serviceTextReady: 'By clicking ‘Yes, I\'m Ready!’, you indicate that you have read and agree to the',
serviceText:
"By clicking 'Enable Brave Rewards', you indicate that you have read and agree to the",
serviceTextToggle:
'By turning on Brave Rewards, you indicate that you have read and agree to the',
serviceTextPanelWelcome:
'By clicking ‘Join Rewards’, you indicate that you have read and agree to the',
serviceTextWelcome:
"By clicking ‘Yes, I'm in!’, you indicate that you have read and agree to the",
serviceTextReady:
"By clicking ‘Yes, I'm Ready!’, you indicate that you have read and agree to the",
set: 'Set...',
setContribution: 'Set Contribution',
settings: 'Settings',
Expand All @@ -185,14 +203,16 @@ let locale: Record<string, string> = {
total: 'Total',
transactions: 'Transactions',
turnOnAds: 'Turn on Ads',
turnOnRewardsDesc: 'This enables both Brave Ads and Auto-Contribute. You can always opt out each any time.',
turnOnRewardsDesc:
'This enables both Brave Ads and Auto-Contribute. You can always opt out each any time.',
turnOnRewardsTitle: 'Turn on Rewards',
tweetNow: 'Tweet',
type: 'Type',
uhOh: 'Uh oh…',
unVerifiedCheck: 'Refresh status',
unVerifiedPublisher: 'Unverified',
unVerifiedText: 'This creator has not yet signed up to receive contributions from Brave users.',
unVerifiedText:
'This creator has not yet signed up to receive contributions from Brave users.',
unVerifiedTextMore: 'Learn more.',
verifiedPublisher: 'Verified Creator',
verifyWalletTitle: 'Verify your wallet',
Expand All @@ -213,27 +233,37 @@ let locale: Record<string, string> = {
walletDisconnect: 'Log out from Brave Rewards',
walletVerificationButton: 'Verify wallet',
walletVerificationFooter: 'Our wallet service is provided by Uphold',
walletVerificationList1: 'Withdraw BAT that you earn from viewing privacy-respecting ads',
walletVerificationList2: 'Purchase additional BAT with credit cards and other sources',
walletVerificationList3: 'Withdraw BAT that you may have previously added to your Brave Rewards wallet',
walletVerificationList1:
'Withdraw BAT that you earn from viewing privacy-respecting ads',
walletVerificationList2:
'Purchase additional BAT with credit cards and other sources',
walletVerificationList3:
'Withdraw BAT that you may have previously added to your Brave Rewards wallet',
walletVerificationListHeader: 'Benefits of verifying',
walletVerificationNote1: 'Uphold may require you to verify your identity based on services requested.',
walletVerificationNote2: 'Brave Software Inc. does not process, store, or access any of the personal information that you provide to Uphold when you establish an account with them.',
walletVerificationNote1:
'Uphold may require you to verify your identity based on services requested.',
walletVerificationNote2:
'Brave Software Inc. does not process, store, or access any of the personal information that you provide to Uphold when you establish an account with them.',
walletVerificationTitle1: 'Ready to verify your wallet?',
walletVerified: 'Verified',
welcome: 'Welcome!',
welcomeBack: 'Welcome Back!',
welcomeButtonTextOne: 'Start Earning Now!',
welcomeButtonTextTwo: 'Join Rewards',
welcomeDescOne: 'You can now earn tokens for watching privacy focused Brave Ads. Your contribution stays the same.',
welcomeDescTwo: 'Earn tokens for watching Ads and pay it forward to your favorite content creators.',
welcomeDescOne:
'You can now earn tokens for watching privacy focused Brave Ads. Your contribution stays the same.',
welcomeDescTwo:
'Earn tokens for watching Ads and pay it forward to your favorite content creators.',
welcomeFooterTextOne: 'Check out what’s improved',
welcomeFooterTextTwo: 'Learn More',
welcomeHeaderOne: 'Brave Payments is now Brave Rewards with many upgrades.',
welcomeHeaderTwo: 'You are about to start a very Brave way to browse the web.',
welcomeHeaderTwo:
'You are about to start a very Brave way to browse the web.',
whyBraveRewards: 'Why Brave Rewards?',
whyBraveRewardsDesc1: 'With conventional browsers, you pay to browse the web by viewing ads with your valuable attention, spending your valuable time downloading invasive ad technology, that transmits your valuable private data to advertisers — without your consent.',
whyBraveRewardsDesc2: 'Well, you\'ve come to the right place. Brave welcomes you to the new internet. One where your time is valued, your personal data is kept private, and you actually get paid for your attention.',
whyBraveRewardsDesc1:
'With conventional browsers, you pay to browse the web by viewing ads with your valuable attention, spending your valuable time downloading invasive ad technology, that transmits your valuable private data to advertisers — without your consent.',
whyBraveRewardsDesc2:
"Well, you've come to the right place. Brave welcomes you to the new internet. One where your time is valued, your personal data is kept private, and you actually get paid for your attention.",
whyHow: 'Why & How',
yourWallet: 'Your wallet',
// New Tab Page
Expand All @@ -254,17 +284,18 @@ let locale: Record<string, string> = {
showClock: 'Show Clock',
showTopSites: 'Show Top Sites',
showRewards: 'Show Rewards',
tosAndPp: 'By turning on {{title}}, you agree to the $1Terms of Service$2 and $3Privacy Policy$4.',
tosAndPp:
'By turning on {{title}}, you agree to the $1Terms of Service$2 and $3Privacy Policy$4.',
editCardsTitle: 'Edit Cards'
}

export function provideStrings (strings: Record<string, string>) {
export function provideStrings(strings: Record<string, string>) {
locale = {
...locale,
...strings
}
}

export function getString (key: string): string {
export function getString(key: string): string {
return locale[key] || key
}
Loading

0 comments on commit b2a19a6

Please sign in to comment.