diff --git a/.eslintcache b/.eslintcache index d081def..c2109b9 100644 --- a/.eslintcache +++ b/.eslintcache @@ -1 +1 @@ -[{"/Users/kennethcassel/slip/wasm-run/example/src/App.test.tsx":"1","/Users/kennethcassel/slip/wasm-run/example/src/App.tsx":"2","/Users/kennethcassel/slip/wasm-run/example/src/index.tsx":"3","/Users/kennethcassel/slip/wasm-run/example/src/react-app-env.d.ts":"4","/Users/kennethcassel/slip/wasm-run/example/src/reportWebVitals.ts":"5","/Users/kennethcassel/slip/wasm-run/example/src/setupTests.ts":"6","/Users/kennethcassel/slip/wasm-run/lib/cjs/index.js":"7","/Users/kennethcassel/slip/wasm-run/lib/esm/index.js":"8"},{"size":273,"mtime":1631826131482,"results":"9","hashOfConfig":"10"},{"size":237,"mtime":1631827909755,"results":"11","hashOfConfig":"10"},{"size":500,"mtime":1631826131483,"results":"12","hashOfConfig":"10"},{"size":40,"mtime":1631826136013,"results":"13","hashOfConfig":"10"},{"size":425,"mtime":1631826131483,"results":"14","hashOfConfig":"10"},{"size":241,"mtime":1631826131483,"results":"15","hashOfConfig":"10"},{"size":503,"mtime":1631827732531,"results":"16","hashOfConfig":"17"},{"size":252,"mtime":1631827730165,"results":"18","hashOfConfig":"17"},{"filePath":"19","messages":"20","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1dkp7er",{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xxoj97",{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/kennethcassel/slip/wasm-run/example/src/App.test.tsx",[],"/Users/kennethcassel/slip/wasm-run/example/src/App.tsx",[],"/Users/kennethcassel/slip/wasm-run/example/src/index.tsx",[],"/Users/kennethcassel/slip/wasm-run/example/src/react-app-env.d.ts",[],"/Users/kennethcassel/slip/wasm-run/example/src/reportWebVitals.ts",[],"/Users/kennethcassel/slip/wasm-run/example/src/setupTests.ts",[],"/Users/kennethcassel/slip/wasm-run/lib/cjs/index.js",[],"/Users/kennethcassel/slip/wasm-run/lib/esm/index.js",[]] \ No newline at end of file +[{"/Users/kennethcassel/slip/wasm-run/example/src/App.test.tsx":"1","/Users/kennethcassel/slip/wasm-run/example/src/App.tsx":"2","/Users/kennethcassel/slip/wasm-run/example/src/index.tsx":"3","/Users/kennethcassel/slip/wasm-run/example/src/react-app-env.d.ts":"4","/Users/kennethcassel/slip/wasm-run/example/src/reportWebVitals.ts":"5","/Users/kennethcassel/slip/wasm-run/example/src/setupTests.ts":"6","/Users/kennethcassel/slip/wasm-run/lib/cjs/index.js":"7","/Users/kennethcassel/slip/wasm-run/lib/esm/index.js":"8","/Users/kennethcassel/slip/wasm-run/src/index.tsx":"9","/Users/kennethcassel/slip/wasm-run/commitlint.config.js":"10","/Users/kennethcassel/slip/wasm-run/.eslintrc.js":"11"},{"size":266,"mtime":1631830539170,"results":"12","hashOfConfig":"13"},{"size":232,"mtime":1631830539170,"results":"14","hashOfConfig":"13"},{"size":493,"mtime":1631830539170,"results":"15","hashOfConfig":"13"},{"size":40,"mtime":1631826136013,"results":"16","hashOfConfig":"13"},{"size":416,"mtime":1631830539171,"results":"17","hashOfConfig":"13"},{"size":240,"mtime":1631830539171,"results":"18","hashOfConfig":"13"},{"size":499,"mtime":1631828279481,"results":"19","hashOfConfig":"20"},{"size":264,"mtime":1631828279481,"results":"21","hashOfConfig":"20"},{"size":207,"mtime":1631830547355,"results":"22","hashOfConfig":"23"},{"size":66,"mtime":1631830539170,"results":"24","hashOfConfig":"23"},{"size":387,"mtime":1631830591252,"results":"25","hashOfConfig":"23"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"o9lio9",{"filePath":"28","messages":"29","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xxoj97",{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"42","messages":"43","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":1,"source":null},"5140dk",{"filePath":"44","messages":"45","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"46","messages":"47","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/kennethcassel/slip/wasm-run/example/src/App.test.tsx",[],"/Users/kennethcassel/slip/wasm-run/example/src/App.tsx",[],"/Users/kennethcassel/slip/wasm-run/example/src/index.tsx",[],"/Users/kennethcassel/slip/wasm-run/example/src/react-app-env.d.ts",[],"/Users/kennethcassel/slip/wasm-run/example/src/reportWebVitals.ts",[],"/Users/kennethcassel/slip/wasm-run/example/src/setupTests.ts",[],"/Users/kennethcassel/slip/wasm-run/lib/cjs/index.js",[],"/Users/kennethcassel/slip/wasm-run/lib/esm/index.js",[],"/Users/kennethcassel/slip/wasm-run/src/index.tsx",["48","49"],"/Users/kennethcassel/slip/wasm-run/commitlint.config.js",[],"/Users/kennethcassel/slip/wasm-run/.eslintrc.js",[],{"ruleId":"50","severity":1,"message":"51","line":3,"column":17,"nodeType":"52","messageId":"53","endLine":13,"endColumn":2,"fix":"54"},{"ruleId":"55","severity":1,"message":"56","line":15,"column":1,"nodeType":"57","endLine":15,"endColumn":23},"react/function-component-definition","Function component is not a function declaration","ArrowFunctionExpression","function-declaration",{"range":"58","text":"59"},"import/no-default-export","Prefer named exports.","ExportDefaultDeclaration",[27,182],"function RunWasm({\n language,\n code,\n}: {\n language: string\n code: string\n}): JSX.Element {\n return
\n Run {language} and execute {code}\n
\n}"] \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..4eb56dc --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +lib/* \ No newline at end of file diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 2cb59b8..0000000 --- a/.eslintrc +++ /dev/null @@ -1 +0,0 @@ -{"parser": "babel-eslint"} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..756cc45 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,15 @@ +module.exports = { + extends: 'galex', + rules: { + 'new-cap': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + 'import/dynamic-import-chunkname': 'off', + 'prefer-destructuring': 'off', + 'import/order': 'off', + '@typescript-eslint/no-floating-promises': 'off', + '@typescript-eslint/consistent-type-definitions': 'off', + }, + env: { + jest: true, + }, +} diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 0000000..31354ec --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/commit-msg b/.husky/commit-msg old mode 100644 new mode 100755 diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..73a7d18 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "semi": false, + "arrowParens": "always", + "singleQuote": true, + "proseWrap": "never" +} diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..4fedde6 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = { extends: ['@commitlint/config-conventional'] } diff --git a/example/src/App.test.tsx b/example/src/App.test.tsx index 2a68616..3a7a8cc 100644 --- a/example/src/App.test.tsx +++ b/example/src/App.test.tsx @@ -1,9 +1,9 @@ -import React from 'react'; -import { render, screen } from '@testing-library/react'; -import App from './App'; +import React from 'react' +import { render, screen } from '@testing-library/react' +import App from './App' test('renders learn react link', () => { - render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); + render() + const linkElement = screen.getByText(/learn react/i) + expect(linkElement).toBeInTheDocument() +}) diff --git a/example/src/App.tsx b/example/src/App.tsx index 08d15ef..fd5d3af 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,13 +1,13 @@ -import React from "react"; -import RunWasm from "run-wasm"; -import "./App.css"; +import React from 'react' +import RunWasm from 'run-wasm' +import './App.css' function App() { return ( -
- +
+
- ); + ) } -export default App; +export default App diff --git a/example/src/index.tsx b/example/src/index.tsx index ef2edf8..ba3503c 100644 --- a/example/src/index.tsx +++ b/example/src/index.tsx @@ -1,17 +1,17 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import './index.css'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; +import React from 'react' +import ReactDOM from 'react-dom' +import './index.css' +import App from './App' +import reportWebVitals from './reportWebVitals' ReactDOM.render( , document.getElementById('root') -); +) // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); +reportWebVitals() diff --git a/example/src/reportWebVitals.ts b/example/src/reportWebVitals.ts index 49a2a16..57a24a2 100644 --- a/example/src/reportWebVitals.ts +++ b/example/src/reportWebVitals.ts @@ -1,15 +1,15 @@ -import { ReportHandler } from 'web-vitals'; +import { ReportHandler } from 'web-vitals' const reportWebVitals = (onPerfEntry?: ReportHandler) => { if (onPerfEntry && onPerfEntry instanceof Function) { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); + getCLS(onPerfEntry) + getFID(onPerfEntry) + getFCP(onPerfEntry) + getLCP(onPerfEntry) + getTTFB(onPerfEntry) + }) } -}; +} -export default reportWebVitals; +export default reportWebVitals diff --git a/example/src/setupTests.ts b/example/src/setupTests.ts index 8f2609b..52aaef1 100644 --- a/example/src/setupTests.ts +++ b/example/src/setupTests.ts @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom'; +import '@testing-library/jest-dom' diff --git a/example/tsconfig.json b/example/tsconfig.json index a273b0c..9d379a3 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "es5", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, @@ -20,7 +16,5 @@ "noEmit": true, "jsx": "react-jsx" }, - "include": [ - "src" - ] + "include": ["src"] } diff --git a/lib/cjs/index.d.ts b/lib/cjs/index.d.ts index bdbd99d..c2e7e0c 100644 --- a/lib/cjs/index.d.ts +++ b/lib/cjs/index.d.ts @@ -1,6 +1,9 @@ /// -declare const RunWasm: ({ language, code, }: { - language: string; - code: string; -}) => JSX.Element; -export default RunWasm; +declare const RunWasm: ({ + language, + code, +}: { + language: string + code: string +}) => JSX.Element +export default RunWasm diff --git a/lib/cjs/index.js b/lib/cjs/index.js index 81e5d9f..2b3b0cd 100644 --- a/lib/cjs/index.js +++ b/lib/cjs/index.js @@ -1,15 +1,21 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var react_1 = __importDefault(require("react")); +'use strict' +var __importDefault = + (this && this.__importDefault) || + function (mod) { + return mod && mod.__esModule ? mod : { default: mod } + } +Object.defineProperty(exports, '__esModule', { value: true }) +var react_1 = __importDefault(require('react')) var RunWasm = function (_a) { - var language = _a.language, code = _a.code; - return (react_1.default.createElement("div", null, - "Run ", - language, - " and execute ", - code)); -}; -exports.default = RunWasm; + var language = _a.language, + code = _a.code + return react_1.default.createElement( + 'div', + null, + 'Run ', + language, + ' and execute ', + code + ) +} +exports.default = RunWasm diff --git a/lib/esm/index.d.ts b/lib/esm/index.d.ts index bdbd99d..c2e7e0c 100644 --- a/lib/esm/index.d.ts +++ b/lib/esm/index.d.ts @@ -1,6 +1,9 @@ /// -declare const RunWasm: ({ language, code, }: { - language: string; - code: string; -}) => JSX.Element; -export default RunWasm; +declare const RunWasm: ({ + language, + code, +}: { + language: string + code: string +}) => JSX.Element +export default RunWasm diff --git a/lib/esm/index.js b/lib/esm/index.js index 34921a7..3d328d3 100644 --- a/lib/esm/index.js +++ b/lib/esm/index.js @@ -1,10 +1,15 @@ -import React from "react"; +import React from 'react' +// Run Wasm var RunWasm = function (_a) { - var language = _a.language, code = _a.code; - return (React.createElement("div", null, - "Run ", - language, - " and execute ", - code)); -}; -export default RunWasm; + var language = _a.language, + code = _a.code + return React.createElement( + 'div', + null, + 'Run ', + language, + ' and execute ', + code + ) +} +export default RunWasm diff --git a/package.json b/package.json index cf8ad5b..b512c6c 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "build": "yarn build:esm && yarn build:cjs", "check-types": "tsc", "format": "prettier --write --list-different --ignore-path .gitignore .", - "lint": "eslint --cache . --ignore-path .gitignore", + "lint": "eslint --cache . --ignore-path .gitignore --ignore-pattern 'lib/*'", "build:esm": "tsc", "build:cjs": "tsc --module commonjs --outDir lib/cjs", "install:clean": "rm -rf node_modules && rm yarn.lock && yarn", diff --git a/src/index.tsx b/src/index.tsx index b7fd0b2..e74f2c5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,15 +1,15 @@ -import React from "react"; +import React from 'react' const RunWasm = ({ language, code, }: { - language: string; - code: string; + language: string + code: string }): JSX.Element => (
Run {language} and execute {code}
-); +) -export default RunWasm; +export default RunWasm diff --git a/tsconfig.json b/tsconfig.json index 634d811..b724a62 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,22 +1,37 @@ { "compilerOptions": { - "outDir": "lib/esm", - "module": "esnext", + "baseUrl": ".", + "paths": { + "@/components/*": ["components/*"], + "@/pages/*": ["pages/*"], + "@/constants/*": ["constants/*"], + "@/styles/*": ["styles/*"], + "@/utils/*": ["utils/*"], + "@/lib/*": ["lib/*"], + "@/types/*": ["types/*"], + "@/hooks/*": ["hooks/*"] + }, "target": "es5", - "lib": ["es6", "dom", "es2016", "es2017"], - "jsx": "react", - "declaration": true, - "moduleResolution": "node", - "noUnusedLocals": true, - "noUnusedParameters": true, + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, "esModuleInterop": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noImplicitAny": true, - "strictNullChecks": true, - "suppressImplicitAnyIndexErrors": true, - "allowSyntheticDefaultImports": true + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve" }, - "include": ["src"], - "exclude": ["node_modules", "lib"] + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + "components/LessonSortableItem.js", + "components/FileUploader.js", + "pages/api/stripe/webhook.ts" + ], + "exclude": ["node_modules"] } diff --git a/yarn.lock b/yarn.lock index 05d1756..d922362 100644 --- a/yarn.lock +++ b/yarn.lock @@ -518,9 +518,9 @@ integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== "@types/node@*": - version "16.9.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708" - integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g== + version "16.9.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.2.tgz#81f5a039d6ed1941f8cc57506c74e7c2b8fc64b9" + integrity sha512-ZHty/hKoOLZvSz6BtP1g7tc7nUeJhoCf3flLjh8ZEv1vFKBWHXcnMbJMyN/pftSljNyy0kNW/UqI3DccnBnZ8w== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -1217,9 +1217,9 @@ dot-prop@^5.1.0: is-obj "^2.0.0" electron-to-chromium@^1.3.830: - version "1.3.840" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.840.tgz#3f2a1df97015d9b1db5d86a4c6bd4cdb920adcbb" - integrity sha512-yRoUmTLDJnkIJx23xLY7GbSvnmDCq++NSuxHDQ0jiyDJ9YZBUGJcrdUqm+ZwZFzMbCciVzfem2N2AWiHJcWlbw== + version "1.3.841" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.841.tgz#c3088948462df0dea552877ad0902df6d0d55de0" + integrity sha512-0w3dJaRfl4A+LfbdvZaGT3JPm6TbTYKeJj8y5YWaEI9Z4WBNIshlzxL3S1msMGpuhiMZQE9cfgAV8oMib+Z4Tg== emoji-regex@^8.0.0: version "8.0.0"