Skip to content

Commit 60d83bb

Browse files
committed
fixed types, converted build tools to cjs, still working on sliders
1 parent 004ab1a commit 60d83bb

31 files changed

Lines changed: 1264 additions & 364 deletions

.devcontainer/devcontainer.json

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

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ data.json
55
package-lock.json
66
.nyc_output
77
coverage
8+
jest.config.js
9+
webpack.config.js
810

911
LICENSE
1012
.deepsource.toml

.eslintrc.json

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,36 @@
22
"extends": [
33
"eslint:recommended",
44
"plugin:@typescript-eslint/recommended",
5-
"prettier"
5+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
66
],
77
"env": {
88
"browser": true,
9-
"node": true,
109
"es6": true
1110
},
11+
"parserOptions": {
12+
"sourceType": "module",
13+
"project": "./tsconfig.json",
14+
"extraFileExtensions": [".svelte"]
15+
},
1216
"parser": "@typescript-eslint/parser",
13-
"plugins": ["@typescript-eslint"],
14-
15-
"root": true,
16-
17+
"plugins": ["svelte3", "@typescript-eslint"],
18+
"overrides": [
19+
{
20+
"files": ["*.svelte"],
21+
"processor": "svelte3/svelte3"
22+
}
23+
],
24+
"settings": {
25+
"svelte3/typescript": true
26+
},
27+
"ignorePatterns": ["node_modules/*", "public/*", "build/*"],
1728
"rules": {
1829
"no-unused-vars": "error",
1930
"@typescript-eslint/no-unused-vars": "off",
31+
"@typescript-eslint/restrict-template-expressions": "off",
32+
"@typescript-eslint/prefer-nullish-coalescing": "warn",
2033
"no-use-before-define": "warn",
2134
"eqeqeq": "error",
22-
"no-console": "warn"
35+
"no-console": ["warn", { "allow": ["warn", "error"] }]
2336
}
2437
}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ data.json
66
package-lock.json
77
.nyc_output
88
coverage
9-
.vscode
109
.yarn
1110

1211
# Created by https://www.toptal.com/developers/gitignore/api/node,obsidian,windows,macos,linux,yarn

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.prettierrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"svelteSortOrder": "scripts-markup-styles",
3+
"plugins": ["prettier-plugin-svelte"]
4+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export default {
1+
module.exports = {
22
roots: ["<rootDir>/src"],
33
testMatch: ["**/__tests__/**/*.+(ts)"],
44
preset: "ts-jest/presets/js-with-ts",
5-
testEnvironment: "node",
5+
testEnvironment: "jsdom",
66
transformIgnorePatterns: ["<rootDir>/node_modules/"],
77
};

package.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": "1.2.1",
44
"description": "A plugin for displaying mathematical functions in obsidian.md.",
55
"repository": "https://github.com/leonhma/obsidian-functionplot",
6-
"type": "module",
76
"author": "leonhma",
87
"license": "MIT",
98
"private": true,
@@ -12,9 +11,8 @@
1211
"build": "yarn lint && webpack",
1312
"test": "jest",
1413
"format": "yarn prettier --write .",
15-
"lint": "yarn eslint .",
16-
"storybook": "start-storybook -p 6006",
17-
"build-storybook": "build-storybook"
14+
"lint": "yarn eslint -c .eslintrc.json .",
15+
"postinstall": "husky install"
1816
},
1917
"devDependencies": {
2018
"@babel/core": "^7.20.12",
@@ -25,12 +23,14 @@
2523
"@typescript-eslint/parser": "^5.41.0",
2624
"babel-loader": "^8.3.0",
2725
"css-loader": "^6.7.3",
28-
"eslint": "^8.26.0",
29-
"eslint-config-prettier": "^8.5.0",
30-
"eslint-plugin-storybook": "^0.6.10",
26+
"eslint": "^8.34.0",
27+
"eslint-plugin-svelte3": "^4.0.0",
28+
"husky": "^8.0.3",
3129
"jest": "^29.2.2",
32-
"nested-object-assign": "^1.0.4",
30+
"jest-environment-jsdom": "^29.4.2",
31+
"lint-staged": "^13.1.1",
3332
"prettier": "^2.7.1",
33+
"prettier-plugin-svelte": "^2.9.0",
3434
"sass": "^1.58.0",
3535
"sass-loader": "^13.0.2",
3636
"style-loader": "^3.3.1",
@@ -50,5 +50,9 @@
5050
"function-plot": "^1.23.1",
5151
"html-to-image": "^1.11.3",
5252
"obsidian": "0.16.3"
53+
},
54+
"lint-staged": {
55+
"*.js": "eslint --cache --fix",
56+
"*.{js,css,md,svelte}": "prettier --write"
5357
}
5458
}

src/__tests__/integrity.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { readFileSync } from "fs";
2+
import type { PluginManifest } from "obsidian";
23

34
test("minAppVersion and obsidian version in package.json match", () => {
45
// read files
5-
const package_ = JSON.parse(readFileSync("package.json", "utf8"));
6-
const manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
6+
const package_ = JSON.parse(readFileSync("package.json", "utf8")) as {
7+
dependencies: { obsidian: string };
8+
};
9+
const manifest = JSON.parse(
10+
readFileSync("manifest.json", "utf8")
11+
) as PluginManifest;
712
expect(manifest.minAppVersion).toBe(package_.dependencies.obsidian);
813
});

0 commit comments

Comments
 (0)