11<div align =" center " >
22<h1 >@hover/javascript 🛠📦</h1 >
33
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 >
66
77<hr />
88
1111[ ![ Dependabot Status] [ dependabot-badge ]] [ dependabot ]
1212[ ![ version] [ version-badge ]] [ package ] [ ![ MIT License] [ license-badge ]] [ license ]
1313
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-
2114This is a CLI that abstracts away all configuration for ~~ my~~ ** our** open
2215source projects for linting, testing, building, and more.
2316
24- ## Table of Contents
17+ ## Contents
2518
2619<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2720<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -44,7 +37,7 @@ yarn add -D @hover/javascript
4437
4538## Usage
4639
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
4841available scripts in ` src/scripts ` .
4942
5043This 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`.
5346
5447### Overriding Config
5548
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.
6356
6457This can be a very helpful way to make editor integration work for tools like
6558ESLint which require project-based ESLint configuration to be present to work.
6659
67- So, if we were to do this for ESLint, you could create an ` .eslintrc ` with the
68- contents of:
60+ #### ESLint
6961
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+ }
7273```
7374
74- Or, for ` babel ` , a ` .babelrc ` with:
75+ #### Prettier
7576
76- ```
77- {"presets": ["@hover/javascript/babel"]}
77+ Or, for Prettier, a ` .prettierrc.js ` with:
78+
79+ ``` js
80+ module .exports = require (' @hover/javascript/prettier' )
7881```
7982
80- Or, for ` jest ` :
83+ #### Jest
8184
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 ` :
8686
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+ }
9297```
9398
9499> Note: ` hover-scripts ` intentionally does not merge things for you when you
@@ -102,6 +107,8 @@ module.exports = Object.assign(jestConfig, {
102107
103108MIT
104109
110+ [ react-scripts-link] :
111+ https://github.com/facebook/create-react-app/tree/master/packages/react-scripts
105112[ npm ] : https://www.npmjs.com/
106113[ node ] : https://nodejs.org
107114[ build-badge] :
0 commit comments