Skip to content

Commit ab6ffee

Browse files
author
Kent C. Dodds
authored
fix(deps): upgrade all dependencies and cleanup (#117)
1 parent 61f5059 commit ab6ffee

File tree

11 files changed

+130
-5770
lines changed

11 files changed

+130
-5770
lines changed

.eslintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": [
3+
"kentcdodds",
4+
"kentcdodds/prettier",
5+
"kentcdodds/jest"
6+
],
7+
"rules": {
8+
"valid-jsdoc": "off",
9+
"max-len": "off"
10+
}
11+
}

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
/node_modules
2-
.nyc_output
1+
node_modules
32
coverage
43
dist
54
.opt-in
65
.opt-out
6+
.DS_Store
7+
.eslintcache
8+
9+
# these cause more harm than good
10+
# when working with contributors
11+
package-lock.json
12+
yarn.lock

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ cache:
66
notifications:
77
email: false
88
node_js:
9-
- '6'
9+
- '8'
1010
script:
11-
- yarn start validate
11+
- npm start validate
1212
after_success:
13-
- yarn start report-coverage
14-
- yarn start release
13+
- npx codecov
14+
- npm i -g semantic-release@7 && semantic-release pre && npm publish && semantic-release post
1515
branches:
1616
only:
1717
- master
18-
- /^greenkeeper/.*$/

CONTRIBUTING.md

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,77 @@ Thanks for being willing to contribute!
88
## Project setup
99

1010
1. Fork and clone the repo
11-
2. `$ yarn install` to install dependencies
12-
3. `$ yarn start validate` to validate you've got it working
11+
2. `$ npm install` to install dependencies
12+
3. `$ npm start validate` to validate you've got it working
1313
4. Create a branch for your PR
1414

15-
This project uses [`nps`][nps] and you can run `yarn start` to see what scripts are available.
15+
This project uses [`nps`][nps] and you can run `npm start help` to see what
16+
scripts are available.
17+
18+
> Tip: Keep your `master` branch pointing at the original repository and make
19+
> pull requests from branches on your fork. To do this, run:
20+
>
21+
> ```
22+
> git remote add upstream https://github.com/prettier/prettier-eslint.git
23+
> git fetch upstream
24+
> git branch --set-upstream-to=upstream/master master
25+
> ```
26+
>
27+
> This will add the original repository as a "remote" called "upstream,"
28+
> Then fetch the git information from that remote, then set your local `master`
29+
> branch to use the upstream master branch whenever you run `git pull`.
30+
> Then you can make all of your pull request branches based on this `master`
31+
> branch. Whenever you want to update your version of `master`, do a regular
32+
> `git pull`.
1633
1734
## Add yourself as a contributor
1835
19-
This project follows the [all contributors][all-contributors] specification. To add yourself to the table of
20-
contributors on the README.md, please use the automated script as part of your PR:
36+
This project follows the [all contributors][all-contributors] specification.
37+
To add yourself to the table of contributors on the README.md, please use the
38+
automated script as part of your PR:
2139
2240
```console
23-
yarn start contributors.add
41+
npm start contributors.add
2442
```
2543
26-
Follow the prompt. If you've already added yourself to the list and are making a new type of contribution, you can run
27-
it again and select the added contribution type.
44+
Follow the prompt and commit `.all-contributorsrc` and `README.md` in the PR.
45+
If you've already added yourself to the list and are making
46+
a new type of contribution, you can run it again and select the added
47+
contribution type.
2848

2949
## Committing and Pushing changes
3050

31-
This project uses [`semantic-release`][semantic-release] to do automatic releases and generate a changelog based on the
32-
commit history. So we follow [a convention][convention] for commit messages. Please follow this convention for your
33-
commit messages.
51+
This project uses [`semantic-release`][semantic-release] to do automatic
52+
releases and generate a changelog based on the commit history. So we follow
53+
[a convention][convention] for commit messages. You don't have to follow this
54+
convention if you don't like to. Just know that when we merge your commit, we'll
55+
probably use "Squash and Merge" so we can change the commit message :)
3456

35-
You can use `commitizen` to help you to follow [the convention][convention]
36-
37-
Once you are ready to commit the changes, please use the below commands
38-
39-
1. `git add <files to be committed>`
40-
2. `$ yarn start commit`
41-
42-
... and follow the instruction of the interactive prompt.
57+
Please make sure to run the tests before you commit your changes. You can run
58+
`npm start test.update` which will update any snapshots that need updating.
59+
Make sure to include those changes (if they exist) in your commit.
4360

