Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add biomejs #1

Merged
merged 9 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

23 changes: 0 additions & 23 deletions .eslintrc

This file was deleted.

8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# yarn biome format --write
4bef05bf8735e1d915950fe22662fbafbe2f0b49

# yarn biome lint --write
94ab7ee3d8d3c09e71e2ad6b817c5be2bdfb82fc

# yarn biome check --write
0985e650948d8b73667f929dca82bcfb73d6850c
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
cache: 'yarn'
- name: 📦 Install dependencies
run: yarn install
- name: ☢️ Biome
run: yarn biome ci
- name: 🧪 Test
run: yarn test
- name: 🔨 Build
Expand Down
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,6 @@ Run `yarn version`, enter a new version number, then push to build and prepare a
> [!NOTE]
> You may need to run `yarn config set version-tag-prefix ""` before running `yarn version` to ensure the version tag is created correctly.

## Improve code quality with eslint (optional)
- [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code.
- To use eslint with this project, make sure to install eslint from terminal:
- `npm install -g eslint`
- To use eslint to analyze this project use this command:
- `eslint main.ts`
- eslint will then create a report with suggestions for code improvement by file and line number.
- If your source code is in a folder, such as `src`, you can use eslint with this command to analyze all files in that folder:
- `eslint .\src\`

## Resources

- [Strava Developers - Authentication](https://developers.strava.com/docs/authentication/)
Expand Down
20 changes: 4 additions & 16 deletions assets/activities.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@
"visibility": "followers_only",
"flagged": false,
"gear_id": "g10510480",
"start_latlng": [
51.50735188790750,
0.127758879597427
],
"end_latlng": [
51.50735188790750,
0.127758879597427
],
"start_latlng": [51.5073518879075, 0.127758879597427],
"end_latlng": [51.5073518879075, 0.127758879597427],
"average_speed": 2.557,
"max_speed": 4.864,
"average_cadence": 79.4,
Expand Down Expand Up @@ -104,14 +98,8 @@
"visibility": "followers_only",
"flagged": false,
"gear_id": "b10137313",
"start_latlng": [
51.50735188790750,
0.127758879597427
],
"end_latlng": [
51.50735188790750,
0.127758879597427
],
"start_latlng": [51.5073518879075, 0.127758879597427],
"end_latlng": [51.5073518879075, 0.127758879597427],
"average_speed": 5.924,
"max_speed": 15.392,
"average_temp": 14,
Expand Down
22 changes: 5 additions & 17 deletions assets/activity_12271989718.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@
"visibility": "followers_only",
"flagged": false,
"gear_id": "g10510480",
"start_latlng": [
51.50735188790750,
0.127758879597427
],
"end_latlng": [
51.50735188790750,
0.127758879597427
],
"start_latlng": [51.5073518879075, 0.127758879597427],
"end_latlng": [51.5073518879075, 0.127758879597427],
"average_speed": 2.557,
"max_speed": 4.864,
"average_cadence": 79.4,
Expand Down Expand Up @@ -123,11 +117,8 @@
"frequency_milestone": null,
"trend": {
"speeds": [
2.8536484680572296,
2.9200434807924016,
2.9579552941928133,
3.0484388453469338,
2.9144403821355738
2.8536484680572296, 2.9200434807924016, 2.9579552941928133,
3.0484388453469338, 2.9144403821355738
],
"current_activity_index": 4,
"min_speed": 2.5569212495610953,
Expand All @@ -137,8 +128,5 @@
},
"resource_state": 2
},
"available_zones": [
"heartrate",
"pace"
]
"available_zones": ["heartrate", "pace"]
}
15 changes: 3 additions & 12 deletions assets/activity_12288940553.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@
"visibility": "followers_only",
"flagged": false,
"gear_id": "b10137313",
"start_latlng": [
51.50735188790750,
0.127758879597427
],
"end_latlng": [
51.50735188790750,
0.127758879597427
],
"start_latlng": [51.5073518879075, 0.127758879597427],
"end_latlng": [51.5073518879075, 0.127758879597427],
"average_speed": 5.924,
"max_speed": 15.392,
"average_temp": 14,
Expand Down Expand Up @@ -114,8 +108,5 @@
"device_name": "Garmin Edge 830",
"embed_token": "42db41db128afd81c5e39bd122a4acc4ca74935f",
"private_note": "Hand numbness 4/10.",
"available_zones": [
"heartrate",
"power"
]
"available_zones": ["heartrate", "power"]
}
4 changes: 1 addition & 3 deletions assets/activity_12315055573.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,5 @@
"hide_from_home": false,
"device_name": "Garmin Forerunner 255",
"embed_token": "78a470bc8b71efcf8734ae8cf1013c0d015d45d4",
"available_zones": [
"heartrate"
]
"available_zones": ["heartrate"]
}
44 changes: 44 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": []
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"ignore": ["main.js", "package.json"]
},
"organizeImports": {
"ignore": ["main.js"],
"enabled": true
},
"linter": {
"ignore": ["main.js"],
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "warn",
"noControlCharactersInRegex": "warn"
},
"style": {
"noNonNullAssertion": "warn"
},
"complexity": {
"useLiteralKeys": "off",
"noForEach": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
}
}
70 changes: 35 additions & 35 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
import esbuild from "esbuild";
import process from "process";
import process from "node:process";
import builtins from "builtin-modules";
import esbuild from "esbuild";

const banner =
`/*
const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;

const prod = (process.argv[2] === "production");
const prod = process.argv[2] === "production";

const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["src/StravaSync.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
minify: prod,
banner: {
js: banner,
},
entryPoints: ["src/StravaSync.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins,
],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
minify: prod,
});

if (prod) {
await context.rebuild();
process.exit(0);
await context.rebuild();
process.exit(0);
} else {
await context.watch();
await context.watch();
}
16 changes: 7 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
moduleFileExtensions: ['ts', 'js'],
testMatch: ['**/__tests__/**/*.test.ts'],
preset: "ts-jest",
testEnvironment: "node",
moduleFileExtensions: ["ts", "js"],
testMatch: ["**/__tests__/**/*.test.ts"],
transform: {
'^.+\\.ts$': 'ts-jest',
"^.+\\.ts$": "ts-jest",
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
transformIgnorePatterns: [
'node_modules/(?!(csv-parse)/)'
],
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
transformIgnorePatterns: ["node_modules/(?!(csv-parse)/)"],
};
4 changes: 2 additions & 2 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jest.mock('csv-parse/browser/esm/sync', () => {
jest.mock("csv-parse/browser/esm/sync", () => {
return {
parse: require('csv-parse/sync').parse
parse: require("csv-parse/sync").parse,
};
});
16 changes: 8 additions & 8 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "strava-sync",
"name": "Strava Sync",
"version": "0.2.0",
"minAppVersion": "0.15.0",
"description": "Sync activities from Strava.",
"author": "Obsidian",
"authorUrl": "https://github.com/watsonbox",
"isDesktopOnly": false
"id": "strava-sync",
"name": "Strava Sync",
"version": "0.2.0",
"minAppVersion": "0.15.0",
"description": "Sync activities from Strava.",
"author": "Obsidian",
"authorUrl": "https://github.com/watsonbox",
"isDesktopOnly": false
}
Loading