diff --git a/template/default/example/src/App.js b/template/default/example/src/App.js index 5c55c53..c51c2b8 100644 --- a/template/default/example/src/App.js +++ b/template/default/example/src/App.js @@ -4,7 +4,7 @@ import { ExampleComponent } from '{{name}}' import '{{name}}/dist/index.css' const App = () => { - return + return } export default App diff --git a/template/default/package.json b/template/default/package.json index 955a46e..9a0919b 100644 --- a/template/default/package.json +++ b/template/default/package.json @@ -21,7 +21,8 @@ "test:unit": "cross-env CI=1 react-scripts test --env=jsdom", "test:watch": "react-scripts test --env=jsdom", "predeploy": "cd example && {{manager}} install && {{manager}} run build", - "deploy": "gh-pages -d example/build" + "deploy": "gh-pages -d example/build", + "pre-commit": "lint-staged" }, "peerDependencies": { "react": "^16.0.0" @@ -43,10 +44,22 @@ "gh-pages": "^2.2.0", "npm-run-all": "^4.1.5", "prettier": "^2.0.4", + "husky": "^4.2.5", + "lint-staged": "^10.3.0", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "^3.4.1" }, + "husky": { + "hooks": { + "pre-commit": "{{manager}} run pre-commit" + } + }, + "lint-staged": { + "*.{js|json}": [ + "prettier --write" + ] + }, "files": [ "dist" ] diff --git a/template/flow/.eslintrc b/template/flow/.eslintrc index d810f78..ab54247 100644 --- a/template/flow/.eslintrc +++ b/template/flow/.eslintrc @@ -30,27 +30,15 @@ "react/jsx-fragments": 0, "react/no-unused-prop-types": 0, "import/export": 0, - "flowtype/boolean-style": [ - 2, - "boolean" - ], + "flowtype/boolean-style": [2, "boolean"], "flowtype/define-flow-type": 1, - "flowtype/delimiter-dangle": [ - 2, - "never" - ], - "flowtype/generic-spacing": [ - 2, - "never" - ], + "flowtype/delimiter-dangle": [2, "never"], + "flowtype/generic-spacing": [2, "never"], "flowtype/no-mixed": 2, "flowtype/no-primitive-constructor-types": 2, "flowtype/no-types-missing-file-annotation": 2, "flowtype/no-weak-types": 2, - "flowtype/object-type-delimiter": [ - 2, - "comma" - ], + "flowtype/object-type-delimiter": [2, "comma"], "flowtype/require-parameter-type": 2, "flowtype/require-readonly-react-props": 0, "flowtype/require-return-type": [ @@ -61,30 +49,12 @@ } ], "flowtype/require-valid-file-annotation": 2, - "flowtype/semi": [ - 2, - "always" - ], - "flowtype/space-after-type-colon": [ - 2, - "always" - ], - "flowtype/space-before-generic-bracket": [ - 2, - "never" - ], - "flowtype/space-before-type-colon": [ - 2, - "never" - ], - "flowtype/type-id-match": [ - 2, - "^([A-Z][a-z0-9]+)+Type$" - ], - "flowtype/union-intersection-spacing": [ - 2, - "always" - ], + "flowtype/semi": [2, "always"], + "flowtype/space-after-type-colon": [2, "always"], + "flowtype/space-before-generic-bracket": [2, "never"], + "flowtype/space-before-type-colon": [2, "never"], + "flowtype/type-id-match": [2, "^([A-Z][a-z0-9]+)+Type$"], + "flowtype/union-intersection-spacing": [2, "always"], "flowtype/use-flow-type": 1, "flowtype/valid-syntax": 1 } diff --git a/template/flow/example/src/App.js b/template/flow/example/src/App.js index 5c55c53..c51c2b8 100644 --- a/template/flow/example/src/App.js +++ b/template/flow/example/src/App.js @@ -4,7 +4,7 @@ import { ExampleComponent } from '{{name}}' import '{{name}}/dist/index.css' const App = () => { - return + return } export default App diff --git a/template/flow/package.json b/template/flow/package.json index c2a8c5d..5a0eda7 100644 --- a/template/flow/package.json +++ b/template/flow/package.json @@ -21,7 +21,8 @@ "test:unit": "cross-env CI=1 react-scripts test --env=jsdom", "test:watch": "react-scripts test --env=jsdom", "predeploy": "cd example && {{manager}} install && {{manager}} run build", - "deploy": "gh-pages -d example/build" + "deploy": "gh-pages -d example/build", + "pre-commit": "lint-staged" }, "peerDependencies": { "react": "^16.0.0" @@ -43,12 +44,24 @@ "gh-pages": "^2.2.0", "npm-run-all": "^4.1.5", "prettier": "^2.0.4", + "husky": "^4.2.5", + "lint-staged": "^10.3.0", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "^3.4.1", "@babel/preset-flow": "^7.10.1", "eslint-plugin-flowtype": "^5.1.3" }, + "husky": { + "hooks": { + "pre-commit": "{{manager}} run pre-commit" + } + }, + "lint-staged": { + "*.{js|json}": [ + "prettier --write" + ] + }, "files": [ "dist" ] diff --git a/template/typescript/example/src/App.tsx b/template/typescript/example/src/App.tsx index 5c55c53..c51c2b8 100644 --- a/template/typescript/example/src/App.tsx +++ b/template/typescript/example/src/App.tsx @@ -4,7 +4,7 @@ import { ExampleComponent } from '{{name}}' import '{{name}}/dist/index.css' const App = () => { - return + return } export default App diff --git a/template/typescript/example/src/setupTests.ts b/template/typescript/example/src/setupTests.ts index 74b1a27..2eb59b0 100644 --- a/template/typescript/example/src/setupTests.ts +++ b/template/typescript/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/extend-expect'; +import '@testing-library/jest-dom/extend-expect' diff --git a/template/typescript/package.json b/template/typescript/package.json index b07ff77..5a85b9c 100644 --- a/template/typescript/package.json +++ b/template/typescript/package.json @@ -21,7 +21,8 @@ "test:unit": "cross-env CI=1 react-scripts test --env=jsdom", "test:watch": "react-scripts test --env=jsdom", "predeploy": "cd example && {{manager}} install && {{manager}} run build", - "deploy": "gh-pages -d example/build" + "deploy": "gh-pages -d example/build", + "pre-commit": "lint-staged" }, "peerDependencies": { "react": "^16.0.0" @@ -52,11 +53,23 @@ "gh-pages": "^2.2.0", "npm-run-all": "^4.1.5", "prettier": "^2.0.4", + "husky": "^4.2.5", + "lint-staged": "^10.3.0", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "^3.4.1", "typescript": "^3.7.5" }, + "husky": { + "hooks": { + "pre-commit": "{{manager}} run pre-commit" + } + }, + "lint-staged": { + "*.{js|json}": [ + "prettier --write" + ] + }, "files": [ "dist" ] diff --git a/template/typescript/src/typings.d.ts b/template/typescript/src/typings.d.ts index 9118bbc..0b7e922 100644 --- a/template/typescript/src/typings.d.ts +++ b/template/typescript/src/typings.d.ts @@ -3,23 +3,24 @@ * will be overridden with file-specific definitions by rollup */ declare module '*.css' { - const content: { [className: string]: string }; - export default content; + const content: { [className: string]: string } + export default content } declare module '*.scss' { - const content: { [className: string]: string }; - export default content; + const content: { [className: string]: string } + export default content } declare module '*.less' { - const content: { [className: string]: string }; - export default content; + const content: { [className: string]: string } + export default content } -interface SvgrComponent extends React.StatelessComponent> {} +interface SvgrComponent + extends React.StatelessComponent> {} declare module '*.svg' { - const svgUrl: string; - const svgComponent: SvgrComponent; - export default svgUrl; + const svgUrl: string + const svgComponent: SvgrComponent + export default svgUrl export { svgComponent as ReactComponent } } diff --git a/template/typescript/tsconfig.test.json b/template/typescript/tsconfig.test.json index 65ffdd4..2c7b284 100644 --- a/template/typescript/tsconfig.test.json +++ b/template/typescript/tsconfig.test.json @@ -3,4 +3,4 @@ "compilerOptions": { "module": "commonjs" } -} \ No newline at end of file +}