4461
### opt into git hooks
4562

46-
There are git hooks set up with this project that are automatically installed when you install dependencies. They're
47-
really handy, but are turned off by default (so as to not hinder new contributors). You can opt into these by creating
48-
a file called `.opt-in` at the root of the project and putting this inside:
63+
There are git hooks set up with this project that are automatically installed
64+
when you install dependencies. They're really handy, but are turned off by
65+
default (so as to not hinder new contributors). You can opt into these by
66+
creating a file called `.opt-in` at the root of the project and putting this
67+
inside:
4968

5069
```
51-
commit-msg
5270
pre-commit
5371
```
5472

5573
## Help needed
5674

57-
Please checkout the [ROADMAP.md][ROADMAP] and raise an issue to discuss
58-
any of the items in the want to do or might do list.
75+
Please checkout the [the open issues][issues]
5976

6077
Also, please watch the repo and respond to questions/bug reports/feature requests! Thanks!
6178

6279
[egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github
6380
[semantic-release]: https://npmjs.com/package/semantic-release
6481
[convention]: https://github.com/conventional-changelog/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md
6582
[all-contributors]: https://github.com/kentcdodds/all-contributors
66-
[ROADMAP]: ./other/ROADMAP.md
67-
[nps]: https://npmjs.com/package/nps
83+
[issues]: https://github.com/prettier/prettier-eslint/issues
84+
[nps]: https://github.com/kentcdodds/nps

jest.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
testEnvironment: 'node',
3+
collectCoverageFrom: ['src/**/*.js'],
4+
testPathIgnorePatterns: ['/node_modules/', '/fixtures/', '/__mocks__/'],
5+
coveragePathIgnorePatterns: ['/node_modules/', '/fixtures/', '/__mocks__/'],
6+
coverageThreshold: {
7+
global: {
8+
branches: 100,
9+
functions: 100,
10+
lines: 100,
11+
statements: 100,
12+
},
13+
},
14+
}

package-scripts.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const npsUtils = require('nps-utils')
33
const series = npsUtils.series
44
const concurrent = npsUtils.concurrent
55
const rimraf = npsUtils.rimraf
6+
const crossEnv = npsUtils.crossEnv
67

