Skip to content

Commit efff839

Browse files
committed
[dev] - Use yarn and jest for package management and testing, respectively. Update all devDependencies and integrate.
1 parent a7696a7 commit efff839

21 files changed

+3402
-39
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ reports
33
npm-debug.log
44
coverage
55
lib
6+
.DS_Store

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ reports
33
npm-debug.log
44
coverage
55
.gitignore
6+
.DS_Store

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
language: node_js
22
node_js:
3-
- 0.10
4-
- 0.12
5-
- iojs
63
- 4
74
- 5
85
- 6
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/src/getPropLiteralValue.js renamed to __tests__/src/getPropLiteralValue-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-env mocha */
2+
/* eslint no-template-curly-in-string: 0 */
23
import assert from 'assert';
34
import { extractProp } from '../helper';
45
import { getLiteralPropValue } from '../../src/getPropValue';

tests/src/getPropValue.js renamed to __tests__/src/getPropValue-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-env mocha */
2+
/* eslint no-template-curly-in-string: 0 */
23
import assert from 'assert';
34
import { extractProp } from '../helper';
45
import getPropValue from '../../src/getPropValue';
File renamed without changes.

tests/src/index.js renamed to __tests__/src/index-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-env mocha */
2-
import assert from 'assert';
3-
import core from '../../src/index';
42
import fs from 'fs';
53
import path from 'path';
4+
import assert from 'assert';
5+
import core from '../../src/index';
66

77
const src = fs.readdirSync(path.resolve(__dirname, '../../src'))
88
.filter(f => f.indexOf('.js') >= 0)
@@ -16,18 +16,18 @@ describe('main export', () => {
1616
assert.equal(expected, actual);
1717
});
1818

