mirror of
https://github.com/youfoundjk/TeXcore.git
synced 2026-07-22 07:33:31 +00:00
Fixes
- WebAssembly & initialization
- Fix TikZJax WebAssembly initialization issues.
- Fonts & symbol rendering
- Override DVI parser `machine.putText` to use split character code offsets from `tikzjax.js`.
- Map codes 0–9 starting at 161 to fix incorrect Γ rendering (was showing as Θ).
- Map codes 10–19 starting at 173 to resolve Ω and ⊗ collisions with soft hyphen.
- Layout & rendering
- Fix SVG clipping by switching to `position: relative` with `overflow: visible`.
- Adjust inline SVG behavior to prevent top-of-page clipping.
- Type compatibility
- Cast types to `unknown` in `TikzJaxLoader` and worker functions for compatibility.
- Error handling & cleanup
- Improve error handling across TikZ components.
- Remove unused dependencies and unnecessary console logs.
Features
- Package loading system
- Add robust dependency resolution in `loader.ts` for:
- `tikz-cd`
- `tikz-feynhand`
- `pgfcalendar`
- Ensure required libraries and keys load dynamically on demand.
- Rendering & layout improvements
- Enhance SVG bounding box calculation.
- Implement dynamic column width calculation.
- Improve row and column layout alignment and responsiveness.
- TikZ editor enhancements
- Add keyboard shortcut tooltips to sidebar buttons.
- Introduce thickness control slider for elements.
- Improve snapping system with modes:
- grid
- half
- none
- Add support for new shapes:
- circles
- rectangles
- triangles
- Improve TikZ code generation error handling.
Improvements
- Selection & editing UX
- Add lasso selection for multiple vertices in `CanvasGrid`.
- Support multi-element editing in `RightSidebar`.
- Refactor `TikzEditorModal` to handle multiple selected vertices.
- Enable batch updates for selected elements.
- Layout & styling
- Compact `.block-language-tikz` layout:
- margin: `1.5em 0` → `0.3em 0`
- padding: `1rem 0` → `0`
- Improve canvas controls and interaction styles.
- Component refactoring
- Refactor `CanvasGrid` to use template literals.
- Replace inline styles with `setCssStyles`.
- Improve `TikzCodec` node naming clarity.
- Improve `history manager` type safety with `EditorElement`.
- Use `window.setTimeout` in asset manager for better compatibility.
- Accessibility & UI polish
- Improve sidebar button titles and tooltips.
- Standardize live preview overlay button titles.
- Clean up modal styling and text consistency.
Documentation
- Revamp TeXcore plugin documentation:
- Clarify PDF export features and settings.
- Improve quick preview architecture explanation.
- Enhance equation search and autocomplete docs.
- Streamline snippets usage and transformations.
- Expand TikZ diagrams section with graphical editor guide.
- Improve getting started guide with clearer steps.
- Add navigation and configuration updates.
- Update plugin manifest descriptions for clarity.
140 lines
4.1 KiB
JavaScript
140 lines
4.1 KiB
JavaScript
import js from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import obsidianmd from 'eslint-plugin-obsidianmd';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import { fixupPluginRules } from '@eslint/compat';
|
|
import globals from 'globals';
|
|
|
|
export default tseslint.config(
|
|
{
|
|
ignores: [
|
|
'node_modules/**',
|
|
'dist/**',
|
|
'build/**',
|
|
'main.js',
|
|
'*.min.js',
|
|
'web/**',
|
|
'docs/**',
|
|
'coverage/**',
|
|
'obsidian-dev-vault/**',
|
|
'tools/**'
|
|
],
|
|
linterOptions: {
|
|
reportUnusedDisableDirectives: 'error'
|
|
}
|
|
},
|
|
{
|
|
...js.configs.recommended,
|
|
files: ['**/*.{js,cjs,mjs,ts,tsx}']
|
|
},
|
|
...tseslint.configs.recommended,
|
|
...obsidianmd.configs.recommended,
|
|
{
|
|
files: ['src/**/*.{test,spec}.{ts,tsx}', 'test_helpers/**/*.{ts,tsx}', '__mocks__/**/*.ts'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node,
|
|
...globals.jest
|
|
},
|
|
parserOptions: {
|
|
project: './tsconfig.eslint.json'
|
|
}
|
|
},
|
|
rules: {
|
|
// Tests may legitimately use Node built-ins (e.g. reading fixture files).
|
|
// Keep this rule enabled for `src/**` to avoid shipping Node-only imports in the plugin runtime.
|
|
'import/no-nodejs-modules': 'off',
|
|
'obsidianmd/no-nodejs-modules': 'off',
|
|
// Tests run in Node and may use test harness globals instead of Obsidian's active document.
|
|
'obsidianmd/prefer-active-doc': 'off',
|
|
'no-restricted-properties': [
|
|
'error',
|
|
{
|
|
object: 'describe',
|
|
property: 'only',
|
|
message: 'Do not commit describe.only()'
|
|
},
|
|
{
|
|
object: 'it',
|
|
property: 'only',
|
|
message: 'Do not commit it.only()'
|
|
},
|
|
{
|
|
object: 'test',
|
|
property: 'only',
|
|
message: 'Do not commit test.only()'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
files: ['src/**/*.{ts,tsx}'],
|
|
ignores: ['src/**/*.{test,spec}.{ts,tsx}'],
|
|
languageOptions: {
|
|
ecmaVersion: 2020,
|
|
sourceType: 'module',
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node,
|
|
React: 'readonly'
|
|
},
|
|
parserOptions: {
|
|
ecmaFeatures: {
|
|
jsx: true
|
|
},
|
|
project: './tsconfig.json'
|
|
}
|
|
},
|
|
plugins: {
|
|
'react-hooks': fixupPluginRules(reactHooks),
|
|
obsidianmd: obsidianmd
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
'@typescript-eslint/no-unused-vars': 'error',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
'no-console': 'off',
|
|
'no-debugger': 'error',
|
|
'prefer-const': 'error',
|
|
'no-var': 'error',
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
{
|
|
selector: "NewExpression[callee.name='Notice']",
|
|
message: 'Use showNotice(...) instead of new Notice(...).'
|
|
}
|
|
],
|
|
// Upgrade the Obsidian trash rule from warn to error.
|
|
'obsidianmd/prefer-file-manager-trash-file': 'error',
|
|
|
|
// Type assertions
|
|
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
|
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
'@typescript-eslint/prefer-as-const': 'warn',
|
|
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
|
|
// Code style
|
|
eqeqeq: ['error', 'always'], // Require === and !== instead of == and !=
|
|
'prefer-template': 'warn', // Use template literals instead of string concatenation
|
|
'@typescript-eslint/array-type': ['warn', { default: 'array' }], // Prefer T[] over Array<T>
|
|
'prefer-object-spread': 'warn', // Use {...obj} instead of Object.assign()
|
|
curly: ['warn', 'multi-line'], // Require curly braces for multi-line blocks
|
|
'no-else-return': 'warn', // Remove unnecessary else after return
|
|
'obsidianmd/ui/sentence-case': [
|
|
'warn',
|
|
{
|
|
acronyms: ['RRGGBB', 'RRGGBBAA']
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
files: ['src/utils/eventActions.ts'],
|
|
rules: {
|
|
'no-restricted-syntax': 'off'
|
|
}
|
|
}
|
|
);
|