Skip to content

Commit

Permalink
fix: add type checking to extensions (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-yarmosh authored and MartinKolarik committed Aug 9, 2024
1 parent 8997d5b commit 9991852
Show file tree
Hide file tree
Showing 90 changed files with 2,795 additions and 5,714 deletions.
20 changes: 20 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"plugin:vue/vue3-recommended",
"@martin-kolarik/eslint-config/typescript"
],
"plugins": [
"import"
],
"ignorePatterns": [
"**/dist",
"/extensions",
Expand Down Expand Up @@ -49,6 +52,23 @@
"vue/singleline-html-element-content-newline": "off"
},
"overrides": [
{
"files": [
"src/**/*.ts"
],
"excludedFiles": [
"src/extensions/lib/*"
],
"parserOptions": {
"project": true
},
"rules": {
"@typescript-eslint/consistent-type-imports": "error",
"import/order": ["error", {
"groups": ["builtin", "external", "parent", "sibling", "type"]
}]
}
},
{
"files": [
"src/**/src/**/*.ts"
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ Add tests to extension:
```bash
# From the extension folder call:
original_dir=$PWD
pnpm add --save-dev chai @types/chai mocha @types/mocha sinon @types/sinon ts-node
jq 'del(.compilerOptions.rootDir) | .compilerOptions.module = "ESNext" | .include = ["./src/**/*.ts", "../../lib/*.ts"]' tsconfig.json > temp.json && mv temp.json tsconfig.json
jq --tab '.scripts.test = "TS_NODE_TRANSPILE_ONLY=true mocha"' package.json > temp.json && mv temp.json package.json
pnpm add --save-dev chai @types/chai mocha @types/mocha sinon @types/sinon ts-node @directus/extensions @directus/types
jq --tab 'del(.compilerOptions.rootDir) | .compilerOptions.module = "ESNext" | .compilerOptions.resolveJsonModule = true | .include = ["./src/**/*.ts", "../../lib/*.ts", "./test/**/*.ts"]' tsconfig.json > temp.json && mv temp.json tsconfig.json
jq --tab '.scripts.test = "tsc --noEmit && NODE_ENV=test mocha"' package.json > temp.json && mv temp.json package.json
jq --tab '.scripts."test:dev" = "NODE_ENV=test TS_NODE_TRANSPILE_ONLY=true mocha"' package.json > temp.json && mv temp.json package.json
mkdir test
while [[ $PWD != */extensions ]]; do cd ..; done
cp ./operations/gh-webhook-handler/.mocharc.json "$original_dir/"
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@
"private": true,
"type": "module",
"dependencies": {
"bluebird": "^3.7.2",
"config": "^3.3.11",
"config": "^3.3.12",
"config-mapper-env": "^2.0.0",
"knex": "^3.1.0",
"lodash": "^4.17.21",
"mysql": "^2.18.1"
},
"devDependencies": {
"@martin-kolarik/eslint-config": "^7.3.0",
"@martin-kolarik/eslint-config": "^7.3.2",
"@types/bluebird": "^3.5.42",
"@types/config": "^3.3.4",
"@types/eslint": "^8.56.10",
"@types/lodash": "^4.17.0",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@types/eslint": "^8.56.11",
"@types/lodash": "^4.17.7",
"@types/mocha": "^10.0.7",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"cross-env": "^7.0.3",
"dotenv-cli": "^7.4.1",
"dotenv-cli": "^7.4.2",
"eslint": "^8.57.0",
"eslint-plugin-chai-expect": "^3.0.0",
"eslint-plugin-jsonc": "^2.15.1",
"eslint-plugin-chai-expect": "^3.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsonc": "^2.16.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.25.0",
"eslint-plugin-promise": "^6.6.0",
"eslint-plugin-vue": "^9.27.0",
"husky": "^8.0.3",
"typescript": "~5.2.2"
},
Expand Down
Loading

0 comments on commit 9991852

Please sign in to comment.