Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typescript): Add TypeScript compatibility #13786

Merged
merged 44 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8a4b9d5
ref(typescript): Rewrite file in TypeScript
lynnagara Jun 22, 2019
de0b348
feat: Add ts-loader, Add sentry ts pkg + linting
HazAT Jun 24, 2019
7be0584
feat: Make unit tests work with typescript
HazAT Jun 24, 2019
9690159
feat: use typescript eslint parser instead of tslint
lynnagara Jun 24, 2019
2694a24
Convert React component to TypeScript
lynnagara Jun 24, 2019
b7ef05d
Remove optional chaining
lynnagara Jun 24, 2019
264fdf1
Fix/suppress lint errors in React component
lynnagara Jun 24, 2019
4289274
Fix linting issues
lynnagara Jun 25, 2019
412a35b
Update col type
lynnagara Jun 25, 2019
6170758
space.jsx => space.tsx
dashed Jun 25, 2019
ab8c2e2
improve InlineSvg types
dashed Jun 25, 2019
14d7349
add react types
dashed Jun 25, 2019
cc20da3
feat: Convert aggregation.jsx => tsx
HazAT Jun 25, 2019
05a0982
feat: Convert conditions to typescript
HazAT Jun 25, 2019
57218a1
fix: Missing type
HazAT Jun 25, 2019
620ef4d
update snapshots
dashed Jun 25, 2019
b8c8e89
feat: theme.jsx => theme.tsx
dashed Jun 25, 2019
1299538
feat: chartPalette.jsx => chartPalette.tsx
dashed Jun 25, 2019
7f68f44
fix theme.tsx
dashed Jun 25, 2019
08f4539
Turn on esmodule interop
lynnagara Jun 25, 2019
f229f86
Fix unnecessary imports
lynnagara Jun 25, 2019
e8bf36c
Fix types
lynnagara Jun 25, 2019
db67d66
migration pagination component
lynnagara Jun 25, 2019
670775b
feat(typescript): Convert querBuilder to TypeScript
lynnagara Jun 26, 2019
6bf7650
ref: Convert more Discover code to TypeScript
lynnagara Jun 26, 2019
86c240a
ref: visualizationsToggle.jsx -> visualizationsToggle.tsx
lynnagara Jun 26, 2019
c120373
ref: Convert Discover result index page to TypeScript
lynnagara Jun 26, 2019
52b02f6
ref: Convert ResultTable component to TypeScript
lynnagara Jun 27, 2019
36f0a62
feat: Convert sidebar to typescript
HazAT Jun 27, 2019
92d5aed
feat: Intro to tsx
HazAT Jun 27, 2019
b7a6b08
update snapshots
dashed Jun 27, 2019
2484595
Convert more Discover code to TS
lynnagara Jun 27, 2019
14f37c0
Convert last Discover file to TS
lynnagara Jun 27, 2019
d021345
Better aggregation and condition types
lynnagara Jun 27, 2019
2e10e31
Update types
lynnagara Jun 27, 2019
10c3297
More types
lynnagara Jun 27, 2019
cac81a7
Better types
lynnagara Jun 28, 2019
f78a2aa
restore InlineeSvg proptypes
dashed Jul 18, 2019
b28077e
inlinesvg.jsx
dashed Jul 18, 2019
4d33c10
update snapshots
dashed Jul 18, 2019
4dac74d
adjust tsconfig
dashed Jul 19, 2019
5f20c53
adjustments
dashed Jul 19, 2019
4f9f0e8
tsconfig docs
dashed Jul 19, 2019
f12067e
fix
dashed Jul 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
"@sentry/integrations": "^5.4.2",
"@sentry/typescript": "^5.3.0",
"@types/lodash": "^4.14.134",
"@types/react-dom": "^16.8.4",
"@types/moment-timezone": "^0.5.12",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HazAT Do you know if/why these need to be dependencies? Would be really nice to move these to devDependencies?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply. I thought we need this since we do different stuff if you call
make develop or yarn install.
make develop apparently on installs dependencies whereby yarn install installs all.

So if you do a prod build it would fail because of missing types.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thanks for the explanation

