Skip to content

Commit

Permalink
chore(deps): connect shareable linters dva
Browse files Browse the repository at this point in the history
  • Loading branch information
dvakatsiienko committed Mar 10, 2021
1 parent 712a076 commit 798252c
Show file tree
Hide file tree
Showing 26 changed files with 32,860 additions and 1,536 deletions.
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run check-all
30 changes: 6 additions & 24 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
{
"workbench.colorCustomizations": {
"titleBar.activeForeground": "#fff",
"titleBar.inactiveForeground": "#ffffffcc",
"titleBar.activeBackground": "#FF2C70",
"titleBar.inactiveBackground": "#FF2C70CC"
},
// These are all my auto-save configs
"editor.formatOnSave": true,
// turn it off for JS and JSX, we will do this via eslint
"[javascript]": {
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.formatOnSave": false
},
// tell the ESLint plugin to run on save
"editor.codeActionsOnSave": {
"source.fixAll": true
},
// Optional BUT IMPORTANT: If you have the prettier extension enabled for other languages like CSS and HTML, turn it off for JS since we are doing it through Eslint already
"prettier.disableLanguages": [
"javascript",
"javascriptreact"
],
"workbench.colorCustomizations": {
"titleBar.activeForeground": "#fff",
"titleBar.inactiveForeground": "#ffffffcc",
"titleBar.activeBackground": "#FF2C70",
"titleBar.inactiveBackground": "#FF2C70CC"
}
}
39 changes: 39 additions & 0 deletions components/PriceInputs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* Core */
import React from 'react';
import PatchEvent, { set, unset } from 'part:@sanity/form-builder/patch-event';

/* Instruments */
import { formatMonet } from '../helpers';

export const PriceInput: React.FC<PriceInputProps> = props => {
const { type, value, onChange, inputComponent } = props;

const handleChange = event => onChange(createPatchFrom(event.target.value));

return (
<div>
<h2>
{type.title} - {value ? formatMonet(value / 100) : ''}
</h2>
<p>{type.description}</p>
<input
ref = { inputComponent }
type = { type.name }
value = { value }
onChange = { handleChange }
/>
</div>
);
};

PriceInput.focus = function () {
this._inputElement.focus();
};

/* Helpers */
function createPatchFrom(value) {
return PatchEvent.from(value === '' ? unset() : set(Number(value)));
}

/* Types */
interface PriceInputProps {}
1 change: 1 addition & 0 deletions components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './PriceInputs';
8 changes: 8 additions & 0 deletions config/.checksums
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"#": "Used by Sanity to keep track of configuration file checksums, do not delete or modify!",
"@sanity/default-layout": "bb034f391ba508a6ca8cd971967cbedeb131c4d19b17b28a0895f32db5d568ea",
"@sanity/default-login": "6fb6d3800aa71346e1b84d95bbcaa287879456f2922372bb0294e30b968cd37f",
"@sanity/form-builder": "b38478227ba5e22c91981da4b53436df22e48ff25238a55a973ed620be5068aa",
"@sanity/data-aspects": "d199e2c199b3e26cd28b68dc84d7fc01c9186bf5089580f2e2446994d36b3cb6",
"@sanity/google-maps-input": "57ae3a403ce6a070b31ec6fa1f3c8339cafa66661eaddba1d4d5ee3cc2197ec2"
}
3 changes: 3 additions & 0 deletions config/@sanity/data-aspects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"listOptions": {}
}
6 changes: 6 additions & 0 deletions config/@sanity/default-layout.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"toolSwitcher": {
"order": [],
"hidden": []
}
}
7 changes: 7 additions & 0 deletions config/@sanity/default-login.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"providers": {
"mode": "append",
"redirectOnSingle": false,
"entries": []
}
}
5 changes: 5 additions & 0 deletions config/@sanity/form-builder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"images": {
"directUploads": true
}
}
8 changes: 8 additions & 0 deletions config/@sanity/google-maps-input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"apiKey": null,
"defaultZoom": 11,
"defaultLocation": {
"lat": 40.7058254,
"lng": -74.1180863
}
}
11 changes: 0 additions & 11 deletions env-config.js

This file was deleted.

4 changes: 4 additions & 0 deletions helpers/formatMoney.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const formatMonet = Intl.NumberFormat('en-CA', {
style: 'currency',
currency: 'CAD',
}).format;
1 change: 1 addition & 0 deletions helpers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './formatMoney';
Loading

0 comments on commit 798252c

Please sign in to comment.