Skip to content

Commit

Permalink
Migrate to Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbarbara committed Dec 18, 2021
1 parent 3508367 commit 37cb191
Show file tree
Hide file tree
Showing 47 changed files with 21,903 additions and 17,282 deletions.
54 changes: 0 additions & 54 deletions .babelrc

This file was deleted.

3 changes: 2 additions & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ checks:
threshold: 50
exclude_patterns:
- coverage/**/*
- es/**/*
- esm/**/*
- demo/**/*
- lib/**/*
- node_modules/**/*
- test/**/*
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

180 changes: 32 additions & 148 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,172 +1,48 @@
{
"extends": [
"airbnb",
"plugin:flowtype/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended",
"prettier/flowtype",
"prettier/react",
"prettier/standard"
],
"parser": "babel-eslint",
"parser": "@typescript-eslint/parser",
"env": {
"browser": true,
"jest": true
},
"globals": {
"cy": false
},
"plugins": [
"babel",
"flowtype",
"prettier"
],
"settings": {
"flowtype": {
"onlyFilesWithFlowAnnotation": true
"overrides": [
{
"files": ["test/**/*.ts?(x)"],
"rules": {
"no-console": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
}
},
],
"plugins": ["react-hooks"],
"rules": {
"arrow-body-style": ["warn", "as-needed"],
"arrow-parens": "off",
"block-spacing": "warn",
"camelcase": "off",
"class-methods-use-this": "off",
"comma-dangle": [
"warn", {
"arrays": "always-multiline",
"imports": "always-multiline",
"objects": "always-multiline",
"functions": "only-multiline"
}
],
"dot-notation": "warn",
"function-paren-newline": "off",
"generator-star-spacing": "off",
"global-require": "off",
"max-len": "off",
"newline-per-chained-call": ["warn", { "ignoreChainWithDepth": 5 }],
"no-case-declarations": "warn",
"no-confusing-arrow": ["warn", { "allowParens": true }],
"no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
"no-multi-spaces": [
"warn", {
"exceptions": {
"VariableDeclarator": true,
"Property": false
}
}
],
"no-nested-ternary": "warn",
"lines-between-class-members": "off",
"no-new": "off",
"no-param-reassign": ["warn", { "props": false }],
"no-plusplus": "off",
"no-restricted-globals": ["error", "fdescribe", "fit"],
"no-restricted-syntax": [
"error",
"DebuggerStatement",
"LabeledStatement",
"WithStatement"
],
"no-return-assign": ["error", "except-parens"],
"no-template-curly-in-string": "warn",
"no-trailing-spaces": "warn",
"no-underscore-dangle": "off",
"no-unused-vars": "warn",
"object-curly-newline": "off",
"object-shorthand": ["warn", "always"],
"one-var": "warn",
"padded-blocks": "warn",
"prefer-const": "warn",
"prefer-destructuring": "warn",
"prefer-template": "warn",
"prefer-promise-reject-errors": "off",
"quotes": ["warn", "single", "avoid-escape"],
"require-jsdoc": [
0, {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": false,
"ClassDeclaration": false
}
}
],
"space-before-function-paren": [
"warn", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"space-in-parens": "warn",
"spaced-comment": [
"warn",
"always", {
"exceptions": [
"-+"
],
"markers": [
"eslint-disable",
"eslint-disable-line",
"eslint-disable-next-line",
"eslint-enable"
]
}
],
"valid-jsdoc": [
"warn", {
"prefer": {
"return": "returns"
},
"requireReturn": false,
"requireParamDescription": false,
"requireReturnDescription": false
}
],
"flowtype/no-types-missing-file-annotation": "off",
"flowtype/require-parameter-type": ["warn", { "excludeArrowFunctions": true }],
"flowtype/require-return-type": ["warn", "always", { "excludeArrowFunctions": true }],
"flowtype/space-after-type-colon": ["error", "always"],
"no-use-before-define": "off",
"@typescript-eslint/no-explicit-any":"off",
"@typescript-eslint/no-use-before-define": ["error", { "functions": false }],
"import/export": "off",
"import/no-dynamic-require": "off",
"import/extensions": ["warn", "never"],
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"import/no-named-as-default": "off",
"import/no-unresolved": "warn",
"import/no-webpack-loader-syntax": "off",
"import/prefer-default-export": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/label-has-for": "off",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-quotes": "warn",
"react/forbid-prop-types": "off",
"react/jsx-boolean-value": "off",
"react/jsx-closing-bracket-location": ["warn", "line-aligned"],
"react/jsx-filename-extension": "off",
"react/jsx-first-prop-new-line": ["warn", "multiline"],
"react/jsx-indent": ["warn", 2],
"react/jsx-indent-props": ["warn", 2],
"react/jsx-key": "warn",
"react/jsx-max-props-per-line": ["warn", { "maximum": 4 }],
"react/jsx-no-duplicate-props": "warn",
"react/jsx-no-target-blank": "off",
"react/jsx-one-expression-per-line": "off",
"react/jsx-pascal-case": "warn",
"react/jsx-props-no-spreading": "off",
"react/no-array-index-key": "off",
"react/no-danger": "off",
"react/no-did-mount-set-state": "warn",
"react/no-did-update-set-state": "warn",
"react/no-direct-mutation-state": "warn",
"react/no-unescaped-entities": "off",
"react/no-unused-prop-types": "warn",
"react/no-unused-state": "warn",
"react/prefer-stateless-function": "off",
"react/prop-types": "error",
"react/require-default-props": "off",
"react/sort-prop-types": "warn",
"react/sort-comp": [
"warn",
{
"order": [
"type-annotations",
"instance-variables",
"constructor",
"lifecycle",
"everything-else",
Expand All @@ -175,23 +51,31 @@
"groups": {
"lifecycle": [
"state",
"statics",
"static-methods",
"propTypes",
"defaultProps",
"contextTypes",
"childContextTypes",
"getChildContext",
"propTypes",
"defaultProps",
"shouldComponentUpdate",
"getDerivedStateFromProps",
"componentWillMount",
"UNSAFE_componentWillMount",
"componentDidMount",
"componentWillReceiveProps",
"UNSAFE_componentWillReceiveProps",
"shouldComponentUpdate",
"componentWillUpdate",
"UNSAFE_componentWillUpdate",
"getSnapshotBeforeUpdate",
"componentDidUpdate",
"componentDidCatch",
"componentWillUnmount"
]
}
}
],
"react/static-property-placement": "off"
"react/static-property-placement": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
13 changes: 0 additions & 13 deletions .flowconfig

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.tmp
coverage
dist
es
esm
lib
node_modules
reports
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage
es
esm
lib
node_modules
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- '10'
- '12'
cache:
directories:
- 'node_modules'
Expand Down
30 changes: 0 additions & 30 deletions jest.config.js

This file was deleted.

33 changes: 33 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
collectCoverage: false,
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
coverageThreshold: {
global: {
branches: 55,
functions: 80,
lines: 80,
statements: 80,
},
},
globals: {
'ts-jest': {
tsconfig: 'test/tsconfig.json',
diagnostics: false,
},
},
moduleDirectories: ['node_modules', 'src', './'],
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json'],
preset: 'ts-jest',
setupFiles: ['<rootDir>/test/__setup__/setupFiles.ts'],
setupFilesAfterEnv: ['<rootDir>/test/__setup__/setupTests.ts'],
snapshotSerializers: ['jest-serializer-html'],
testMatch: null,
testRegex: '/test/.*?\\.(test|spec)\\.tsx?$',
testURL: 'http://localhost/',
transform: {
'.(js)': 'ts-jest',
},
transformIgnorePatterns: ['<rootDir>/node_modules/(?!popper.js)'],
verbose: false,
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
};
Loading

0 comments on commit 37cb191

Please sign in to comment.