Skip to content

Commit 2caad24

Browse files
committed
license: add FB License header to all extractErrors code
- this plugin is largely borrowed from the React monorepo, consistently add FB's License headers to each file, not just to extractErrors.ts - also add comments pointing to the exact file and commit that each file was copied from - most of these are slightly out of date now: - evalToString is missing a line - extractErrors needs to be updated to Babel 7 - babylon -> @babel/parser, babel-traverse -> @babel/traverse - transformErrorMessages has several new constructs added :/... - keeping a pseudo-fork up-to-date is pretty tedious and not very maintainble (it's also broken per the tests I've added) - would be better if we could ask FB to split out theirs as a separate package...
1 parent 7edf7ea commit 2caad24

4 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/errors/evalToString.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
// largely borrowed from https://github.com/facebook/react/blob/8b2d3783e58d1acea53428a10d2035a8399060fe/scripts/shared/evalToString.js
2+
/**
3+
* Copyright (c) Facebook, Inc. and its affiliates.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
19
export function evalToString(ast: any): string {
210
switch (ast.type) {
311
case 'StringLiteral':

src/errors/extractErrors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// largely borrowed from https://github.com/facebook/react/blob/8b2d3783e58d1acea53428a10d2035a8399060fe/scripts/error-codes/extract-errors.js
12
/**
23
* Copyright (c) Facebook, Inc. and its affiliates.
34
*

src/errors/invertObject.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
// largely borrowed from https://github.com/facebook/react/blob/8b2d3783e58d1acea53428a10d2035a8399060fe/scripts/error-codes/invertObject.js
2+
3+
/**
4+
* Copyright (c) Facebook, Inc. and its affiliates.
5+
*
6+
* This source code is licensed under the MIT license found in the
7+
* LICENSE file in the root directory of this source tree.
8+
*/
9+
110
/**
211
* turns
312
* { 'MUCH ERROR': '0', 'SUCH WRONG': '1' }

src/errors/transformErrorMessages.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
// largely borrowed from https://github.com/facebook/react/blob/2c8832075b05009bd261df02171bf9888ac76350/scripts/error-codes/transform-error-messages.js
2+
/**
3+
* Copyright (c) Facebook, Inc. and its affiliates.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
19
import fs from 'fs';
210
import { invertObject } from './invertObject';
311
import { evalToString } from './evalToString';

0 commit comments

Comments
 (0)