78
module.exports = {
89
scripts: {
@@ -16,39 +17,40 @@ module.exports = {
1617
script: 'all-contributors generate',
1718
},
1819
},
19-
commit: {
20-
description: 'This uses commitizen to help us generate well formatted commit messages',
21-
script: 'git-cz',
22-
},
2320
test: {
24-
default: 'jest --coverage',
25-
watch: 'jest --watch',
21+
default: crossEnv('NODE_ENV=test jest --coverage'),
22+
update: crossEnv('NODE_ENV=test jest --coverage --updateSnapshot'),
23+
watch: crossEnv('NODE_ENV=test jest --watch'),
24+
openCoverage: 'open coverage/lcov-report/index.html',
2625
},
2726
build: {
2827
description: 'delete the dist directory and run babel to build the files',
2928
script: series(
3029
rimraf('dist'),
31-
'babel --copy-files --out-dir dist --ignore *.test.js,__mocks__ src'
30+
'babel --copy-files --out-dir dist --ignore __tests__,__mocks__ src'
3231
),
3332
},
3433
lint: {
3534
description: 'lint the entire project',
36-
script: 'eslint .',
35+
script: 'eslint . --cache',
3736
},
3837
reportCoverage: {
39-
description: 'Report coverage stats to codecov. This should be run after the `test` script',
38+
description:
39+
'Report coverage stats to codecov. This should be run after the `test` script',
4040
script: 'codecov',
4141
},
4242
release: {
43-
description: 'We automate releases with semantic-release. This should only be run on travis',
43+
description:
44+
'We automate releases with semantic-release. This should only be run on travis',
4445
script: series(
4546
'semantic-release pre',
4647
'npm publish',
4748
'semantic-release post'
4849
),
4950
},
5051
validate: {
51-
description: 'This runs several scripts to make sure things look good before committing or on clean install',
52+
description:
53+
'This runs several scripts to make sure things look good before committing or on clean install',
5254
script: concurrent.nps('lint', 'build', 'test'),
5355
},
5456
format: {

package.json

Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"scripts": {
77
"start": "nps",
88
"test": "nps test",
9-
"commitmsg": "opt --in commit-msg --exec \"validate-commit-msg\"",
10-
"precommit": "opt --in pre-commit --exec \"npm start validate\"",
11-
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
9+
"precommit": "opt --in pre-commit --exec \"npm start validate\""
1210
},
1311
"files": [
1412
"dist"
@@ -19,70 +17,36 @@
1917
"dependencies": {
2018
"common-tags": "^1.4.0",
2119
"dlv": "^1.1.0",
22-
"eslint": "^3.19.0",
23-
"indent-string": "^3.1.0",
20+
"eslint": "^4.5.0",
21+
"indent-string": "^3.2.0",
2422
"lodash.merge": "^4.6.0",
2523
"loglevel-colored-level-prefix": "^1.0.0",
26-
"prettier": "^1.5.0",
24+
"prettier": "^1.6.0",
2725
"pretty-format": "^20.0.3",
2826
"require-relative": "^0.8.7"
2927
},
3028
"devDependencies": {
31-
"all-contributors-cli": "^4.3.0",
32-
"babel-cli": "^6.24.1",
29+
"all-contributors-cli": "^4.4.0",
30+
"babel-cli": "^6.26.0",
3331
"babel-jest": "^20.0.3",
34-
"babel-polyfill": "^6.16.0",
35-
"babel-preset-env": "^1.5.1",
32+
"babel-polyfill": "^6.26.0",
33+
"babel-preset-env": "^1.6.0",
3634
"babel-preset-stage-2": "^6.24.1",
37-
"babel-register": "^6.24.1",
38-
"chalk": "^1.1.3",
39-
"codecov": "^2.2.0",
40-
"commitizen": "^2.8.6",
41-
"cz-conventional-changelog": "^2.0.0",
42-
"eslint-config-kentcdodds": "^12.4.1",
43-
"husky": "^0.13.4",
35+
"babel-register": "^6.26.0",
36+
"chalk": "^2.1.0",
37+
"eslint-config-kentcdodds": "^12.4.2",
38+
"husky": "^0.14.3",
4439
"jest-cli": "^20.0.4",
45-
"nps": "^5.3.1",
46-
"nps-utils": "^1.2.0",
47-
"opt-cli": "^1.5.1",
48-
"prettier-eslint-cli": "^4.0.3",
40+
"nps": "^5.7.1",
41+
"nps-utils": "^1.3.0",
42+
"opt-cli": "^1.5.2",
43+
"prettier-eslint-cli": "^4.2.1",
4944
"rimraf": "^2.5.4",
50-
"semantic-release": "^6.3.2",
51-
"strip-indent": "^2.0.0",
52-
"validate-commit-msg": "^2.12.1"
45+
"strip-indent": "^2.0.0"
5346
},
5447
"engines": {
5548
"node": ">=4.0.0"
5649
},
57-
"eslintConfig": {
58-
"extends": [
59-
"kentcdodds",
60-
"kentcdodds/jest"
61-
],
62-
"rules": {
63-
"valid-jsdoc": 0,
64-
"max-len": [
65-
2,
66-
80
67-
]
68-
}
69-
},
70-
"jest": {
71-
"testEnvironment": "jest-environment-node",
72-
"coverageThreshold": {
73-
"global": {
74-
"branches": 100,
75-
"functions": 100,
76-
"lines": 100,
77-
"statements": 100
78-
}
79-
}
80-
},
81-
"config": {
82-
"commitizen": {
83-
"path": "node_modules/cz-conventional-changelog"
84-
}
85-
},
8650
"repository": {
8751
"type": "git",
8852
"url": "https://github.com/prettier/prettier-eslint.git"

src/__mocks__/eslint.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@ module.exports = Object.assign(eslint, {
1818

1919
function MockCLIEngine(...args) {
2020
global.__PRETTIER_ESLINT_TEST_STATE__.eslintPath = __filename
21-
CLIEngine.apply(this, args)
22-
// not sure why, but in some cases, this.executeOnText is undefined...
23-
// so we create a fakeCLIEngine to get a copy of that function
24-
// and call it with apply :)
25-
const fakeCLIEngine = new CLIEngine(...args)
26-
this.getConfigForFile = mockGetConfigForFileSpy
27-
this._originalExecuteOnText = fakeCLIEngine.executeOnText
28-
this.executeOnText = mockExecuteOnTextSpy
21+
const cliEngine = new CLIEngine(...args)
22+
cliEngine.getConfigForFile = mockGetConfigForFileSpy
23+
cliEngine._originalExecuteOnText = cliEngine.executeOnText
24+
cliEngine.executeOnText = mockExecuteOnTextSpy
25+
return cliEngine
2926
}
3027

3128
MockCLIEngine.prototype = Object.create(CLIEngine.prototype)

0 commit comments

Comments
 (0)