Skip to content

Commit 2158f9d

Browse files
committed
chore: split lint/format processes as recommended by both software
1 parent b2f2d24 commit 2158f9d

17 files changed

+80
-85
lines changed

.github/workflows/ci.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@ name: CI
22
on: [push, pull_request]
33

44
jobs:
5-
build:
6-
name: Build
7-
runs-on: ubuntu-latest
8-
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v3
11-
- name: Setup Node.js
12-
uses: actions/setup-node@v3
13-
with:
14-
node-version: latest
15-
- name: Install dependencies
16-
run: npm clean-install
17-
env:
18-
HUSKY: 0
19-
- name: Audit dependencies
20-
run: npm audit && npm audit signatures
21-
- name: Audit code coverage
22-
run: npm run coverage
23-
- name: Upload coverage reports to Codecov
24-
uses: codecov/[email protected]
25-
with:
26-
token: ${{ secrets.CODECOV_TOKEN }}
27-
slug: brianrodri/objo
5+
build:
6+
name: Build
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v3
11+
- name: Setup Node.js
12+
uses: actions/setup-node@v3
13+
with:
14+
node-version: latest
15+
- name: Install dependencies
16+
run: npm clean-install
17+
env:
18+
HUSKY: 0
19+
- name: Audit dependencies
20+
run: npm audit && npm audit signatures
21+
- name: Audit code coverage
22+
run: npm run coverage
23+
- name: Upload coverage reports to Codecov
24+
uses: codecov/[email protected]
25+
with:
26+
token: ${{ secrets.CODECOV_TOKEN }}
27+
slug: brianrodri/objo

.github/workflows/release.yml

+30-30
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ name: Release
22
on: workflow_dispatch
33

44
permissions:
5-
contents: read # for checkout
5+
contents: read # for checkout
66

77
jobs:
8-
release:
9-
name: Release
10-
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write # to be able to publish a GitHub release
13-
issues: write # to be able to comment on released issues
14-
pull-requests: write # to be able to comment on released pull requests
15-
id-token: write # to enable use of OIDC for npm provenance
16-
steps:
17-
- name: Checkout
18-
uses: actions/checkout@v3
19-
- name: Setup Node.js
20-
uses: actions/setup-node@v3
21-
with:
22-
node-version: latest
23-
- name: Install dependencies
24-
run: npm clean-install
25-
env:
26-
HUSKY: 0
27-
- name: Audit dependencies
28-
run: npm audit && npm audit signatures
29-
- name: Audit code coverage
30-
run: npm run coverage
31-
- name: Build plugin
32-
run: npm run build
33-
- name: Release update
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
run: npx semantic-release
8+
release:
9+
name: Release
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write # to be able to publish a GitHub release
13+
issues: write # to be able to comment on released issues
14+
pull-requests: write # to be able to comment on released pull requests
15+
id-token: write # to enable use of OIDC for npm provenance
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: latest
23+
- name: Install dependencies
24+
run: npm clean-install
25+
env:
26+
HUSKY: 0
27+
- name: Audit dependencies
28+
run: npm audit && npm audit signatures
29+
- name: Audit code coverage
30+
run: npm run coverage
31+
- name: Build plugin
32+
run: npm run build
33+
- name: Release update
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: npx semantic-release

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
npm run format
12
npm run lint

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage/
2+
docs/
3+
dist/
4+
node_modules/
5+
test-vault/

eslint.config.js

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { FlatCompat } from "@eslint/eslintrc";
2-
import eslintJs from "@eslint/js";
3-
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
4-
import typescriptPluginParser from "@typescript-eslint/parser";
5-
import prettierConfig from "eslint-config-prettier";
62
import boundaries from "eslint-plugin-boundaries";
7-
import prettierPlugin from "eslint-plugin-prettier";
8-
import reactHooksPlugin from "eslint-plugin-react-hooks";
9-
import globals from "globals";
103
import { dirname } from "path";
4+
import eslintConfigPrettier from "eslint-config-prettier";
5+
import eslintJs from "@eslint/js";
116
import { fileURLToPath } from "url";
7+
import globals from "globals";
8+
import reactHooksPlugin from "eslint-plugin-react-hooks";
9+
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
10+
import typescriptPluginParser from "@typescript-eslint/parser";
1211

