Files
react/jest/preprocessor.js
T
Benjamin Woodruff c089eece50 Switch to using comma-dangle: always-multiline
This is a machine-generated codemod, but it's pretty safe since it was
generated by hooking into eslint's own report.

A few files had to be touched up by hand because there were existing
formatting issues with nested arrays/objects:

src/shared/utils/__tests__/OrderedMap-test.js
src/shared/utils/__tests__/Transaction-test.js
src/shared/utils/__tests__/traverseAllChildren-test.js
src/isomorphic/children/__tests__/ReactChildren-test.js
2015-06-02 16:57:26 -07:00

33 lines
822 B
JavaScript

'use strict';
var babel = require('babel');
var coffee = require('coffee-script');
var tsPreprocessor = require('./ts-preprocessor');
var defaultLibraries = [
require.resolve('./jest.d.ts'),
require.resolve('../src/isomorphic/modern/class/React.d.ts'),
];
var ts = tsPreprocessor(defaultLibraries);
module.exports = {
process: function(src, path) {
if (path.match(/\.coffee$/)) {
return coffee.compile(src, {'bare': true});
}
if (path.match(/\.ts$/) && !path.match(/\.d\.ts$/)) {
return ts.compile(src, path);
}
if (!path.match(/\/node_modules\//) && !path.match(/\/third_party\//)) {
return babel.transform(src, {
blacklist: ['spec.functionName', 'validation.react'],
filename: path,
retainLines: true,
}).code;
}
return src;
},
};