Skip to content

Commit

Permalink
Meta cleanup (#11)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
SimenB authored Sep 7, 2019
1 parent 61858ef commit 851f506
Show file tree
Hide file tree
Showing 6 changed files with 807 additions and 3,891 deletions.
14 changes: 14 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": [
"eslint:recommended",
"airbnb-base",
"plugin:prettier/recommended"
],
"plugins": ["prettier"],
"rules": {
"class-methods-use-this": "off",
"func-names": "off",
"no-console": "off",
"no-underscore-dangle": "off"
}
}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules
build
node_modules/
8 changes: 0 additions & 8 deletions jest.config.js

This file was deleted.

29 changes: 10 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jest-watch-select-projects",
"version": "0.1.2",
"main": "build/index.js",
"main": "src/index.js",
"author": "Rogelio Guzman <rogelioguzmanh@gmail.com>",
"description": "An experimental ESLint runner for Jest",
"license": "MIT",
Expand All @@ -11,34 +11,25 @@
},
"homepage": "https://github.com/rogeliog/jest-watch-select-projects",
"files": [
"build/"
"src/"
],
"scripts": {
"test": "echo No tests are set up",
"lint": "eslint .",
"watch": "babel src -w --ignore **/*.test.js,integration -d build",
"build": "babel src --ignore **/*.test.js,integration -d build",
"prepublish": "yarn build",
"format": "prettier --single-quote --trailing-comma all --write \"!(build)/**/*.js\""
"format": "prettier --single-quote --trailing-comma all --write \"**/*.js\""
},
"dependencies": {
"ansi-escapes": "^3.1.0",
"chalk": "^2.4.1",
"eslint": "^4.5.0",
"prompts": "^0.1.8"
"prompts": "^2.2.1"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-jest": "23.0.1",
"babel-preset-env": "1.7.0",
"eslint-config-airbnb-base": "12.1.0",
"eslint-config-prettier": "2.9.0",
"eslint-plugin-import": "2.12.0",
"eslint-plugin-jest": "21.17.0",
"eslint-plugin-prettier": "2.6.0",
"execa": "0.8.0",
"jest": "23.0.1",
"prettier": "1.13.0"
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-prettier": "^3.1.0",
"prettier": "^1.13.0"
},
"prettier": {
"singleQuote": true,
Expand Down
13 changes: 7 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class JestPluginProjects {

apply(jestHook) {
jestHook.onFileChange(({ projects }) => this._setProjects(projects));
jestHook.shouldRunTestSuite(({ testPath, config }) => {
jestHook.shouldRunTestSuite(({ config }) => {
const name = this._getDisplayName(config) || this._getBasename(config);
return (
this._activeProjects[name] === undefined || this._activeProjects[name]
Expand Down Expand Up @@ -80,12 +80,13 @@ Add a \`displayName\` to at least one of them to prevent name collision.
_setActiveProjects(activeProjects) {
this._numActiveProjects = activeProjects.length;
this._activeProjects = this._projectNames.reduce((memo, name) => {
// eslint-disable-next-line no-param-reassign
memo[name] = activeProjects.includes(name);
return memo;
}, {});
}

run(globalConfig) {
run() {
console.log(ansiEscapes.clearScreen);
return prompts([
{
Expand Down Expand Up @@ -114,12 +115,12 @@ Add a \`displayName\` to at least one of them to prevent name collision.

if (this._numActiveProjects === numProjects) {
return '(all selected)';
} else if (this._numActiveProjects === 0) {
}
if (this._numActiveProjects === 0) {
return '(zero selected)';
} else {
return `(${this._numActiveProjects}/${numProjects} selected)`;
}
return;

return `(${this._numActiveProjects}/${numProjects} selected)`;
}

getUsageInfo() {
Expand Down
Loading

0 comments on commit 851f506

Please sign in to comment.