mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
c089eece50
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
33 lines
822 B
JavaScript
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;
|
|
},
|
|
};
|