Skip to content

Commit 851f506

Browse files
authored
Meta cleanup (#11)
* fix: move eslint to devDependencies * chore: remove unused babel transpilation step * chore: remove unused jest * chore: remove unused execa * chore: setup linting * chore: update dated dependencies
1 parent 61858ef commit 851f506

File tree

6 files changed

+807
-3891
lines changed

6 files changed

+807
-3891
lines changed

.eslintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"airbnb-base",
5+
"plugin:prettier/recommended"
6+
],
7+
"plugins": ["prettier"],
8+
"rules": {
9+
"class-methods-use-this": "off",
10+
"func-names": "off",
11+
"no-console": "off",
12+
"no-underscore-dangle": "off"
13+
}
14+
}

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
node_modules
2-
build
1+
node_modules/

jest.config.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

package.json

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jest-watch-select-projects",
33
"version": "0.1.2",
4-
"main": "build/index.js",
4+
"main": "src/index.js",
55
"author": "Rogelio Guzman <[email protected]>",
66
"description": "An experimental ESLint runner for Jest",
77
"license": "MIT",
@@ -11,34 +11,25 @@
1111
},
1212
"homepage": "https://github.com/rogeliog/jest-watch-select-projects",
1313
"files": [
14-
"build/"
14+
"src/"
1515
],
1616
"scripts": {
1717
"test": "echo No tests are set up",
1818
"lint": "eslint .",
19-
"watch": "babel src -w --ignore **/*.test.js,integration -d build",
20-
"build": "babel src --ignore **/*.test.js,integration -d build",
21-
"prepublish": "yarn build",
22-
"format": "prettier --single-quote --trailing-comma all --write \"!(build)/**/*.js\""
19+
"format": "prettier --single-quote --trailing-comma all --write \"**/*.js\""
2320
},
2421
"dependencies": {
2522
"ansi-escapes": "^3.1.0",
2623
"chalk": "^2.4.1",
27-
"eslint": "^4.5.0",
28-
"prompts": "^0.1.8"
24+
"prompts": "^2.2.1"
2925
},
3026
"devDependencies": {
31-
"babel-cli": "6.26.0",
32-
"babel-jest": "23.0.1",
33-
"babel-preset-env": "1.7.0",
34-
"eslint-config-airbnb-base": "12.1.0",
35-
"eslint-config-prettier": "2.9.0",
36-
"eslint-plugin-import": "2.12.0",
37-
"eslint-plugin-jest": "21.17.0",
38-
"eslint-plugin-prettier": "2.6.0",
39-
"execa": "0.8.0",
40-
"jest": "23.0.1",
41-
"prettier": "1.13.0"
27+
"eslint": "^5.16.0",
28+
"eslint-config-airbnb-base": "^14.0.0",
29+
"eslint-config-prettier": "^4.3.0",
30+
"eslint-plugin-import": "^2.18.2",
31+
"eslint-plugin-prettier": "^3.1.0",
32+
"prettier": "^1.13.0"
4233
},
4334
"prettier": {
4435
"singleQuote": true,

src/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class JestPluginProjects {
2121

2222
apply(jestHook) {
2323
jestHook.onFileChange(({ projects }) => this._setProjects(projects));
24-
jestHook.shouldRunTestSuite(({ testPath, config }) => {
24+
jestHook.shouldRunTestSuite(({ config }) => {
2525
const name = this._getDisplayName(config) || this._getBasename(config);
2626
return (
2727
this._activeProjects[name] === undefined || this._activeProjects[name]
@@ -80,12 +80,13 @@ Add a \`displayName\` to at least one of them to prevent name collision.
8080
_setActiveProjects(activeProjects) {
8181
this._numActiveProjects = activeProjects.length;
8282
this._activeProjects = this._projectNames.reduce((memo, name) => {
83+
// eslint-disable-next-line no-param-reassign
8384
memo[name] = activeProjects.includes(name);
8485
return memo;
8586
}, {});
8687
}
8788

88-
run(globalConfig) {
89+
run() {
8990
console.log(ansiEscapes.clearScreen);
9091
return prompts([
9192
{
@@ -114,12 +115,12 @@ Add a \`displayName\` to at least one of them to prevent name collision.
114115

115116
if (this._numActiveProjects === numProjects) {
116117
return '(all selected)';
117-
} else if (this._numActiveProjects === 0) {
118+
}
119+
if (this._numActiveProjects === 0) {
118120
return '(zero selected)';
119-
} else {
120-
return `(${this._numActiveProjects}/${numProjects} selected)`;
121121
}
122-
return;
122+
123+
return `(${this._numActiveProjects}/${numProjects} selected)`;
123124
}
124125

125126
getUsageInfo() {

0 commit comments

Comments
 (0)