Skip to content

Commit 94e5083

Browse files
committed
rework button action code
1 parent 7af4b01 commit 94e5083

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1066
-681
lines changed

.eslintignore

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

.eslintrc.cjs

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

bun.lockb

3.5 KB
Binary file not shown.

eslint.config.mjs

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
5+
import only_warn from 'eslint-plugin-only-warn';
6+
import no_relative_import_paths from 'eslint-plugin-no-relative-import-paths';
7+
import * as plugin_import from 'eslint-plugin-import';
8+
import eslintPluginSvelte from 'eslint-plugin-svelte';
9+
10+
import projectConfig from './automation/config.json' with { type: 'json' };
11+
12+
/** @type {{files: string[], rules: Record<string, [string, {patterns: {group: string[], message: string }[]}]>}[]} */
13+
const overrides = [];
14+
15+
for (const corePackage of projectConfig.corePackages) {
16+
const patterns = [];
17+
18+
for (const nonCorePackage of projectConfig.packages) {
19+
patterns.push({
20+
group: [`packages/${nonCorePackage}/*`],
21+
message: `Core package "${corePackage}" should not import from the non core "${nonCorePackage}" package.`,
22+
});
23+
}
24+
25+
overrides.push({
26+
files: [`packages/${corePackage}/src/**/*.ts`],
27+
rules: {
28+
'no-restricted-imports': [
29+
'error',
30+
{
31+
patterns: patterns,
32+
},
33+
],
34+
},
35+
});
36+
}
37+
38+
for (const nonCorePackage of projectConfig.packages) {
39+
const patterns = [];
40+
41+
for (const otherNonCorePackage of projectConfig.packages) {
42+
if (otherNonCorePackage === nonCorePackage) {
43+
continue;
44+
}
45+
patterns.push({
46+
group: [`packages/${otherNonCorePackage}/*`],
47+
message: `Non core package "${nonCorePackage}" should not import from the non core "${otherNonCorePackage}" package.`,
48+
});
49+
}
50+
51+
overrides.push({
52+
files: [`packages/${nonCorePackage}/src/**/*.ts`],
53+
rules: {
54+
'no-restricted-imports': [
55+
'error',
56+
{
57+
patterns: patterns,
58+
},
59+
],
60+
},
61+
});
62+
}
63+
64+
const flatOverrides = overrides.map(o => ({
65+
files: o.files,
66+
restrictedImports: o.rules['no-restricted-imports'][1].patterns.map(p => p.group).flat(),
67+
}));
68+
69+
console.log('Import restrictions:');
70+
console.log(flatOverrides);
71+
72+
export default tseslint.config(
73+
{
74+
ignores: ['npm/', 'node_modules/', 'exampleVault/', 'automation/', 'main.js', '**/*.svelte', '**/*.d.ts'],
75+
},
76+
...eslintPluginSvelte.configs['flat/recommended'],
77+
...eslintPluginSvelte.configs['flat/prettier'],
78+
{
79+
files: ['packages/**/*.ts'],
80+
extends: [
81+
eslint.configs.recommended,
82+
...tseslint.configs.recommended,
83+
...tseslint.configs.recommendedTypeChecked,
84+
...tseslint.configs.stylisticTypeChecked,
85+
],
86+
languageOptions: {
87+
parser: tseslint.parser,
88+
parserOptions: {
89+
project: true,
90+
},
91+
},
92+
plugins: {
93+
// @ts-ignore
94+
'only-warn': only_warn,
95+
'no-relative-import-paths': no_relative_import_paths,
96+
import: plugin_import,
97+
},
98+
rules: {
99+
'@typescript-eslint/no-explicit-any': ['warn'],
100+
101+
'@typescript-eslint/no-unused-vars': [
102+
'error',
103+
{
104+
argsIgnorePattern: '^_',
105+
destructuredArrayIgnorePattern: '^_',
106+
varsIgnorePattern: '^_',
107+
caughtErrorsIgnorePattern: '^_',
108+
},
109+
],
110+
'@typescript-eslint/consistent-type-imports': [
111+
'error',
112+
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
113+
],
114+
115+
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
116+
'import/order': [
117+
'error',
118+
{
119+
'newlines-between': 'never',
120+
alphabetize: { order: 'asc', orderImportKind: 'asc', caseInsensitive: true },
121+
},
122+
],
123+
124+
'@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true }],
125+
'@typescript-eslint/restrict-template-expressions': 'off',
126+
127+
'no-relative-import-paths/no-relative-import-paths': ['warn', { allowSameFolder: false }],
128+
129+
'@typescript-eslint/ban-ts-comment': 'off',
130+
'@typescript-eslint/no-empty-function': 'off',
131+
'@typescript-eslint/no-inferrable-types': 'off',
132+
'@typescript-eslint/explicit-function-return-type': ['warn'],
133+
'@typescript-eslint/require-await': 'off',
134+
'@typescript-eslint/no-unused-expressions': [
135+
'warn',
136+
{
137+
allowShortCircuit: true,
138+
},
139+
],
140+
},
141+
},
142+
...overrides,
143+
);

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"test:log": "LOG_TESTS=true bun test --conditions=browser",
1414
"format": "prettier --write --plugin prettier-plugin-svelte .",
1515
"format:check": "prettier --check --plugin prettier-plugin-svelte .",
16-
"lint": "eslint --max-warnings=0 packages/**",
17-
"lint:fix": "eslint --max-warnings=0 --fix packages/**",
16+
"lint": "eslint --max-warnings=0 packages/** --no-warn-ignored",
17+
"lint:fix": "eslint --max-warnings=0 --fix packages/** --no-warn-ignored",
1818
"svelte-check": "svelte-check --compiler-warnings \"unused-export-let:ignore\"",
1919
"types": "tsc -p \"./tsconfig.types.json\"",
2020
"check": "bun run format:check && bun run tsc && bun run svelte-check && bun run lint && bun run test",
@@ -32,17 +32,15 @@
3232
"@elysiajs/cors": "^1.1.1",
3333
"@happy-dom/global-registrator": "^14.12.3",
3434
"@tsconfig/svelte": "^5.0.4",
35-
"@types/bun": "^1.1.12",
36-
"@typescript-eslint/eslint-plugin": "^7.18.0",
37-
"@typescript-eslint/parser": "^7.18.0",
35+
"@types/bun": "^1.1.13",
3836
"builtin-modules": "^4.0.0",
39-
"elysia": "^1.1.23",
37+
"elysia": "^1.1.24",
4038
"esbuild": "^0.24.0",
4139
"esbuild-plugin-copy-watch": "^2.3.1",
4240
"esbuild-svelte": "^0.8.2",
43-
"eslint": "^8.57.1",
41+
"eslint": "^9.14.0",
4442
"eslint-plugin-import": "^2.31.0",
45-
"eslint-plugin-isaacscript": "^3.12.2",
43+
"eslint-plugin-isaacscript": "^4.0.0",
4644
"eslint-plugin-no-relative-import-paths": "^1.5.5",
4745
"eslint-plugin-only-warn": "^1.1.0",
4846
"eslint-plugin-svelte": "^2.46.0",
@@ -51,17 +49,18 @@
5149
"string-argv": "^0.3.2",
5250
"svelte-check": "^4.0.5",
5351
"svelte-preprocess": "^6.0.3",
54-
"tslib": "^2.8.0",
52+
"tslib": "^2.8.1",
5553
"typescript": "^5.6.3",
54+
"typescript-eslint": "^8.13.0",
5655
"yaml": "^2.6.0"
5756
},
5857
"dependencies": {
59-
"@codemirror/legacy-modes": "^6.4.1",
58+
"@codemirror/legacy-modes": "^6.4.2",
6059
"@lemons_dev/parsinom": "^0.0.12",
6160
"itertools-ts": "^1.27.1",
6261
"mathjs": "^13.2.0",
6362
"moment": "^2.30.1",
64-
"svelte": "5.1.4",
63+
"svelte": "^5.1.9",
6564
"zod": "^3.23.8",
6665
"zod-validation-error": "^3.4.0"
6766
},

packages/core/src/api/API.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export abstract class API<Plugin extends IPlugin> {
189189
filePath: string,
190190
scope: BindTargetScope | undefined,
191191
renderChildType: RenderChildType = RenderChildType.INLINE,
192-
position?: NotePosition | undefined,
192+
position?: NotePosition,
193193
honorExcludedSetting: boolean = true,
194194
): FieldMountable {
195195
validateAPIArgs(
@@ -247,7 +247,7 @@ export abstract class API<Plugin extends IPlugin> {
247247
filePath: string,
248248
scope: BindTargetScope | undefined,
249249
renderChildType: RenderChildType = RenderChildType.INLINE,
250-
position?: NotePosition | undefined,
250+
position?: NotePosition,
251251
honorExcludedSetting: boolean = true,
252252
): FieldMountable {
253253
validateAPIArgs(

0 commit comments

Comments
 (0)