diff --git a/.vscode/settings.json b/.vscode/settings.json index 7ef7e6b6..7625aed5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,22 +1,20 @@ { "editor.formatOnSave": true, - "xo.enable": true, - "xo.format.enable": true, "typescript.tsdk": "node_modules/typescript/lib", "typescript.preferences.importModuleSpecifier": "non-relative", // formatting "[typescript]": { - "editor.defaultFormatter": "samverschueren.linter-xo" + "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[typescriptreact]": { - "editor.defaultFormatter": "samverschueren.linter-xo" + "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[javascript]": { - "editor.defaultFormatter": "samverschueren.linter-xo" + "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[javascriptreact]": { - "editor.defaultFormatter": "samverschueren.linter-xo" + "editor.defaultFormatter": "esbenp.prettier-vscode" } } diff --git a/.yarn/cache/@eslint-community-regexpp-npm-4.12.2-3d54624470-1770bc81f6.zip b/.yarn/cache/@eslint-community-regexpp-npm-4.12.2-3d54624470-1770bc81f6.zip new file mode 100644 index 00000000..cc59c7cd Binary files /dev/null and b/.yarn/cache/@eslint-community-regexpp-npm-4.12.2-3d54624470-1770bc81f6.zip differ diff --git a/.yarn/cache/@types-semver-npm-7.7.1-1a46d6e2dd-76d218e414.zip b/.yarn/cache/@types-semver-npm-7.7.1-1a46d6e2dd-76d218e414.zip new file mode 100644 index 00000000..97bef291 Binary files /dev/null and b/.yarn/cache/@types-semver-npm-7.7.1-1a46d6e2dd-76d218e414.zip differ diff --git a/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.62.0-c48b9a5492-fc104b389c.zip b/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.62.0-c48b9a5492-fc104b389c.zip new file mode 100644 index 00000000..8b0150ea Binary files /dev/null and b/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.62.0-c48b9a5492-fc104b389c.zip differ diff --git a/.yarn/cache/@typescript-eslint-parser-npm-5.62.0-c6b29fa302-d168f4c7f2.zip b/.yarn/cache/@typescript-eslint-parser-npm-5.62.0-c6b29fa302-d168f4c7f2.zip new file mode 100644 index 00000000..183218a4 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-parser-npm-5.62.0-c6b29fa302-d168f4c7f2.zip differ diff --git a/.yarn/cache/@typescript-eslint-scope-manager-npm-5.62.0-c0013838b0-6062d6b797.zip b/.yarn/cache/@typescript-eslint-scope-manager-npm-5.62.0-c0013838b0-6062d6b797.zip new file mode 100644 index 00000000..2a092c7e Binary files /dev/null and b/.yarn/cache/@typescript-eslint-scope-manager-npm-5.62.0-c0013838b0-6062d6b797.zip differ diff --git a/.yarn/cache/@typescript-eslint-type-utils-npm-5.62.0-220216d668-fc41eece5f.zip b/.yarn/cache/@typescript-eslint-type-utils-npm-5.62.0-220216d668-fc41eece5f.zip new file mode 100644 index 00000000..4a747241 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-type-utils-npm-5.62.0-220216d668-fc41eece5f.zip differ diff --git a/.yarn/cache/@typescript-eslint-types-npm-5.62.0-5c2e0aab15-48c8711738.zip b/.yarn/cache/@typescript-eslint-types-npm-5.62.0-5c2e0aab15-48c8711738.zip new file mode 100644 index 00000000..9ec0c419 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-types-npm-5.62.0-5c2e0aab15-48c8711738.zip differ diff --git a/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.62.0-5d1ea132a9-3624520abb.zip b/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.62.0-5d1ea132a9-3624520abb.zip new file mode 100644 index 00000000..6c917f1f Binary files /dev/null and b/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.62.0-5d1ea132a9-3624520abb.zip differ diff --git a/.yarn/cache/@typescript-eslint-utils-npm-5.62.0-907f2d579e-ee9398c8c5.zip b/.yarn/cache/@typescript-eslint-utils-npm-5.62.0-907f2d579e-ee9398c8c5.zip new file mode 100644 index 00000000..e08069be Binary files /dev/null and b/.yarn/cache/@typescript-eslint-utils-npm-5.62.0-907f2d579e-ee9398c8c5.zip differ diff --git a/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.62.0-da1af55f83-976b05d103.zip b/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.62.0-da1af55f83-976b05d103.zip new file mode 100644 index 00000000..0cd42324 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.62.0-da1af55f83-976b05d103.zip differ diff --git a/.yarn/cache/eslint-config-prettier-npm-8.10.2-2e293fd4f2-a92b7e8a99.zip b/.yarn/cache/eslint-config-prettier-npm-8.10.2-2e293fd4f2-a92b7e8a99.zip new file mode 100644 index 00000000..641c47ee Binary files /dev/null and b/.yarn/cache/eslint-config-prettier-npm-8.10.2-2e293fd4f2-a92b7e8a99.zip differ diff --git a/.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-5222ac3986.zip b/.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-5222ac3986.zip new file mode 100644 index 00000000..6f588b83 Binary files /dev/null and b/.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-5222ac3986.zip differ diff --git a/.yarn/cache/semver-npm-7.7.4-746e538da5-9b4a6a58e9.zip b/.yarn/cache/semver-npm-7.7.4-746e538da5-9b4a6a58e9.zip new file mode 100644 index 00000000..ac5743bd Binary files /dev/null and b/.yarn/cache/semver-npm-7.7.4-746e538da5-9b4a6a58e9.zip differ diff --git a/packages/donate-button-v4/.babelrc b/packages/donate-button-v4/.babelrc index 2ab4ab8f..8be6406c 100644 --- a/packages/donate-button-v4/.babelrc +++ b/packages/donate-button-v4/.babelrc @@ -1,50 +1,46 @@ { - "presets": [ - [ - "@babel/preset-env", - { - "loose": true, - "modules": false, - "targets": { - "browsers": [ - "> 100%", - "last 200 versions", - "IE >= 19" - ] - }, - "exclude": [ - "@babel/plugin-transform-regenerator", - "@babel/plugin-transform-typeof-symbol" - ] - } - ], - "@babel/preset-typescript" - ], - "plugins": [ - "@babel/plugin-syntax-dynamic-import", - "@babel/plugin-transform-object-assign", - [ - "@babel/plugin-proposal-decorators", - { - "legacy": true - } - ], - "@babel/plugin-proposal-class-properties", - "@babel/plugin-transform-react-constant-elements", - "babel-plugin-transform-react-remove-prop-types", - [ - "@babel/plugin-transform-react-jsx", - { - "pragma": "h" - } - ], - [ - "babel-plugin-jsx-pragmatic", - { - "module": "preact", - "export": "h", - "import": "h" - } - ] - ] -} \ No newline at end of file + "presets": [ + [ + "@babel/preset-env", + { + "loose": true, + "modules": false, + "targets": { + "browsers": ["> 100%", "last 200 versions", "IE >= 19"] + }, + "exclude": [ + "@babel/plugin-transform-regenerator", + "@babel/plugin-transform-typeof-symbol" + ] + } + ], + "@babel/preset-typescript" + ], + "plugins": [ + "@babel/plugin-syntax-dynamic-import", + "@babel/plugin-transform-object-assign", + [ + "@babel/plugin-proposal-decorators", + { + "legacy": true + } + ], + "@babel/plugin-proposal-class-properties", + "@babel/plugin-transform-react-constant-elements", + "babel-plugin-transform-react-remove-prop-types", + [ + "@babel/plugin-transform-react-jsx", + { + "pragma": "h" + } + ], + [ + "babel-plugin-jsx-pragmatic", + { + "module": "preact", + "export": "h", + "import": "h" + } + ] + ] +} diff --git a/packages/donate-button-v4/.eslintrc.cjs b/packages/donate-button-v4/.eslintrc.cjs new file mode 100644 index 00000000..ab0496d8 --- /dev/null +++ b/packages/donate-button-v4/.eslintrc.cjs @@ -0,0 +1,26 @@ +module.exports = { + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module', + ecmaFeatures: {jsx: true} + }, + settings: { + react: { + pragma: 'h', + version: 'detect' + } + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react/recommended', + 'plugin:react-hooks/recommended', + 'prettier' + ], + rules: { + 'react/react-in-jsx-scope': 'off', + 'react/prop-types': 'off', + 'react/prefer-read-only-props': 'off' + } +}; diff --git a/packages/donate-button-v4/.prettierignore b/packages/donate-button-v4/.prettierignore new file mode 100644 index 00000000..783b08bb --- /dev/null +++ b/packages/donate-button-v4/.prettierignore @@ -0,0 +1,3 @@ +dist/ +node_modules/ +.cache/ diff --git a/packages/donate-button-v4/.prettierrc b/packages/donate-button-v4/.prettierrc index dcfe3a9e..376cdae7 100644 --- a/packages/donate-button-v4/.prettierrc +++ b/packages/donate-button-v4/.prettierrc @@ -1,7 +1,7 @@ { - "tabWidth": 2, - "useTabs": true, - "trailingComma": "none", - "bracketSpacing": false, - "singleQuote": true -} \ No newline at end of file + "tabWidth": 2, + "useTabs": true, + "trailingComma": "none", + "bracketSpacing": false, + "singleQuote": true +} diff --git a/packages/donate-button-v4/package.json b/packages/donate-button-v4/package.json index 86c26837..d5bb2067 100644 --- a/packages/donate-button-v4/package.json +++ b/packages/donate-button-v4/package.json @@ -13,8 +13,8 @@ "postbuild": "cp dist/donate-button/0.4/index.js dist/donate-button/0.4/button.js", "serve": "preact serve", "dev": "preact watch -c ./preact.config.js --no-prerender --no-sw", - "lint": "xo", - "lint:fix": "xo --fix" + "lint": "eslint src --ext .ts,.tsx && prettier --check .", + "lint:fix": "eslint src --ext .ts,.tsx --fix && prettier --write ." }, "keywords": [], "author": "Every.org", @@ -33,15 +33,15 @@ "@babel/preset-typescript": "^7.13.0", "@testing-library/react": "^11.2.5", "@types/big.js": "^6.2.2", + "@typescript-eslint/eslint-plugin": "^5", + "@typescript-eslint/parser": "^5", "ava": "^3.15.0", "babel-core": "^7.0.0-bridge.0", "babel-plugin-jsx-pragmatic": "^1.0.2", "babel-plugin-transform-decorators-legacy": "^1.3.5", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", - "deepmerge": "^4.2.2", "eslint": "^7.14.0", - "eslint-config-xo": "^0.34.0", - "eslint-config-xo-react": "^0.23.0", + "eslint-config-prettier": "^8", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "identity-obj-proxy": "^3.0.0", @@ -54,8 +54,7 @@ "ts-node": "^9.1.1", "tsconfig-paths": "^3.9.0", "tsconfig-paths-webpack-plugin": "^4.1.0", - "typescript": "^4.1.3", - "xo": "^0.37.1" + "typescript": "^4.1.3" }, "dependencies": { "@stripe/stripe-js": "^1.53.0", diff --git a/packages/donate-button-v4/src/components/widget/components/Checkbox/index.tsx b/packages/donate-button-v4/src/components/widget/components/Checkbox/index.tsx index 9571a492..16eb6604 100644 --- a/packages/donate-button-v4/src/components/widget/components/Checkbox/index.tsx +++ b/packages/donate-button-v4/src/components/widget/components/Checkbox/index.tsx @@ -10,7 +10,7 @@ import { import {useConfigContext} from 'src/components/widget/hooks/useConfigContext'; import {CheckMarkIcon} from 'src/components/widget/icons/CheckMarkIcon'; -interface CheckboxProps extends JSXInternal.HTMLAttributes {} +type CheckboxProps = JSXInternal.HTMLAttributes; export const Checkbox: FunctionComponent = ({ children, diff --git a/packages/donate-button-v4/src/components/widget/components/Footer/index.tsx b/packages/donate-button-v4/src/components/widget/components/Footer/index.tsx index b30d9996..078c583b 100644 --- a/packages/donate-button-v4/src/components/widget/components/Footer/index.tsx +++ b/packages/donate-button-v4/src/components/widget/components/Footer/index.tsx @@ -20,8 +20,7 @@ import { import {mailToLink} from 'src/helpers/mailToLink'; const FEEDBACK_URL = mailToLink({address: SUPPORT_EMAIL}); -interface FooterLinkProps - extends JSXInternal.HTMLAttributes {} +type FooterLinkProps = JSXInternal.HTMLAttributes; const FooterLink: FunctionComponent = ({ children, ...rest diff --git a/packages/donate-button-v4/src/helpers/constructDonateUrl.ts b/packages/donate-button-v4/src/helpers/constructDonateUrl.ts index 31bb75c4..13a87ef4 100644 --- a/packages/donate-button-v4/src/helpers/constructDonateUrl.ts +++ b/packages/donate-button-v4/src/helpers/constructDonateUrl.ts @@ -1,4 +1,3 @@ -/* eslint-disable unicorn/prevent-abbreviations */ import {DonationFrequency} from 'src/components/widget/types/DonationFrequency'; import { AvailablePaymentMethods, diff --git a/packages/donate-button-v4/src/helpers/css.ts b/packages/donate-button-v4/src/helpers/css.ts index 28af04ef..2e02dd24 100644 --- a/packages/donate-button-v4/src/helpers/css.ts +++ b/packages/donate-button-v4/src/helpers/css.ts @@ -4,7 +4,6 @@ */ /* eslint-disable @typescript-eslint/restrict-plus-operands */ -/* eslint-disable unicorn/prefer-dom-node-append */ /* eslint-disable @typescript-eslint/consistent-indexed-object-style */ import * as CSS from 'csstype'; import resetcss from 'src/resetCss'; diff --git a/packages/donate-button-v4/src/helpers/mailToLink.ts b/packages/donate-button-v4/src/helpers/mailToLink.ts index 6c38ab5f..17981fdc 100644 --- a/packages/donate-button-v4/src/helpers/mailToLink.ts +++ b/packages/donate-button-v4/src/helpers/mailToLink.ts @@ -11,13 +11,11 @@ function addParameters( const queryString = Object.entries(parameters) .map(([key, value]) => { try { - // eslint-disable-next-line unicorn/no-array-callback-reference return [key, value].map(encodeURIComponent).join('='); } catch { return null; } }) - // eslint-disable-next-line unicorn/no-array-callback-reference .filter(isPresent) .join('&'); return queryString ? [link, queryString].join('?') : link; diff --git a/packages/donate-button-v4/src/helpers/parseDonateUrl.ts b/packages/donate-button-v4/src/helpers/parseDonateUrl.ts index afe0210c..c742e223 100644 --- a/packages/donate-button-v4/src/helpers/parseDonateUrl.ts +++ b/packages/donate-button-v4/src/helpers/parseDonateUrl.ts @@ -38,14 +38,11 @@ function frequencyFromString(string?: string | null) { function addAmountsFromString(string?: string | null) { if (!string) return; - return ( - string - .split(',') - // eslint-disable-next-line unicorn/no-array-callback-reference - .map(Number.parseFloat) - .filter(Boolean) - .slice(0, MAX_AMOUNT_SUGGESTIONS) - ); + return string + .split(',') + .map(Number.parseFloat) + .filter(Boolean) + .slice(0, MAX_AMOUNT_SUGGESTIONS); } function intFromString(string?: string | null) { diff --git a/packages/donate-button-v4/src/public/index.html b/packages/donate-button-v4/src/public/index.html index 6130e278..358f99a0 100644 --- a/packages/donate-button-v4/src/public/index.html +++ b/packages/donate-button-v4/src/public/index.html @@ -57,6 +57,7 @@ href="https://www.every.org/wphfund?frequency=once#/donate" >Donate Once +
=7.0.0" + bin: + eslint-config-prettier: bin/cli.js + checksum: a92b7e8a996e65adf79de1579524235687e9d3552d088cfab4f170da60d23762addb4276169c8ca3a9551329dda8408c59f7e414101b238a6385379ac1bc3b16 + languageName: node + linkType: hard + "eslint-config-prettier@npm:^8.3.0": version: 8.10.0 resolution: "eslint-config-prettier@npm:8.10.0" @@ -15849,6 +15994,13 @@ __metadata: languageName: node linkType: hard +"natural-compare-lite@npm:^1.4.0": + version: 1.4.0 + resolution: "natural-compare-lite@npm:1.4.0" + checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225 + languageName: node + linkType: hard + "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -20044,6 +20196,15 @@ __metadata: languageName: node linkType: hard +"semver@npm:^7.3.7": + version: 7.7.4 + resolution: "semver@npm:7.7.4" + bin: + semver: bin/semver.js + checksum: 9b4a6a58e98b9723fafcafa393c9d4e8edefaa60b8dfbe39e30892a3604cf1f45f52df9cfb1ae1a22b44c8b3d57fec8a9bb7b3e1645431587cb272399ede152e + languageName: node + linkType: hard + "send@npm:0.19.0": version: 0.19.0 resolution: "send@npm:0.19.0"