Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .efm.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2
# log-file: ./efm.log.txt
# log-level: 10
lint-debounce: 1s

tools:
eslint-lint: &eslint-lint
lint-command: 'eslint_d --format unix --stdin --stdin-filename "${INPUT}"'
lint-stdin: true
lint-ignore-exit-code: true
lint-formats:
- '%f:%l:%c: %m [%trror]'
- '%f:%l:%c: %m [%tarning]'
root-markers:
- 'eslint.config.ts'
Comment on lines +7 to +15
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What efm-langserver runs for a given input.


languages:
javascript:
- !!merge <<: *eslint-lint
javascriptreact:
- !!merge <<: *eslint-lint
typescript:
- !!merge <<: *eslint-lint
typescriptreact:
- !!merge <<: *eslint-lint
svelte:
- !!merge <<: *eslint-lint
63 changes: 41 additions & 22 deletions .helix/languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ command = "nixd"
expr = "import (builtins.getFlake (builtins.toString ./.)).inputs.nixpkgs { }"

[language-server.astro-ls]
args = ["--stdio"]
command = "astro-ls"
config = { "typescript" = { "tsdk" = "./site/node_modules/typescript/lib" }, "environment" = "node" }
args = ["--stdio"]
command = "astro-ls"
config = { "typescript" = { "tsdk" = "./site/node_modules/typescript/lib" }, "environment" = "node" }
language-servers = ["eslint"]

[language-server.biome]
args = ["lsp-proxy"]
Expand Down Expand Up @@ -35,6 +36,10 @@ config.provideFormatter = true
args = ["--stdio"]
command = "vscode-html-language-server"

[language-server.efm-langserver]
args = ["-c", "../.efm.config.yaml"]
command = "efm-langserver"

