Skip to content

Commit

Permalink
transform codebase to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
radek.stary committed Apr 26, 2023
1 parent 6213b0a commit 33dc915
Show file tree
Hide file tree
Showing 99 changed files with 2,658 additions and 1,943 deletions.
29 changes: 22 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
{
"extends" : [
"@visionappscz/eslint-config-visionapps"
"@visionappscz/eslint-config-visionapps",
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:typescript-sort-keys/recommended",
// "plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"ignorePatterns": ["src/wasm/wasm.*"],
"env": {
"browser": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"import/prefer-default-export": "off",
"react/default-props-match-prop-types": "off",
"no-console": ["error"],
"@typescript-eslint/object-curly-spacing": ["error"],
"@typescript-eslint/no-unused-vars": ["error"]
},
"overrides": [
{
"files": ["**/*.md", "**/*.mdx"],
Expand All @@ -14,9 +33,5 @@
"plugin:mdx/recommended"
]
}
],
"parser": "@babel/eslint-parser",
"rules": {
"import/prefer-default-export": "off"
}
}
]
}
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ module.exports = {
},
],
'@babel/preset-react',
'@babel/preset-typescript',
],
};
2 changes: 2 additions & 0 deletions declaration.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '*.css';
declare module '*.scss';
49 changes: 49 additions & 0 deletions definitions.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* [Color variant](/foundation/colors#component-colors)
*/
declare type Color = 'primary' | 'secondary' | 'selected' | 'success' | 'warning' | 'danger' | 'help' | 'info' | 'note' | 'light' | 'dark';
/**
* Scrolling mode:
*/
declare type Scrolling = 'auto' | 'custom' | 'none';
/**
* Set the HTML `type` attribute of the `button` element.
*/
declare type Type = 'button' | 'submit';
/**
* Vertical alignment
*/
declare type Align = 'top' | 'middle' | 'bottom' | 'baseline';
/**
* Horizontal alignment (distribution)
*/
declare type Justify = 'start' | 'center' | 'end' | 'space-between' | 'stretch';
/**
* HTML input type
*/
declare type InputType = 'email' | 'number' | 'password' | 'tel' | 'text';
declare type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'x2l' | 'x3l' | 'none';
declare type Priority = 'filled' | 'outline' | 'flat';
declare type Size = 'small' | 'medium' | 'large';
declare type Position = 'before' | 'after';
declare type Validation = 'invalid' | 'valid' | 'warning';
declare type Layout = 'horizontal' | 'vertical';
declare type Placement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
declare type AutoScroll = 'always' | 'detectEnd' | 'off';
declare type Direction = 'asc' | 'desc';
declare type Hyphens = 'none' | 'auto' | 'manual';
declare type WordWrapping = 'normal' | 'long-words' | 'anywhere';
declare type VerticalModalPosition = 'top' | 'center';

declare type PredefinedLabelWidthValues = 'auto' | 'default' | 'limited';

// Test types

declare type AssertFn = (rootElement: HTMLElement) => void;

declare interface NonMandatoryProps {
[key: string]: unknown;
}

declare type TestingProps = [nonMandatoryProps, AssertFn];

6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'ts',
'tsx',
],
moduleNameMapper: {
'\\.scss$': 'identity-obj-proxy',
},
modulePathIgnorePatterns: [
'<rootDir>/.docz/',
],
preset: 'ts-jest',
setupFiles: [
'<rootDir>/tests/setupJest.js',
],
setupFilesAfterEnv: [
'<rootDir>/tests/setupTestingLibrary.js',
],
testEnvironment: 'jsdom',
transform: {
'^.+\\.(t|j)sx?$': 'ts-jest',
},
verbose: true,
};
Loading

0 comments on commit 33dc915

Please sign in to comment.