@univ-lehavre/atlas-shared-config
v0.3.0
Published
Shared TypeScript, ESLint, and Prettier configuration for Atlas projects
Maintainers
Readme
@univ-lehavre/atlas-shared-config
Shared TypeScript, ESLint, and Prettier configuration for Atlas projects.
Installation
pnpm add -D @univ-lehavre/atlas-shared-configTypeScript Configuration
| Config | Description |
| ----------- | ---------------------------------------- |
| base.json | Base strict configuration |
| node.json | Node.js specific settings (extends base) |
Usage
// tsconfig.json
{
"extends": "@univ-lehavre/atlas-shared-config/node.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
},
"include": ["src"]
}base.json
Strict TypeScript configuration:
| Option | Value | Description |
| ------------------------------------ | ------ | --------------------------------------------- |
| strict | true | Enable all strict checks |
| noUncheckedIndexedAccess | true | Add undefined to indexed access |
| noImplicitOverride | true | Require override keyword |
| noPropertyAccessFromIndexSignature | true | Require bracket notation for index signatures |
| noFallthroughCasesInSwitch | true | Report fallthrough in switch |
| forceConsistentCasingInFileNames | true | Enforce consistent file casing |
| verbatimModuleSyntax | true | Enforce explicit type imports |
| isolatedModules | true | Ensure compatibility with transpilers |
node.json
Extends base.json with Node.js-specific settings:
| Option | Value | Description |
| ------------------ | ------------ | ------------------------- |
| module | NodeNext | Node.js ESM module system |
| moduleResolution | NodeNext | Node.js module resolution |
| target | ES2024 | ECMAScript 2024 target |
| lib | ["ES2024"] | ES2024 library |
ESLint Configuration
Three presets for different use cases:
| Preset | Use Case | Strictness |
| ------------ | ------------------------------- | ---------- |
| typescript | TypeScript libraries (crf, net) | Strict |
| svelte | SvelteKit applications (ecrin) | Strict |
| scripts | Internal tooling (redcap) | Relaxed |
Usage
// eslint.config.js
import { typescript } from '@univ-lehavre/atlas-shared-config/eslint';
export default typescript({
ignores: ['**/generated/**'],
workspaceModules: ['@univ-lehavre/atlas-net'],
});Preset Comparison
Summary Table
| Feature | typescript| svelte | scripts |
| -------------------------------- | :----------: | :------: | :-------: |
| TypeScript | | | |
| Type-checked rules | ✅ | ✅ | ❌ |
| no-explicit-any | error | error | warn |
| no-unused-vars | error | error | warn |
| explicit-function-return-type | error | error | ❌ |
| strict-boolean-expressions | error | error | ❌ |
| consistent-type-imports | error | error | ❌ |
| Functional Programming | | | |
| functional/* rules | ✅ | ✅ | ❌ |
| no-throw-statements | error | error | ❌ |
| no-try-statements | error | error | ❌ |
| immutable-data | error | error | ❌ |
| Code Quality | | | |
| eslint-plugin-unicorn | ✅ | ✅ | ❌ |
| eslint-plugin-regexp | ✅ | ✅ | ❌ |
| eslint-plugin-barrel-files | ✅ | ✅ | ❌ |
| Security | | | |
| eslint-plugin-security | ✅ | ✅ | ❌ |
| eslint-plugin-no-secrets | ✅ | ✅ | ❌ |
| Imports | | | |
| eslint-plugin-import-x | ✅ | ✅ | ❌ |
| import-x/no-cycle | error | ❌ | ❌ |
| Node.js | | | |
| eslint-plugin-n | ✅ | ✅ | ❌ |
| n/no-missing-import | error | ❌ | ❌ |
| Framework-specific | | | |
| eslint-plugin-svelte | ❌ | ✅ | ❌ |
| eslint-plugin-turbo | ✅ | ✅ | ❌ |
| Testing | | | |
| @vitest/eslint-plugin | ✅ | ❌ | ✅ |
| Other | | | |
| no-console | error | error | ❌ |
| prefer-const | error | error | error |
| eqeqeq | error | error | error |
✅ = enabled, ❌ = disabled, error/warn = rule severity
Common Plugins (all presets)
@eslint/js- ESLint recommended rulestypescript-eslint- TypeScript supporteslint-config-prettier- Prettier compatibility
typescript
Strict configuration for TypeScript library packages.
Additional plugins:
eslint-plugin-functional- Functional programming rules (adapted for Effect)eslint-plugin-unicorn- Modern best practiceseslint-plugin-n- Node.js ruleseslint-plugin-import-x- Import/export ruleseslint-plugin-security- Security ruleseslint-plugin-regexp- RegExp ruleseslint-plugin-no-secrets- Prevent secrets in codeeslint-plugin-barrel-files- Discourage barrel fileseslint-plugin-turbo- Turborepo rules@vitest/eslint-plugin- Vitest rules
Key rules:
@typescript-eslint/no-explicit-any: error@typescript-eslint/strict-boolean-expressions: error@typescript-eslint/explicit-function-return-type: errorfunctional/no-throw-statements: errorfunctional/no-try-statements: errorfunctional/immutable-data: error (with exceptions)
Relaxed for:
- Test files (
*.test.ts,*.spec.ts) - CLI/bin files
- Server entry points
svelte
Strict configuration for SvelteKit applications. Extends typescript with Svelte-specific rules.
Additional plugins:
eslint-plugin-svelte- Svelte rules
Svelte-specific rules:
svelte/valid-compile: errorsvelte/no-at-html-tags: warnsvelte/require-each-key: warnsvelte/no-reactive-functions: errorsvelte/no-reactive-literals: error
Disabled for .svelte files:
functional/*rules (Svelte uses imperative patterns)@typescript-eslint/explicit-function-return-typeprefer-const(Svelte 5$props()useslet)
Disabled globally:
n/no-missing-import(SvelteKit virtual modules:$app/*,$env/*,$lib)import-x/no-cycle(Svelte component cycles are normal)
Relaxed for:
- Server files (
*.server.ts,hooks.server.ts,src/lib/server/**) - Route files (
src/routes/**/*.ts)
scripts
Relaxed configuration for internal tooling and scripts.
Plugins:
@eslint/js- ESLint recommended (not strict)typescript-eslint- Recommended (not strict type-checked)@vitest/eslint-plugin- Vitest ruleseslint-config-prettier- Prettier compatibility
Key differences from typescript:
- No functional programming rules
- No security rules
- No import rules
@typescript-eslint/no-explicit-any: warn (not error)@typescript-eslint/no-unused-vars: warn (not error)no-console: off
Options
All presets accept an options object:
interface Options {
ignores?: string[]; // Additional patterns to ignore
workspaceModules?: string[]; // Workspace modules for n/no-missing-import (typescript only)
}Prettier Configuration
Two presets for different use cases:
| Preset | Use Case |
| -------- | ------------------------------- |
| base | TypeScript packages |
| svelte | SvelteKit applications |
Usage
// prettier.config.js (TypeScript packages)
import { base } from '@univ-lehavre/atlas-shared-config/prettier';
export default base;// prettier.config.js (SvelteKit)
import { svelte } from '@univ-lehavre/atlas-shared-config/prettier';
export default svelte;Settings
| Option | Value |
| --------------- | ------- |
| semi | true |
| singleQuote | true |
| tabWidth | 2 |
| trailingComma | es5 |
| printWidth | 100 |
The svelte preset adds prettier-plugin-svelte with Svelte parser override.
License
MIT