[[language]]
auto-format = true
language-servers = [{ name = "vscode-solidity-server" }]
Expand Down Expand Up @@ -73,44 +78,58 @@ roots = [".git", "tailwind.config.js", "tailwind.config.cjs", "tailwi
scope = "source.html"

[[language]]
auto-format = true
formatter = { command = "treefmt", args = ["--stdin", ".js"] }
language-servers = [{ name = "typescript-language-server", except-features = ["format"] }]
name = "javascript"
auto-format = true
formatter = { command = "treefmt", args = ["--stdin", ".js"] }
language-servers = [
{ name = "typescript-language-server", except-features = ["format"] },
{ name = "efm-langserver", except-features = ["format"] },
]
name = "javascript"
Comment on lines -76 to +87
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additive diagnostics without format.


[[language]]
auto-format = true
formatter = { command = "treefmt", args = ["--stdin", ".ts"] }
language-servers = [{ name = "typescript-language-server", except-features = ["format"] }]
name = "typescript"
auto-format = true
formatter = { command = "treefmt", args = ["--stdin", ".ts"] }
language-servers = [
{ name = "typescript-language-server", except-features = ["format"] },
{ name = "efm-langserver", except-features = ["format"] },
]
name = "typescript"

[[language]]
auto-format = true
formatter = { command = "treefmt", args = ["--stdin", ".tsx"] }
language-servers = [
{ name = "typescript-language-server", except-features = ["format"] },
{ name = "efm-langserver", except-features = ["format"] },
"tailwindcss-ls",
]
name = "tsx"

[[language]]
auto-format = true
formatter = { command = "treefmt", args = ["--stdin", ".jsx"] }
language-servers = [{ name = "typescript-language-server", except-features = ["format"] }]
name = "jsx"
auto-format = true
formatter = { command = "treefmt", args = ["--stdin", ".jsx"] }
language-servers = [
{ name = "typescript-language-server", except-features = ["format"] },
{ name = "efm-langserver", except-features = ["format"] },
]
name = "jsx"

[[language]]
language-servers = [{ name = "vscode-json-language-server", except-features = ["format"] }, "biome"]
name = "json"

[[language]]
auto-format = true
file-types = ["svelte"]
formatter = { command = "treefmt", args = ["--stdin", ".svelte"] }
language-servers = ["svelteserver", "tailwindcss-ls"]
name = "svelte"
roots = ["svelte.config.js"]
scope = "source.svelte"
auto-format = true
file-types = ["svelte"]
formatter = { command = "treefmt", args = ["--stdin", ".svelte"] }
language-servers = [
"svelteserver",
"tailwindcss-ls",
{ name = "efm-langserver", except-features = ["format"] },
]
name = "svelte"
roots = ["svelte.config.js"]
scope = "source.svelte"

[[language]]
comment-token = "#"
Expand Down
2 changes: 1 addition & 1 deletion app2/app2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ _: {
../typescript-sdk
../ts-sdk
];
hash = "sha256-KmVVH20FVlj7qxGSfB0hobb9V+3Fp0bptPA38ojbWZg=";
hash = "sha256-3t6nkAneiX+cbvYT1X497fWNXorI0OczUcR4aSAGli0=";
buildInputs = deps;
nativeBuildInputs = buildInputs;
pnpmWorkspaces = [
Expand Down
37 changes: 0 additions & 37 deletions app2/eslint.config.js

This file was deleted.

15 changes: 15 additions & 0 deletions app2/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { includeIgnoreFile } from "@eslint/compat"
import * as U from "@unionlabs/eslint-config"
import type { Linter } from "eslint"
import svelteConfig from "./svelte.config.js"

const gitignore = includeIgnoreFile(
new URL(import.meta.resolve("./.gitignore")).pathname,
)

const config: Linter.Config[] = [
gitignore,
...U.configs.svelte(svelteConfig),
]

export default config
Comment on lines +1 to +15
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much simpler and more consistent.

6 changes: 2 additions & 4 deletions app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"@datadog/browser-logs": "^6.6.4",
"@effect/experimental": "^0.46.4",
"@effect/platform": "0.82.4",
"@eslint/compat": "^1.2.8",
"@eslint/js": "^9.24.0",
"@eslint/compat": "^1.2.9",
"@keplr-wallet/types": "^0.12.220",
"@leapwallet/types": "^0.0.5",
"@number-flow/svelte": "^0.3.7",
Expand All @@ -41,14 +40,14 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/svelte": "^5.2.4",
"@unionlabs/client": "workspace:*",
"@unionlabs/eslint-config": "workspace:*",
"@unionlabs/sdk": "workspace:*",
"@wagmi/connectors": "^5.7.12",
"@wagmi/core": "^2.16.7",
"@web3modal/wagmi": "5.1.11",
"clsx": "^2.1.1",
"effect": "3.15.2",
"eslint": "^9.24.0",
"eslint-plugin-svelte": "^3.5.1",
"globals": "^16.0.0",
"gql.tada": "^1.8.10",
"graphql": "^16.10.0",
Expand All @@ -63,7 +62,6 @@
"svelte-check": "^4.1.6",
"tailwind-merge": "^3.2.0",
"tailwindcss": "^4.1.4",
"typescript-eslint": "^8.30.1",
"unified": "^11.0.5",
"vfile": "^6.0.3",
"viem": "^2.27.2",
Expand Down
38 changes: 38 additions & 0 deletions eslint-config-union/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "@unionlabs/eslint-config",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New workspace project to contain ESLint config for various projects. Currently supports JS, TS, and Svelte.

Changes to this project update in real-time for sibling workspace projects given that we are exporting TS and using workspace linking.

"version": "1.9.9",
"type": "module",
"license": "MIT",
"author": "@unionlabs",
"description": "Union ESLint Configuration",
"repository": {
"type": "git",
"url": "https://github.com/unionlabs/union.git",
"directory": "eslint-config-union"
},
"main": "src/index.ts",
"peerDependencies": {
"eslint": "^9.24.0",
"eslint-plugin-svelte": "^3.5.1",
"typescript": ">=5.8.2"
},
"peerDependenciesMeta": {
"@sveltejs/kit": {
"optional": true
},
"eslint-plugin-svelte": {
"optional": true
}
},
"devDependencies": {
"@sveltejs/kit": "^2",
"eslint": "^9.27.0",
"eslint-plugin-svelte": "^3.9.0",
"globals": "^16.0.0",
"typescript": ">=5.8.2"
},
"dependencies": {
"@eslint/js": "^9.27.0",
"typescript-eslint": "^8.32.1"
}
}
11 changes: 11 additions & 0 deletions eslint-config-union/src/configs/javascript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import eslint from "@eslint/js"
import { Linter } from "eslint"

const config: Linter.Config[] = [
eslint.configs.recommended,
{
name: "union:javascript:rules",
rules: {},
},
]
export default config
49 changes: 49 additions & 0 deletions eslint-config-union/src/configs/svelte.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import type { Config as SvelteConfig } from "@sveltejs/kit"
import type { Linter } from "eslint"
import svelte from "eslint-plugin-svelte"
import globals from "globals"
import tseslint from "typescript-eslint"
import javascript from "./javascript.js"
import typescript from "./typescript.js"

const config = (config: SvelteConfig): Linter.Config[] => [
...javascript,
...typescript,
...svelte.configs["flat/recommended"],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],

languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: [".svelte"], // Add support for additional file extensions, such as .svelte
parser: tseslint.parser,
// Specify a parser for each language, if needed:
// parser: {
// ts: ts.parser,
// js: espree, // Use espree for .js files (add: import espree from 'espree')
// typescript: ts.parser
// },

// We recommend importing and specifying svelte.config.js.
// By doing so, some rules in eslint-plugin-svelte will automatically read the configuration and adjust their behavior accordingly.
// While certain Svelte settings may be statically loaded from svelte.config.js even if you don’t specify it,
// explicitly specifying it ensures better compatibility and functionality.
config,
},
},
},
{
name: "union:svelte:rules",
rules: {},
},
]
export default config
31 changes: 31 additions & 0 deletions eslint-config-union/src/configs/typescript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Linter } from "eslint"
import tseslint from "typescript-eslint"
import javascript from "./javascript.js"

const config: Linter.Config[] = [
...javascript,
...tseslint.configs.recommended as Linter.Config[],
{
name: "union:typescript:rules",
rules: {
"@typescript-eslint/no-empty-object-type": [
// Allow `{}` types for empty `TaggedEnum`s
"off",
],
"@typescript-eslint/no-unused-vars": [
// Allow unused underscore-prefixed variables
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
},
},
]
export default config
9 changes: 9 additions & 0 deletions eslint-config-union/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import javascript from "./configs/javascript.js"
import svelte from "./configs/svelte.js"
import typescript from "./configs/typescript.js"

export const configs = {
javascript,
svelte,
typescript,
}
12 changes: 12 additions & 0 deletions eslint-config-union/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"include": [],
"references": [
{
"path": "tsconfig.src.json"
},
{
"path": "tsconfig.test.json"
}
]
}
11 changes: 11 additions & 0 deletions eslint-config-union/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "../tsconfig.base.json",
"include": ["src"],
"compilerOptions": {
"types": ["node"],
"outDir": "build/src",
"tsBuildInfoFile": ".tsbuildinfo/src.tsbuildinfo",
"rootDir": "src"
}
}
Loading