mirror of
https://github.com/TriliumNext/Trilium.git
synced 2026-10-11 22:49:56 +00:00
The rule could only ever fail on a working copy, never on committed content: `core.autocrlf` normalizes CRLF to LF on commit, and `.gitattributes` additionally pins `eol=lf` on `patches/**`, `docs/**`, the `doc_notes` trees and `*.sh`. LF in the repository is therefore a Git guarantee, and the rule restated it in a place that sees the checkout instead. On a Windows checkout, where `core.autocrlf=true` rewrites LF to CRLF, it fired on every line of every file. That was 423,752 of the 498,252 errors `dev:format-check` reported — 85% of the output, none of it describing anything wrong with the tree, and enough to bury the 48,304 real findings underneath it. It also made `dev:format-fix` unusable there: the one safe-looking remedy would have rewritten every line of every file. `eslint.config.mjs` already carried this rule commented out, so the two configs now agree. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
67 lines
2.3 KiB
JavaScript
67 lines
2.3 KiB
JavaScript
// @ts-check
|
|
|
|
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
import tsParser from "@typescript-eslint/parser";
|
|
import stylistic from "@stylistic/eslint-plugin";
|
|
|
|
// eslint config just for formatting rules
|
|
// potentially to be merged with the linting rules into one single config,
|
|
// once we have fixed the majority of lint errors
|
|
|
|
// Go to https://eslint.style/rules/default/${rule_without_prefix} to check the rule details
|
|
export const stylisticRules = {
|
|
"@stylistic/indent": ["error", 4],
|
|
"@stylistic/quotes": ["error", "double", { avoidEscape: true, allowTemplateLiterals: "always" }],
|
|
"@stylistic/semi": ["error", "always"],
|
|
"@stylistic/quote-props": ["error", "consistent-as-needed"],
|
|
"@stylistic/max-len": ["error", { code: 100 }],
|
|
"@stylistic/comma-dangle": ["error", "never"],
|
|
"@stylistic/array-bracket-spacing": ["error", "always"],
|
|
"@stylistic/object-curly-spacing": ["error", "always"],
|
|
"@stylistic/padded-blocks": ["error", { classes: "always" }]
|
|
};
|
|
|
|
export default defineConfig(
|
|
globalIgnores([
|
|
".cache",
|
|
"tmp",
|
|
"**/dist",
|
|
"**/out-tsc",
|
|
"apps/edit-docs/demo/*",
|
|
"docs/*",
|
|
"apps/web-clipper/lib/*",
|
|
// Build output that is gitignored but sits outside a `dist`, so it would otherwise be
|
|
// linted. `cap sync` copies the whole standalone bundle into the native projects, which
|
|
// adds ~165 MB of minified JS and makes ESLint run out of memory.
|
|
"apps/mobile/android/**",
|
|
"apps/mobile/ios/**",
|
|
"apps/*/out/**",
|
|
"apps/web-clipper/.output/**",
|
|
"site/**",
|
|
"**/test-output/**",
|
|
"apps/web-clipper/.wxt/**",
|
|
// Vendored third-party code. `--fix` must never touch these: the pdf.js viewer is
|
|
// re-vendored verbatim from an upstream release, and `update-viewer.ts` locates our
|
|
// patches by matching upstream markup.
|
|
"packages/pdfjs-viewer/viewer/**",
|
|
"packages/splitjs/test/lib/**",
|
|
// A worktree here is a full second copy of the repository.
|
|
".claude/worktrees/**"
|
|
]),
|
|
|
|
{
|
|
files: ["**/*.{js,ts,mjs,cjs}"],
|
|
|
|
languageOptions: {
|
|
parser: tsParser
|
|
},
|
|
|
|
plugins: {
|
|
"@stylistic": stylistic
|
|
},
|
|
|
|
rules: {
|
|
...stylisticRules
|
|
}
|
|
}
|
|
); |