Skip to content

Commit

Permalink
TypeScript: Add initial infrastructure (#10783)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Aug 15, 2022
1 parent 1951e3a commit d1a9eaa
Show file tree
Hide file tree
Showing 39 changed files with 6,437 additions and 4,868 deletions.
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,7 @@ README.md
rollup.config.js
scoper.inc.php
SECURITY.md
tsconfig.json
tsconfig.shared.json
webpack.config.cjs
webpack.config.test.cjs
32 changes: 31 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@
"^@googleforcreators\\/(.*)\\/(.*)": "./packages/$1/src/$2",
"^@googleforcreators\\/(.*)": "./packages/$1/src/",
"^@web-stories-wp\\/(.*)": "./packages/$1/src/"
}
},
"extensions": [ ".js", ".jsx", ".ts", ".tsx" ]
}
},
"jsdoc": {
Expand Down Expand Up @@ -284,6 +285,32 @@
]
},
"overrides": [
{
"files": [
"**/*.ts",
"**/*.tsx"
],
"excludedFiles": [
"**/*.d.ts"
],
"plugins": [
"@typescript-eslint"
],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended"
],
"parser": "@typescript-eslint/parser",
"rules": {
"no-duplicate-imports": "off",
"@typescript-eslint/no-duplicate-imports": "error",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
"no-unused-vars": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error"
}
},
{
"files": [
"__mocks__/**/*.js",
Expand Down Expand Up @@ -315,6 +342,7 @@
"eslint-comments/require-description": "off",
"react/prop-types": "off",
"jest/no-hooks": "off",
"jest/max-expects": "off",
"jest/prefer-expect-assertions": "off",
"jest/prefer-inline-snapshots": "off",
"jest/prefer-lowercase-title": [
Expand Down Expand Up @@ -415,6 +443,7 @@
},
"rules": {
"eslint-comments/require-description": "off",
"jest/max-expects": "off",
"jest/no-hooks": "off",
"jest/prefer-expect-assertions": "off",
"jest/prefer-inline-snapshots": "off",
Expand Down Expand Up @@ -452,6 +481,7 @@
"rules": {
"eslint-comments/require-description": "off",
"jest/expect-expect": "off",
"jest/max-expects": "off",
"jest/no-export": "off",
"jest/require-top-level-describe": "off"
}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- '**.js'
- '**.cjs'
- '**.ts'
branches:
- main
- release/*
Expand All @@ -14,6 +15,7 @@ on:
paths:
- '**.js'
- '**.cjs'
- '**.ts'
# The branches below must be a subset of the branches above
branches:
- main
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint-css-js-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- '**.js'
- '**.cjs'
- '**.ts'
- '**.css'
- 'docs/**/*.md'
- 'packages/**/*.md'
Expand All @@ -25,6 +26,7 @@ on:
paths:
- '**.js'
- '**.cjs'
- '**.ts'
- '**.css'
- 'docs/**/*.md'
- 'packages/**/*.md'
Expand Down Expand Up @@ -109,6 +111,9 @@ jobs:
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
- name: Type checking
run: npm run workflow:bundle-packages:types

# Bundle npm packages to see whether that still works as expected.

- name: Bundle npm packages
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint-i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
paths:
- '**.js'
- '**.cjs'
- '**.ts'
- '**/package.json'
- 'package-lock.json'
- 'web-stories.php'
Expand All @@ -14,6 +16,8 @@ on:
pull_request:
paths:
- '**.js'
- '**.cjs'
- '**.ts'
- '**/package.json'
- 'package-lock.json'
- 'web-stories.php'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests-karma-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'webpack.config.cjs'
- 'webpack.config.test.cjs'
- 'packages/**/*.js'
- 'packages/**/*.ts'
- '**/package.json'
- 'package-lock.json'
- '__static__/**'
Expand All @@ -23,6 +24,7 @@ on:
- 'webpack.config.cjs'
- 'webpack.config.test.cjs'
- 'packages/**/*.js'
- 'packages/**/*.ts'
- '**/package.json'
- 'package-lock.json'
- '__static__/**'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests-karma-editor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'webpack.config.test.cjs'
- 'packages/**/*.js'
- 'packages/**/*.cjs'
- 'packages/**/*.ts'
- '**/package.json'
- 'package-lock.json'
- '__static__/**'
Expand All @@ -26,6 +27,7 @@ on:
- 'webpack.config.test.cjs'
- 'packages/**/*.js'
- 'packages/**/*.cjs'
- 'packages/**/*.ts'
- '**/package.json'
- 'package-lock.json'
- '__static__/**'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tests-unit-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
# Only run if JS-related files changed.
paths:
- '**.js'
- '**.cjs'
- '**.ts'
- '**/package.json'
- 'package-lock.json'
- 'packages/templates/src/raw/**'
Expand All @@ -18,6 +20,8 @@ on:
# Only run if JS-related files changed.
paths:
- '**.js'
- '**.cjs'
- '**.ts'
- '**/package.json'
- 'package-lock.json'
- 'packages/templates/src/raw/**'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_modules
/packages/migration/scripts/module.js
/packages/*/dist
/packages/*/dist-module
/packages/*/dist-types
/build
/bin/build
/bin/local-env/data
Expand All @@ -22,3 +23,4 @@ phpcs.xml
phpunit.xml
.phpunit.result.cache
/packages/*/package-lock.json
tsconfig.tsbuildinfo
1 change: 1 addition & 0 deletions .npmpackagejsonlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"exports",
"main",
"module",
"types",
"source",
"publishConfig",
"sideEffects",
Expand Down
1 change: 1 addition & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = function (api) {
development: !isProduction,
},
],
'@babel/preset-typescript',
],
plugins: [
'@wordpress/babel-plugin-import-jsx-pragma',
Expand Down
Loading

0 comments on commit d1a9eaa

Please sign in to comment.