Skip to content

Build your personal knowledge base with Trilium Notes

chore(eslint): move formatting rules to own config file for now

Panagiotis Papadopoulosa0fe60eff1bf
diff --git a/eslint.config.js b/eslint.config.js
index 5abb68103a..35cbd959d1 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -1,21 +1,5 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
-import stylistic from "@stylistic/eslint-plugin";
-
-
-// Go to https://eslint.style/rules/default/${rule_without_prefix} to check the rule details
-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: 200 } ],
- "@stylistic/comma-dangle": [ "error", "never" ],
- "@stylistic/linebreak-style": [ "error", "unix" ],
- "@stylistic/array-bracket-spacing": [ "error", "always" ],
- "@stylistic/object-curly-spacing": [ "error", "always" ],
- "@stylistic/padded-blocks": [ "error", { classes: "always" } ]
-};
export default tseslint.config(
eslint.configs.recommended,
@@ -46,8 +30,7 @@ export default tseslint.config(
argsIgnorePattern: "^_",
varsIgnorePattern: "^_"
}
- ],
- ...stylisticRules
+ ]
}
},
{
diff --git a/eslint.format.config.js b/eslint.format.config.js
new file mode 100644
index 0000000000..ec6b8f3ff9
--- /dev/null
+++ b/eslint.format.config.js
@@ -0,0 +1,42 @@
+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: 200 } ],
+ "@stylistic/comma-dangle": [ "error", "never" ],
+ "@stylistic/linebreak-style": [ "error", "unix" ],
+ "@stylistic/array-bracket-spacing": [ "error", "always" ],
+ "@stylistic/object-curly-spacing": [ "error", "always" ],
+ "@stylistic/padded-blocks": [ "error", { classes: "always" } ]
+};
+
+export default [
+ {
+ plugins: {
+ "@stylistic": stylistic
+ },
+ rules: {
+ ...stylisticRules
+ }
+ },
+ {
+ ignores: [
+ "build/*",
+ "dist/*",
+ "docs/*",
+ "libraries/*",
+ // TriliumNextTODO: check if we want to format packages here as well - for now skipping it
+ "packages/*",
+ "src/public/app-dist/*",
+ "src/public/app/doc_notes/*"
+ ]
+ }
+];