Commit 52b8b65 for jssip.net

commit 52b8b652582e4b35e50fc06d470d0522440bdf34
Author: José Luis Millán <jmillan@aliax.net>
Date:   Wed Dec 2 12:56:03 2026 +0100

    Update configs

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..ebc4cf7
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,24 @@
+# EditorConfig is awesome: https://editorconfig.org
+
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.{ts,mts,mjs,cjs,js}]
+indent_style = tab
+
+[*.json]
+indent_style = tab
+
+[*.md]
+indent_style = space
+indent_size = 2
+
+[*.{yml,yaml}]
+indent_style = space
+indent_size = 2
diff --git a/.prettierrc b/.prettierrc
deleted file mode 100644
index a824e54..0000000
--- a/.prettierrc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-	"useTabs": true,
-	"tabWidth": 2,
-	"arrowParens": "avoid",
-	"bracketSpacing": true,
-	"semi": true,
-	"singleQuote": true,
-	"trailingComma": "es5",
-	"endOfLine": "auto"
-}
diff --git a/.prettierrc.json b/.prettierrc.json
new file mode 100644
index 0000000..db3869e
--- /dev/null
+++ b/.prettierrc.json
@@ -0,0 +1,24 @@
+{
+	"useTabs": true,
+	"tabWidth": 2,
+	"arrowParens": "avoid",
+	"bracketSpacing": true,
+	"semi": true,
+	"singleQuote": true,
+	"trailingComma": "es5",
+	"endOfLine": "auto",
+	"overrides": [
+		{
+			"files": "*.md",
+			"options": {
+				"useTabs": false
+			}
+		},
+		{
+			"files": "*.{yml,yaml}",
+			"options": {
+				"useTabs": false
+			}
+		}
+	]
+}
diff --git a/eslint.config.mjs b/eslint.config.mjs
index d8122a8..e0cd783 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -1,3 +1,4 @@
+import { builtinModules } from 'node:module';
 import eslint from '@eslint/js';
 import tsEslint from 'typescript-eslint';
 import jestEslint from 'eslint-plugin-jest';
@@ -170,6 +171,43 @@ const config = tsEslint.config(
 			'@typescript-eslint/no-redundant-type-constituents': 0,
 		},
 	},
+	{
+		name: '.ts library files',
+		files: ['src/**/*.ts'],
+		ignores: ['src/test/**/*.ts'],
+		rules: {
+			// NOTE: The library must also work in the browser, so Node.js and Jest
+			// globals and Node.js modules are disallowed (except in tests).
+			'no-restricted-globals': [
+				2,
+				'Buffer',
+				'process',
+				'global',
+				'module',
+				'exports',
+				'__dirname',
+				'__filename',
+				'setImmediate',
+				'clearImmediate',
+				'describe',
+				'test',
+				'it',
+				'expect',
+				'beforeEach',
+				'afterEach',
+				'beforeAll',
+				'afterAll',
+				'jest',
+			],
+			'no-restricted-imports': [
+				2,
+				{
+					paths: builtinModules.filter(name => name !== 'events'),
+					patterns: [{ group: ['node:*'] }],
+				},
+			],
+		},
+	},
 	{
 		name: '.ts test files',
 		...jestEslint.configs['flat/recommended'],
diff --git a/jest.config.mjs b/jest.config.mjs
index 0a8d78b..99fc7d4 100644
--- a/jest.config.mjs
+++ b/jest.config.mjs
@@ -1,9 +1,14 @@
+/** @type {import('jest').Config} */
 const config = {
 	verbose: true,
 	preset: 'ts-jest',
 	testEnvironment: 'node',
 	testRegex: 'src/test/test-.*\\.ts',
 	transform: {
+		// NOTE: Since tsconfig.json has `isolatedModules: true`, ts-jest
+		// transpiles each file on its own without type checking it, so a TS error
+		// shows up here as a runtime error (if at all). We don't care since the
+		// `test` task runs `tsc --noEmit` first.
 		'^.+\\.ts$': [
 			'ts-jest',
 			{
@@ -11,7 +16,7 @@ const config = {
 			},
 		],
 	},
-	coveragePathIgnorePatterns: ['src/test'],
+	coveragePathIgnorePatterns: ['src/Logger.ts', 'src/test'],
 	cacheDirectory: '.cache/jest',
 };