1
1
<div align =" center " >
2
2
<h1 >@hover/javascript 🛠📦</h1 >
3
3
4
- <p >CLI toolbox for common scripts for <del >my</ del > < strong >our </strong > projects</ p >
5
- </div >
4
+ <p >CLI toolbox for common scripts for <strong >JavaScript </strong > and
5
+ <strong >TypeScript</ strong > projects</ p >< /div >
6
6
7
7
<hr />
8
8
11
11
[ ![ Dependabot Status] [ dependabot-badge ]] [ dependabot ]
12
12
[ ![ version] [ version-badge ]] [ package ] [ ![ MIT License] [ license-badge ]] [ license ]
13
13
14
- ## The problem
15
-
16
- ~~ I~~ ** We** do a bunch of open source and want to make it easier to maintain so
17
- many projects.
18
-
19
- ## This solution
20
-
21
14
This is a CLI that abstracts away all configuration for ~~ my~~ ** our** open
22
15
source projects for linting, testing, building, and more.
23
16
24
- ## Table of Contents
17
+ ## Contents
25
18
26
19
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
27
20
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -44,7 +37,7 @@ yarn add -D @hover/javascript
44
37
45
38
## Usage
46
39
47
- This is a CLI and exposes a bin called ` hover-scripts ` . You'll find all
40
+ This is a CLI and exposes a bin called ** ` hover-scripts ` ** . You'll find all
48
41
available scripts in ` src/scripts ` .
49
42
50
43
This project actually dogfoods itself. If you look in the ` package.json ` , you'll
@@ -53,42 +46,54 @@ the things you can do with `hover-scripts`.
53
46
54
47
### Overriding Config
55
48
56
- Unlike ` react-scripts ` , ` hover-scripts ` allows you to specify your own
57
- configuration for things and have that plug directly into the way things work
58
- with ` hover-scripts ` . There are various ways that it works, but basically if you
59
- want to have your own config for something, just add the configuration and
60
- ` hover-scripts ` will use that instead of it's own internal config. In addition,
61
- ` hover-scripts ` exposes its configuration so you can use it and override only
62
- the parts of the config you need to.
49
+ Unlike ** [ react-scripts] [ react-scripts-link ] ** , ` hover-scripts ` allows you to
50
+ specify your own configuration for things and have that plug directly into the
51
+ way things work with ` hover-scripts ` . There are various ways that it works, but
52
+ basically if you want to have your own config for something, just add the
53
+ configuration and ` hover-scripts ` will use that instead of it's own internal
54
+ config. In addition, ` hover-scripts ` exposes its configuration so you can use it
55
+ and override only the parts of the config you need to.
63
56
64
57
This can be a very helpful way to make editor integration work for tools like
65
58
ESLint which require project-based ESLint configuration to be present to work.
66
59
67
- So, if we were to do this for ESLint, you could create an ` .eslintrc ` with the
68
- contents of:
60
+ #### ESLint
69
61
70
- ```
71
- {"extends": "./node_modules/@hover/javascript/eslint.js"}
62
+ So, if we were to do this for ESLint, you could create an ` .eslintrc.js ` with
63
+ the contents of:
64
+
65
+ ``` js
66
+ module .exports = {
67
+ extends: require .resolve (' @hover/javascript/eslint' ),
68
+ // Include this when using TypeScript
69
+ parserOptions: {
70
+ project: [' ./tsconfig.json' ],
71
+ },
72
+ }
72
73
```
73
74
74
- Or, for ` babel ` , a ` .babelrc ` with:
75
+ #### Prettier
75
76
76
- ```
77
- {"presets": ["@hover/javascript/babel"]}
77
+ Or, for Prettier, a ` .prettierrc.js ` with:
78
+
79
+ ``` js
80
+ module .exports = require (' @hover/javascript/prettier' )
78
81
```
79
82
80
- Or, for ` jest ` :
83
+ #### Jest
81
84
82
- ``` javascript
83
- const {jest: jestConfig } = require (' @hover/javascript/jest' )
84
- module .exports = Object .assign (jestConfig, {
85
- // your overrides here
85
+ Or, for Jest in ` jest.config.js ` :
86
86
87
- // for test written in Typescript, add:
88
- transform: {
89
- ' \\ .(ts|tsx)$' : ' <rootDir>/node_modules/ts-jest/preprocessor.js' ,
90
- },
91
- })
87
+ > Note: if ** ts-jest** is installed, it will automatically be used as the
88
+ > ` preset `
89
+
90
+ ``` js
91
+ const config = require (' @hover/javascript/jest' )
92
+
93
+ module .exports = {
94
+ ... config,
95
+ coverageThreshold: null ,
96
+ }
92
97
```
93
98
94
99
> Note: ` hover-scripts ` intentionally does not merge things for you when you
@@ -102,6 +107,8 @@ module.exports = Object.assign(jestConfig, {
102
107
103
108
MIT
104
109
110
+ [ react-scripts-link] :
111
+ https://github.com/facebook/create-react-app/tree/master/packages/react-scripts
105
112
[ npm ] : https://www.npmjs.com/
106
113
[ node ] : https://nodejs.org
107
114
[ build-badge] :
0 commit comments