Skip to content

Commit

Permalink
Migrate initial few packages to TypeScript (facebook#2110)
Browse files Browse the repository at this point in the history
* Add initial test migration

* Fix failing integrity check

* Remove ts-nochecks

* Update test config

* Add babel typescript preset instead of rollup plugin

* Remove relative paths for unit tests

* Small requested changes
  • Loading branch information
thegreatercurve authored May 9, 2022
1 parent 13f13a8 commit 05bd611
Show file tree
Hide file tree
Showing 31 changed files with 5,841 additions and 6,702 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ module.exports = {
sourceType: 'module',
},
plugins: ['react', '@typescript-eslint'],
rules: {
'@typescript-eslint/ban-ts-comment': OFF,
'@typescript-eslint/no-unused-vars': [ERROR, {args: 'none'}],
},
},
],

Expand Down
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exact_by_default=true

module.name_mapper='^lexical$' -> '<PROJECT_ROOT>/packages/lexical/flow/Lexical.js.flow'

module.name_mapper='^@lexical/clipboard' -> '<PROJECT_ROOT>/packages/lexical-clipboard/flow/LexicalClipboard.js.flow'
module.name_mapper='^@lexical/list' -> '<PROJECT_ROOT>/packages/lexical-list/flow/LexicalList.js.flow'
module.name_mapper='^@lexical/table' -> '<PROJECT_ROOT>/packages/lexical-table/flow/LexicalTable.js.flow'
module.name_mapper='^@lexical/file' -> '<PROJECT_ROOT>/packages/lexical-file/flow/LexicalFile.js.flow'
Expand Down
18 changes: 14 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@ module.exports = {
...common,
displayName: 'unit',
globals: {
IS_REACT_ACT_ENVIRONMENT: true,
__DEV__: true,
'ts-jest': {
tsconfig: 'tsconfig.test.json',
},
},
moduleNameMapper: {
'^./dist/(.+)': './src/$1',
'^@lexical/clipboard$':
'<rootDir>/packages/lexical-clipboard/src/index.js',
'^@lexical/code$': '<rootDir>/packages/lexical-code/src/index.js',
'^@lexical/dragon$': '<rootDir>/packages/lexical-dragon/src/index.js',
'^@lexical/code$': '<rootDir>/packages/lexical-code/src/index.ts',
'^@lexical/dragon$': '<rootDir>/packages/lexical-dragon/src/index.ts',
'^@lexical/file$': '<rootDir>/packages/lexical-file/src/index.js',
'^@lexical/hashtag$': '<rootDir>/packages/lexical-hashtag/src/index.js',
'^@lexical/history$': '<rootDir>/packages/lexical-history/src/index.js',
'^@lexical/history$': '<rootDir>/packages/lexical-history/src/index.ts',
'^@lexical/link$': '<rootDir>/packages/lexical-link/src/index.js',
'^@lexical/list$': '<rootDir>/packages/lexical-list/src/index.js',
'^@lexical/mark$': '<rootDir>/packages/lexical-mark/src/index.js',
Expand Down Expand Up @@ -85,7 +89,13 @@ module.exports = {
formatProdErrorMessage:
'<rootDir>/scripts/error-codes/formatProdErrorMessage.js',
},
testMatch: ['**/__tests__/unit/**/*.test.js'],
preset: 'ts-jest',
testEnvironment: 'jsdom',
testMatch: ['**/__tests__/unit/**/*.test{.ts,.js}'],
transform: {
'^.+\\.jsx?$': 'babel-jest',
'^.+\\.tsx$': 'ts-jest',
},
},
{
...common,
Expand Down
Loading

0 comments on commit 05bd611

Please sign in to comment.