19-
src.filter(f => f !== 'index').forEach(f => {
19+
src.filter(f => f !== 'index').forEach((f) => {
2020
it(`should export ${f}`, () => {
2121
assert.equal(
2222
core[f],
23-
require(path.join('../../src/', f)).default // eslint-disable-line global-require
23+
require(path.join('../../src/', f)).default // eslint-disable-line
2424
);
2525
});
2626

2727
it(`should export ${f} from root`, () => {
2828
const file = `${f}.js`;
2929
const expected = true;
30-
const actual = fs.statSync(path.join(__dirname, file)).isFile();
30+
const actual = fs.statSync(path.join(path.resolve('.'), file)).isFile();
3131

3232
assert.equal(expected, actual);
3333
});
File renamed without changes.

package.json

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,28 @@
66
"scripts": {
77
"build": "rimraf lib && babel src --out-dir lib",
88
"prepublish": "npm run lint && npm run test && npm run build",
9-
"coveralls": "cat ./reports/coverage/lcov.info | coveralls",
9+
"coveralls": "cat ./reports/lcov.info | coveralls",
1010
"lint": "eslint --config .eslintrc .",
11+
"lint:fix": "npm run lint -- --fix",
1112
"pretest": "npm run lint",
12-
"test": "istanbul cover -x '**/lib/**' --dir reports/coverage node_modules/mocha/bin/_mocha tests/**/*.js -- --compilers js:babel-core/register --reporter dot"
13+
"test": "jest --coverage"
1314
},
1415
"devDependencies": {
15-
"acorn-jsx": "^3.0.1",
16-
"babel-cli": "^6.6.0",
17-
"babel-core": "^6.6.0",
18-
"babel-eslint": "^6.0.0",
19-
"babel-preset-es2015": "^6.6.0",
16+
"babel-cli": "^6.14.0",
17+
"babel-core": "^6.14.0",
18+
"babel-eslint": "^7.0.0",
19+
"babel-jest": "^16.0.0",
20+
"babel-polyfill": "^6.16.0",
21+
"babel-preset-es2015": "^6.14.0",
2022
"coveralls": "^2.11.8",
21-
"eslint": "^2.11.1",
22-
"eslint-config-airbnb-base": "^3.0.1",
23-
"eslint-plugin-import": "^1.8.1",
24-
"istanbul": "^1.0.0-alpha.2",
25-
"mocha": "^2.4.5",
23+
"eslint": "^3.0.0",
24+
"eslint-config-airbnb-base": "^8.0.0",
25+
"eslint-plugin-import": "^1.16.0",
26+
"jest": "^16.0.1",
2627
"rimraf": "^2.5.2"
2728
},
2829
"engines": {
29-
"node": ">=0.10.0"
30+
"node": ">=4.0"
3031
},
3132
"keywords": [
3233
"jsx",
@@ -41,6 +42,14 @@
4142
},
4243
"license": "MIT",
4344
"dependencies": {
45+
"acorn-jsx": "^3.0.1",
4446
"object-assign": "^4.1.0"
47+
},
48+
"jest": {
49+
"coverageReporters": [
50+
"lcov"
51+
],
52+
"coverageDirectory": "reports",
53+
"testPathIgnorePatterns": ["/node_modules/", "helper.js"]
4554
}
4655
}

src/getProp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const DEFAULT_OPTIONS = {
1010
*
1111
*/
1212
export default function getProp(props = [], prop = '', options = DEFAULT_OPTIONS) {
13-
let nodeProp = undefined;
13+
let nodeProp;
1414
const propToFind = options.ignoreCase ? prop.toUpperCase() : prop;
1515

16-
const hasProp = props.some(attribute => {
16+
const hasProp = props.some((attribute) => {
1717
// If the props contain a spread prop, then skip.
1818
if (attribute.type === 'JSXSpreadAttribute') {
1919
return false;

src/hasProp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const DEFAULT_OPTIONS = {
1212
export default function hasProp(props = [], prop = '', options = DEFAULT_OPTIONS) {
1313
const propToCheck = options.ignoreCase ? prop.toUpperCase() : prop;
1414

15-
return props.some(attribute => {
15+
return props.some((attribute) => {
1616
// If the props contain a spread prop, then refer to strict param.
1717
if (attribute.type === 'JSXSpreadAttribute') {
1818
return !options.spreadStrict;

src/values/expressions/BinaryExpression.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ export default function extractValueFromBinaryExpression(value) {
3232
case '>=':
3333
return leftVal >= rightVal;
3434
case '<<':
35-
return leftVal << rightVal;
35+
return leftVal << rightVal; // eslint-disable-line no-bitwise
3636
case '>>':
37-
return leftVal >> rightVal;
37+
return leftVal >> rightVal; // eslint-disable-line no-bitwise
3838
case '>>>':
39-
return leftVal >>> rightVal;
39+
return leftVal >>> rightVal; // eslint-disable-line no-bitwise
4040
case '+':
4141
return leftVal + rightVal;
4242
case '-':
@@ -48,11 +48,11 @@ export default function extractValueFromBinaryExpression(value) {
4848
case '%':
4949
return leftVal % rightVal;
5050
case '|':
51-
return leftVal | rightVal;
51+
return leftVal | rightVal; // eslint-disable-line no-bitwise
5252
case '^':
53-
return leftVal ^ rightVal;
53+
return leftVal ^ rightVal; // eslint-disable-line no-bitwise
5454
case '&':
55-
return leftVal & rightVal;
55+
return leftVal & rightVal; // eslint-disable-line no-bitwise
5656
case 'in':
5757
try {
5858
return leftVal in rightVal;

src/values/expressions/Identifier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const JS_RESERVED = {
2020
export default function extractValueFromIdentifier(value) {
2121
const { name } = value;
2222

23-
if (JS_RESERVED.hasOwnProperty(name)) {
23+
if (Object.hasOwnProperty.call(JS_RESERVED, name)) {
2424
return JS_RESERVED[name];
2525
}
2626

src/values/expressions/ObjectExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import getValue from './index';
21
import assign from 'object-assign';
2+
import getValue from './index';
33

44
/**
55
* Extractor function for an ObjectExpression type value node.

src/values/expressions/UnaryExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function extractValueFromUnaryExpression(value) {
1919
case '!':
2020
return !getValue(argument);
2121
case '~':
22-
return ~getValue(argument);
22+
return ~getValue(argument); // eslint-disable-line no-bitwise
2323
case 'delete':
2424
// I believe delete statements evaluate to true.
2525
return true;

src/values/expressions/UpdateExpression.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export default function extractValueFromUpdateExpression(value) {
1515

1616
switch (operator) {
1717
case '++':
18-
return prefix ? ++val : val++;
18+
return prefix ? ++val : val++; // eslint-disable-line no-plusplus
1919
case '--':
20-
return prefix ? --val : val--;
20+
return prefix ? --val : val--; // eslint-disable-line no-plusplus
2121
default:
2222
return undefined;
2323
}

src/values/expressions/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ const noop = () => null;
4141

4242
// Composition map of types to their extractor functions to handle literals.
4343
const LITERAL_TYPES = assign({}, TYPES, {
44-
Literal: value => {
44+
Literal: (value) => {
4545
const extractedVal = TYPES.Literal.call(undefined, value);
4646
const isNull = extractedVal === null;
4747
// This will be convention for attributes that have null
4848
// value explicitly defined (<div prop={null} /> maps to 'null').
4949
return isNull ? 'null' : extractedVal;
5050
},
51-
Identifier: value => {
51+
Identifier: (value) => {
5252
const isUndefined = TYPES.Identifier.call(undefined, value) === undefined;
5353
return isUndefined ? undefined : null;
5454
},
@@ -58,11 +58,11 @@ const LITERAL_TYPES = assign({}, TYPES, {
5858
LogicalExpression: noop,
5959
MemberExpression: noop,
6060
CallExpression: noop,
61-
UnaryExpression: value => {
61+
UnaryExpression: (value) => {
6262
const extractedVal = TYPES.UnaryExpression.call(undefined, value);
6363
return extractedVal === undefined ? null : extractedVal;
6464
},
65-
UpdateExpression: value => {
65+
UpdateExpression: (value) => {
6666
const extractedVal = TYPES.UpdateExpression.call(undefined, value);
6767
return extractedVal === undefined ? null : extractedVal;
6868
},

0 commit comments

Comments
 (0)