diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..f1672a4 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,45 @@ +{ + "parser": "@typescript-eslint/parser", + "extends": [ + "plugin:react-hooks/recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended", + "plugin:jest/recommended", + "plugin:unicorn/recommended", + "plugin:prettier/recommended", + "prettier/@typescript-eslint" + ], + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module", + "ecmaFeatures": { + "jsx": true + } + }, + "rules": { + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-module-boundary-types": "off", + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn", + "sort-imports": [ + "error", + { + "ignoreCase": false, + "ignoreDeclarationSort": true, + "ignoreMemberSort": false, + "memberSyntaxSortOrder": ["none", "all", "multiple", "single"] + } + ], + "no-restricted-imports": [ + "error", + { + "patterns": ["@material-ui/*/*/*", "!@material-ui/core/test-utils/*"] + } + ] + }, + "settings": { + "react": { + "version": "detect" + } + } +} diff --git a/README.md b/README.md index 66170c9..a5b0a66 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ts-react-playground - [TypeScript](http://www.typescriptlang.org/) [React](https://reactjs.org/) Playground +# [](http://www.typescriptlang.org/) [](https://reactjs.org/) Playground #### [Storybook](https://gregoranders.github.io/ts-react-playground-docs) diff --git a/SECURITY.md b/SECURITY.md index c9cdcdc..6b8aa65 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -5,7 +5,8 @@ ​ | Version | Supported | | ------- | ------------------ | -| 0.0.14 | :white_check_mark: | +| 0.0.15 | :white_check_mark: | +| 0.0.14 | :x: | | 0.0.13 | :x: | | 0.0.12 | :x: | | 0.0.11 | :x: | diff --git a/docs/public b/docs/public index 5293163..8fecb0a 160000 --- a/docs/public +++ b/docs/public @@ -1 +1 @@ -Subproject commit 5293163ebf27dbcca80e459f8e430099665ae405 +Subproject commit 8fecb0ae321a49953d5dff3c594165b5a8217ec3 diff --git a/e2e/screenshots b/e2e/screenshots index 5d4e725..32cf913 160000 --- a/e2e/screenshots +++ b/e2e/screenshots @@ -1 +1 @@ -Subproject commit 5d4e72513faa81631b4cd5d2b6b6da994390fdc2 +Subproject commit 32cf9136e24eda5fa7c3a8ac9c5898337ff72dbf diff --git a/package.json b/package.json index 416ee23..fa075c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-react-playground", - "version": "0.0.14", + "version": "0.0.15", "description": "TypeScript React Playground", "scripts": { "start": "webpack-dev-server --open --progress --config webpack.config.js", @@ -32,25 +32,25 @@ "prefavicon": "rimraf ./public/assets ./public/favicon.html", "favicon": "ts-node --project ./scripts/tsconfig.json ./scripts/favicon.ts", "prevendor": "rimraf ./public/vendor ./public/es-module-shims.js", - "vendor": "rimraf ./public/vendor && npm run vendor:base && npm run vendor:faker && npm run vendor:fontawesome && npm run vendor:react && npm run vendor:recharts && npm run vendor:esmoduleshims && npm run vendor:materialui", - "vendor:base": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-base.config.js", - "vendor:faker": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-faker.config.js", - "vendor:fontawesome": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-fontawesome.config.js", - "vendor:react": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-react.config.js", - "vendor:recharts": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-recharts.config.js", + "vendor": "npm run vendor:base && npm run vendor:faker && npm run vendor:fontawesome && npm run vendor:react && npm run vendor:recharts && npm run vendor:esmoduleshims && npm run vendor:materialui", + "vendor:base": "rollup -c ./src/vendor/rollup-base.config.js", + "vendor:faker": "rollup -c ./src/vendor/rollup-faker.config.js", + "vendor:fontawesome": "rollup -c ./src/vendor/rollup-fontawesome.config.js", + "vendor:react": "rollup -c ./src/vendor/rollup-react.config.js", + "vendor:recharts": "rollup -c ./src/vendor/rollup-recharts.config.js", "vendor:esmoduleshims": "tsc --project ./src/vendor/es-module-shims", "vendor:materialui": "npm run vendor:materialui-base && npm run vendor:materialui-icons && npm run vendor:mdi-material-ui && npm run vendor:devexpress", - "vendor:materialui-base": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-materialui.config.js", - "vendor:materialui-icons": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-materialui-icons.config.js", - "vendor:mdi-material-ui": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-mdi-material-ui.config.js", - "vendor:devexpress": "cross-env NODE_ENV=production rollup -c ./src/vendor/rollup-devexpress.config.js", + "vendor:materialui-base": "rollup -c ./src/vendor/rollup-materialui.config.js", + "vendor:materialui-icons": "rollup -c ./src/vendor/rollup-materialui-icons.config.js", + "vendor:mdi-material-ui": "rollup -c ./src/vendor/rollup-mdi-material-ui.config.js", + "vendor:devexpress": "rollup -c ./src/vendor/rollup-devexpress.config.js", "preserviceWorker": "rimraf ./public/serviceWorker.js", "serviceWorker": "tsc --project ./src/service --outFile ./public/serviceWorker.js", "postserviceWorker": "workbox injectManifest workbox-config.js", "prewatch-serviceWorker": "npm run serviceWorker", "watch-serviceWorker": "tsc --watch --project ./src/service --outFile ./public/serviceWorker.js", "predocker:build": "npm run build", - "docker:build": "cross-env NODE_ENV=production docker-compose build --force-rm --no-cache --parallel --pull", + "docker:build": "docker-compose build --force-rm --no-cache --parallel --pull", "docker:up": "docker-compose up -d", "docker:down": "docker-compose down", "codeclimate": "docker run --interactive --tty --rm --env CODECLIMATE_CODE=\"$PWD\" --volume \"$PWD\":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze", @@ -99,7 +99,7 @@ "**/script/**/*.ts", "!**/script/index.tsx", "!**/script/application.tsx", - "!**/script/testUtils.tsx" + "!**/script/test-utils.tsx" ], "coverageReporters": [ "lcovonly", @@ -148,57 +148,6 @@ "jest-junit": { "outputDirectory": "./test" }, - "eslintConfig": { - "parser": "@typescript-eslint/parser", - "extends": [ - "plugin:react-hooks/recommended", - "plugin:react/recommended", - "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended", - "prettier/@typescript-eslint" - ], - "parserOptions": { - "ecmaVersion": 2020, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "rules": { - "@typescript-eslint/explicit-function-return-type": "off", - "@typescript-eslint/explicit-module-boundary-types": "off", - "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "warn", - "sort-imports": [ - "error", - { - "ignoreCase": false, - "ignoreDeclarationSort": true, - "ignoreMemberSort": false, - "memberSyntaxSortOrder": [ - "none", - "all", - "multiple", - "single" - ] - } - ], - "no-restricted-imports": [ - "error", - { - "patterns": [ - "@material-ui/*/*/*", - "!@material-ui/core/test-utils/*" - ] - } - ] - }, - "settings": { - "react": { - "version": "detect" - } - } - }, "prettier": { "semi": true, "trailingComma": "all", @@ -301,9 +250,11 @@ "es-module-shims": "0.4.7", "eslint": "7.3.1", "eslint-config-prettier": "6.11.0", + "eslint-plugin-jest": "23.17.1", "eslint-plugin-prettier": "3.1.4", "eslint-plugin-react": "7.20.0", "eslint-plugin-react-hooks": "4.0.4", + "eslint-plugin-unicorn": "20.1.0", "express": "4.17.1", "faker": "4.1.0", "favicons": "6.1.0", diff --git a/src/script/application.spec.tsx b/src/script/application.spec.tsx index 7857b91..be4a8ab 100644 --- a/src/script/application.spec.tsx +++ b/src/script/application.spec.tsx @@ -1,4 +1,4 @@ -import React, { mount } from '@app/testUtils'; +import React, { mount } from '@app/test-utils'; import * as TestSubject from '@app/application'; diff --git a/src/script/components/atoms/button/index.spec.tsx b/src/script/components/atoms/button/index.spec.tsx index 98c03a8..7f2cd01 100644 --- a/src/script/components/atoms/button/index.spec.tsx +++ b/src/script/components/atoms/button/index.spec.tsx @@ -1,4 +1,4 @@ -import React, { act, create, mount } from '@app/testUtils'; +import React, { act, create, mount } from '@app/test-utils'; import * as TestSubject from '@atoms/button'; diff --git a/src/script/components/atoms/button/index.tsx b/src/script/components/atoms/button/index.tsx index 01c5c21..8633134 100644 --- a/src/script/components/atoms/button/index.tsx +++ b/src/script/components/atoms/button/index.tsx @@ -20,9 +20,9 @@ const defaultProps = { /** * onClick handler * - * @type (e: React.MouseEvent) => void + * @type (event: React.MouseEvent) => void */ - onClick: (e: React.MouseEvent) => console.log(e), + onClick: (event: React.MouseEvent) => console.log(event), /** * HTML button content * @@ -39,8 +39,8 @@ export const Button = ({ children, disabled, onClick }: Props) => { return (