-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement selective typecheck (#2321)
* Implement selective options for typecheck, apply selective logic to includes * Segregate modularRoot util for tests * Further tidy up of new command testing approach * Add fixture and new test cases for selective typecheck * Add changeset * Cover allowlisted properties, fix path bug in util
- Loading branch information
Showing
16 changed files
with
618 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'modular-scripts': minor | ||
--- | ||
|
||
Add selective options to typecheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"name": "selective-typecheck-example", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "Sam Brown <sam.brown@jpmorgan.com>", | ||
"license": "MIT", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/**" | ||
], | ||
"modular": { | ||
"type": "root" | ||
}, | ||
"scripts": { | ||
"start": "modular start", | ||
"build": "modular build", | ||
"test": "modular test", | ||
"lint": "eslint . --ext .js,.ts,.tsx", | ||
"prettier": "prettier --write ." | ||
}, | ||
"eslintConfig": { | ||
"extends": "modular-app" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"prettier": { | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 80, | ||
"proseWrap": "always" | ||
}, | ||
"dependencies": { | ||
"@testing-library/dom": "^8.20.0", | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^9.5.0", | ||
"@testing-library/user-event": "^7.2.1", | ||
"@types/jest": "^29.4.0", | ||
"@types/node": "^18.14.6", | ||
"@types/react": "^18.0.9", | ||
"@types/react-dom": "^18.0.8", | ||
"eslint-config-modular-app": "^4.0.0", | ||
"modular-scripts": "^4.1.0", | ||
"modular-template-app": "^1.2.0", | ||
"modular-template-source": "^1.1.0", | ||
"prettier": "^2.8.4", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"typescript": "^4.8.3" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
__fixtures__/selective-typecheck-example/packages/common-module/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "selective-typecheck-common-module", | ||
"private": false, | ||
"modular": { | ||
"type": "source" | ||
}, | ||
"main": "./src/index.ts", | ||
"types": "./src/index.ts", | ||
"version": "1.0.0" | ||
} |
12 changes: 12 additions & 0 deletions
12
__fixtures__/selective-typecheck-example/packages/common-module/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable */ | ||
|
||
// The following TS nocheck flag gets removed in test | ||
// @ts-nocheck | ||
|
||
export default function add(a: number, b: number): number { | ||
return a + b + 'c'; | ||
} | ||
|
||
export function otherThing(input) { | ||
return typeof input; | ||
} |
3 changes: 3 additions & 0 deletions
3
__fixtures__/selective-typecheck-example/packages/esbuild-app/.modular.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
useModularEsbuild: true, | ||
}; |
11 changes: 11 additions & 0 deletions
11
__fixtures__/selective-typecheck-example/packages/esbuild-app/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "app", | ||
"private": true, | ||
"modular": { | ||
"type": "app" | ||
}, | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"selective-typecheck-common-module": "*" | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
__fixtures__/selective-typecheck-example/packages/esbuild-app/src/App.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, { useEffect } from 'react'; | ||
import './App.css'; | ||
|
||
function App(): JSX.Element { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
11 changes: 11 additions & 0 deletions
11
__fixtures__/selective-typecheck-example/packages/webpack-app/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "webpack-app", | ||
"private": true, | ||
"modular": { | ||
"type": "app" | ||
}, | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"selective-typecheck-common-module": "*" | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
__fixtures__/selective-typecheck-example/packages/webpack-app/src/App.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from 'react'; | ||
import './App.css'; | ||
|
||
function App(): JSX.Element { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.