Skip to content

Commit 5046270

Browse files
authored
fix(api): add top-level main, module and types fields (#8267)
1 parent b8756bc commit 5046270

17 files changed

Lines changed: 451 additions & 699 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tauri-apps/api': 'patch:bug'
3+
---
4+
5+
Add top-level `main`, `module` and `types` fields in `package.json` to be compliant with typescripts's `"moduleResolution": "node"`

.github/workflows/lint-js.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
- name: install deps via yarn
5050
working-directory: ./tooling/api/
5151
run: yarn
52+
- name: run ts:check
53+
working-directory: ./tooling/api/
54+
run: yarn ts:check
5255
- name: run lint
5356
working-directory: ./tooling/api/
5457
run: yarn lint

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if [ -z "$(git diff --name-only tooling/api)" ]; then
1111
else
1212
cd tooling/api
1313
yarn format
14-
yarn lint-fix
14+
yarn lint:fix
1515
cd ../..
1616
fi
1717

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"semi": false,
4+
"trailingComma": "none"
5+
}

.prettierrc.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

core/tauri/scripts/bundle.global.js

Lines changed: 1 addition & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
"url": "https://github.com/tauri-apps/tauri.git"
1212
},
1313
"scripts": {
14-
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .prettierignore",
15-
"postinstall": "husky install"
14+
"format": "prettier --write . --config .prettierrc --ignore-path .prettierignore",
15+
"format:check": "prettier --check . --config .prettierrc --ignore-path .prettierignore",
16+
"postinstall": "husky install"
1617
},
1718
"devDependencies": {
1819
"covector": "^0.7.3",

tooling/api/.eslintrc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"root": true,
3+
4+
"env": {
5+
"node": true,
6+
"jest": true
7+
},
8+
9+
"parser": "@typescript-eslint/parser",
10+
11+
"extends": [
12+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
13+
// TODO: make this work with typescript
14+
// "plugin:node/recommended"
15+
"prettier"
16+
],
17+
18+
"plugins": ["@typescript-eslint", "node", "security"],
19+
20+
"parserOptions": {
21+
"project": "./tsconfig.json"
22+
},
23+
24+
"globals": {
25+
"__statics": true,
26+
"process": true
27+
},
28+
29+
// add your custom rules here
30+
"rules": {
31+
"no-debugger": "error",
32+
"no-process-exit": "off",
33+
"security/detect-non-literal-fs-filename": "warn",
34+
"security/detect-unsafe-regex": "error",
35+
"security/detect-buffer-noassert": "error",
36+
"security/detect-child-process": "warn",
37+
"security/detect-disable-mustache-escape": "error",
38+
"security/detect-eval-with-expression": "error",
39+
"security/detect-no-csrf-before-method-override": "error",
40+
"security/detect-non-literal-regexp": "error",
41+
"security/detect-non-literal-require": "warn",
42+
"security/detect-object-injection": "warn",
43+
"security/detect-possible-timing-attacks": "error",
44+
"security/detect-pseudoRandomBytes": "error",
45+
"space-before-function-paren": "off",
46+
"@typescript-eslint/default-param-last": "off",
47+
"@typescript-eslint/strict-boolean-expressions": 0,
48+
"no-return-await": "warn",
49+
"@typescript-eslint/return-await": "off"
50+
}
51+
}

tooling/api/.eslintrc.cjs

Lines changed: 0 additions & 56 deletions
This file was deleted.

tooling/api/.prettierrc.cjs

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)