1312
const __filename = fileURLToPath(import.meta.url);
1413
const __dirname = dirname(__filename);
@@ -27,6 +26,7 @@ export default [
2726

2827
{
2928
files: ["*.config.js"],
29+
rules: { "sort-imports": ["error"] },
3030
languageOptions: { globals: { ...globals.node } },
3131
},
3232

@@ -40,6 +40,7 @@ export default [
4040
...typescriptPlugin.configs.recommended.rules,
4141
...typescriptPlugin.configs.strict.rules,
4242
...reactHooksPlugin.configs.recommended.rules,
43+
"sort-imports": ["error"],
4344
},
4445
languageOptions: {
4546
globals: { ...globals.browser },
@@ -48,13 +49,7 @@ export default [
4849
},
4950
},
5051

51-
{
52-
plugins: { prettier: prettierPlugin },
53-
rules: {
54-
...prettierConfig.rules,
55-
"prettier/prettier": "error",
56-
},
57-
},
52+
eslintConfigPrettier,
5853

5954
{
6055
files: ["src/**/*"],

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"commitlint": "commitlint --edit",
1212
"docs": "typedoc src/main.tsx --plugin typedoc-plugin-coverage --out docs/ --excludeExternals --excludePrivate --excludeProtected",
1313
"hotreload": "git submodule init && git submodule update && vite build --mode development --outDir ./test-vault/.obsidian/plugins/objo/ --watch",
14+
"format": "prettier --write .",
1415
"lint": "eslint .",
1516
"prepare": "husky",
1617
"test": "vitest run",
@@ -52,6 +53,7 @@
5253
"husky": "latest",
5354
"jsdom": "latest",
5455
"obsidian": "latest",
56+
"prettier": "latest",
5557
"semantic-release": "latest",
5658
"semantic-release-obsidian-plugin": "latest",
5759
"tslib": "latest",

prettier.config.js

-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,4 @@ export default {
66
semi: true,
77
useTabs: false,
88
experimentalTernaries: true,
9-
importOrder: ["^[./]"],
10-
importOrderSeparation: true,
11-
importOrderSortSpecifiers: true,
129
};

src/data/task.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { DateTime } from "luxon";
2-
31
import { DataSource } from "@/data/data-source";
2+
import { DateTime } from "luxon";
43

54
export interface Task {
65
status: TaskStatus;

src/lib/obsidian-dataview/adapter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Task } from "@/data/task";
21
import { DataviewApi, getAPI, isPluginEnabled } from "@/lib/obsidian-dataview/types";
32
import { Plugin } from "@/lib/obsidian/types";
3+
import { Task } from "@/data/task";
44
import { mergeTasks } from "@/utils/merge-tasks";
55
import { parseEmojis } from "@/utils/parse-emojis";
66

src/lib/obsidian-dataview/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import type { SMarkdownPage, STask } from "obsidian-dataview/lib/data-model/serialized/markdown";
12
export { DataviewApi, getAPI, isPluginEnabled } from "obsidian-dataview";
23
import { DateTime } from "luxon";
3-
import type { SMarkdownPage, STask } from "obsidian-dataview/lib/data-model/serialized/markdown";
44

55
export type Page = SMarkdownPage;
66

src/main.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Plugin } from "@/lib/obsidian/types";
21
import { Dataview } from "@/lib/obsidian-dataview/adapter";
2+
import { Plugin } from "@/lib/obsidian/types";
33

44
export class Objo extends Plugin {
55
override onload() {

src/utils/__tests__/merge-tasks.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { DateTime } from "luxon";
21
import { describe, expect, it } from "vitest";
3-
2+
import { DateTime } from "luxon";
43
import { mergeTasks } from "../merge-tasks";
54

65
describe("Merging tasks", () => {

src/utils/__tests__/parse-emojis.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { DateTime } from "luxon";
21
import { describe, expect, it } from "vitest";
3-
2+
import { DateTime } from "luxon";
43
import { parseEmojis } from "../parse-emojis";
54

65
describe("Parsing emojis", () => {

src/utils/merge-tasks.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/* v8 ignore next 2 */
22
// TODO: Why does v8 consider this line to be untested?
3-
import { isNumber, isSet, isString, mergeWith, MergeWithCustomizer } from "lodash";
3+
import { MergeWithCustomizer, isNumber, isSet, isString, mergeWith } from "lodash";
44
import { DateTime } from "luxon";
55
import { DeepPartial } from "utility-types";
6-
76
import { Task } from "@/data/task";
87

98
const DEFAULT_TYPE_VALUE = "UNKNOWN" as const;

src/utils/parse-emojis.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Dictionary, set } from "lodash";
21
import { DateTime, Interval } from "luxon";
2+
import { Dictionary, set } from "lodash";
33
import { DeepPartial } from "utility-types";
4-
54
import { Task } from "@/data/task";
65

76
export function parseEmojis(text: string): DeepPartial<Task> {

vite.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { defineConfig } from "vite";
12
import preact from "@preact/preset-vite";
23
import { resolve } from "path";
3-
import { defineConfig } from "vite";
44
import { viteStaticCopy } from "vite-plugin-static-copy";
55

66
export default defineConfig(({ mode }) => ({

0 commit comments

Comments
 (0)