Skip to content

Commit 898f43a

Browse files
authored
Merge pull request #161 from alleyinteractive/typescript-lint
Add typescript type checking
2 parents 9b8096f + 8be7a22 commit 898f43a

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

entries/example-entry/index.scss

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*---
2+
Example Entry
3+
---
4+
5+
@purpose
6+
For example purposes only.
7+
*/

entries/example-entry/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
* Entries are automatically built with webpack when included inside the
55
* ../entries directory. Enqueue in an entry index.php file or in src/assets.php
66
*/
7+
8+
import './index.scss';

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
"build": "wp-scripts build --webpack-copy-php --webpack-src-dir=blocks",
1616
"dev": "npm run start",
1717
"create-block": "cd blocks && npx @wordpress/create-block --template ../bin/create-block --no-plugin",
18+
"precheck-types": "check-node-version --package",
19+
"check-types": "tsc",
1820
"lint:fix": "eslint --ext .jsx --ext .js --ext .ts --ext .tsx . --fix",
19-
"lint": "eslint --ext .jsx --ext .js --ext .ts --ext .tsx .",
21+
"lint": "npm run check-types && eslint --ext .jsx --ext .js --ext .ts --ext .tsx .",
2022
"postinstall": "rm -rf node_modules/.cache/babel-loader && rm -rf node_modules/.cache/webpack",
2123
"prebuild": "check-node-version --package",
2224
"predev": "check-node-version --package",

tsconfig.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@
88
"jsx": "react-jsx",
99
"module": "es6",
1010
"moduleResolution": "node",
11-
"resolveJsonModule": true,
1211
"noImplicitAny": true,
1312
"outDir": "build",
1413
"paths": {
1514
"@/*": ["*"]
1615
},
17-
"target": "es5"
16+
"resolveJsonModule": true,
17+
"skipLibCheck": true,
18+
"strict": true,
19+
"target": "es2020"
1820
},
1921
"exclude": [
2022
"vendor",
2123
"node_modules",
2224
"build/**/*"
2325
]
24-
}
26+
}

0 commit comments

Comments
 (0)