"@types/papaparse": "^4.5.11",
"@types/react": "^16.7.0",
"@types/react-bootstrap": "^0.32.19",
"@types/react-document-title": "^2.0.3",
"@types/react-dom": "^16.7.0",
"@types/react-router": "^3.0.20",
"@types/react-virtualized": "^9.20.1",
"algoliasearch": "^3.32.0",
"babel-core": "^7.0.0-bridge.0",
"babel-loader": "^8.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const space = size => {
const space = (size: number): string => {
switch (size) {
//Our spacing scale is based on a base unit of 8
//We use a case switch to prevent odd numbers, decimals, and big numbers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import CHART_PALETTE from 'app/constants/chartPalette';

const theme = {
breakpoints: ['768px', '992px', '1200px'],

const colors = {
// Colors
offWhite: '#FAF9FB',
offWhite2: '#E7E1EC',
Expand Down Expand Up @@ -71,6 +69,107 @@ const theme = {

background: '#fff',
placeholderBackground: '#f5f5f5',
};

const warning = {
backgroundLight: colors.yellowLightest,
background: colors.yellowDarkest,
border: colors.yellowDark,
iconColor: colors.yellowDark,
};

const alert = {
muted: {
backgroundLight: colors.offWhite,
background: colors.gray1,
border: colors.gray6,
},
info: {
backgroundLight: colors.blueLightest,
border: colors.blueLight,
iconColor: colors.blue,
background: colors.blue,
},
warning,
//alias warn to warning
warn: warning,
success: {
backgroundLight: colors.greenLightest,
border: colors.green,
iconColor: colors.greenDark,
background: colors.green,
},
error: {
backgroundLight: colors.redLightest,
border: colors.redLight,
textLight: colors.redLight,
iconColor: colors.red,
background: colors.red,
},
beta: {
background: `linear-gradient(90deg, ${colors.pink}, ${colors.purple})`,
},
};

const aliases = {
textColor: colors.gray5,
success: colors.green,
error: colors.red,
disabled: colors.gray1,
};

const button = {
borderRadius: '3px',

default: {
color: '#2f2936',
colorActive: '#161319',
background: colors.white,
backgroundActive: colors.white,
border: '#d8d2de',
borderActive: '#c9c0d1',
},
primary: {
color: colors.white,
background: colors.purple,
backgroundActive: '#4e3fb4',
border: '#3d328e',
borderActive: '#352b7b',
},
success: {
color: colors.white,
background: '#3fa372',
backgroundActive: colors.green,
border: '#7ccca5',
borderActive: '#7ccca5',
},
danger: {
color: colors.white,
background: colors.red,
backgroundActive: '#bf2a1d',
border: '#bf2a1d',
borderActive: '#7d1c13',
},
link: {
color: colors.blue,
background: 'transparent',
// border: '#3d328e',
backgroundActive: 'transparent',
// borderActive: '#352b7b',
},
disabled: {
color: aliases.disabled,
border: '#e3e5e6',
borderActive: '#e3e5e6',
background: colors.white,
backgroundActive: colors.white,
},
};

const theme = {
breakpoints: ['768px', '992px', '1200px'],

...colors,

// Try to keep these ordered plz
zIndex: {
Expand Down Expand Up @@ -142,123 +241,36 @@ const theme = {
lineHeightHeading: '1.15',
lineHeightBody: '1.4',
},
};

// Aliases
theme.textColor = theme.gray5;
theme.success = theme.green;
theme.error = theme.red;
theme.disabled = theme.gray1;
// Aliases
...aliases,

theme.alert = {
muted: {
backgroundLight: theme.offWhite,
background: theme.gray1,
border: theme.gray6,
},
info: {
backgroundLight: theme.blueLightest,
border: theme.blueLight,
iconColor: theme.blue,
background: theme.blue,
},
warning: {
backgroundLight: theme.yellowLightest,
background: theme.yellowDarkest,
border: theme.yellowDark,
iconColor: theme.yellowDark,
},
success: {
backgroundLight: theme.greenLightest,
border: theme.green,
iconColor: theme.greenDark,
background: theme.green,
},
error: {
backgroundLight: theme.redLightest,
border: theme.redLight,
textLight: theme.redLight,
iconColor: theme.red,
background: theme.red,
},
beta: {
background: `linear-gradient(90deg, ${theme.pink}, ${theme.purple})`,
},
};
alert,
button,

//alias warn to warning
theme.alert.warn = theme.alert.warning;
charts: {
colors: CHART_PALETTE[CHART_PALETTE.length - 1],

theme.button = {
borderRadius: '3px',
// We have an array that maps `number + 1` --> list of `number` colors
getColorPalette: (length: number) =>
CHART_PALETTE[Math.min(CHART_PALETTE.length - 1, length + 1)],

default: {
color: '#2f2936',
colorActive: '#161319',
background: theme.white,
backgroundActive: theme.white,
border: '#d8d2de',
borderActive: '#c9c0d1',
previousPeriod: colors.gray1,
symbolSize: 6,
},
primary: {
color: theme.white,
background: theme.purple,
backgroundActive: '#4e3fb4',
border: '#3d328e',
borderActive: '#352b7b',
},
success: {
color: theme.white,
background: '#3fa372',
backgroundActive: theme.green,
border: '#7ccca5',
borderActive: '#7ccca5',
},
danger: {
color: theme.white,
background: theme.red,
backgroundActive: '#bf2a1d',
border: '#bf2a1d',
borderActive: '#7d1c13',
},
link: {
color: theme.blue,
background: 'transparent',
// border: '#3d328e',
backgroundActive: 'transparent',
// borderActive: '#352b7b',
},
disabled: {
color: theme.disabled,
border: '#e3e5e6',
borderActive: '#e3e5e6',
background: theme.white,
backgroundActive: theme.white,
},
};

theme.charts = {
colors: CHART_PALETTE[CHART_PALETTE.length - 1],

// We have an array that maps `number + 1` --> list of `number` colors
getColorPalette: length =>
CHART_PALETTE[Math.min(CHART_PALETTE.length - 1, length + 1)],

previousPeriod: theme.gray1,
symbolSize: 6,
};

theme.diff = {
removedRow: '#fcefee',
addedRow: '#f5fbf8',
removed: '#f7ceca',
added: '#d8f0e4',
};
diff: {
removedRow: '#fcefee',
addedRow: '#f5fbf8',
removed: '#f7ceca',
added: '#d8f0e4',
},

// Similarity spectrum used in "Similar Issues" in group details
theme.similarity = {
empty: '#e2dee6',
colors: ['#ec5e44', '#f38259', '#f9a66d', '#98b480', '#57be8c'],
// Similarity spectrum used in "Similar Issues" in group details
similarity: {
empty: '#e2dee6',
colors: ['#ec5e44', '#f38259', '#f9a66d', '#98b480', '#57be8c'],
},
};

export default theme;
Loading