• JavaScript 98.7%
  • TypeScript 1.3%
Find a file
semantic-release-bot 1abc0c5170 chore(release): 1.5.6
## [1.5.6](https://gitlab.com/logius/nldoc/lib/typescript/configs/compare/1.5.5...1.5.6) (2025-12-12)

### Bug Fixes

* **deps:** update eslint monorepo to v9.39.2 ([e02a073](e02a0734fe))
2025-12-12 23:14:50 +00:00
.vscode fix: formatting 2024-08-27 14:34:34 +02:00
.editorconfig chore: set .editorconfig 2025-04-22 01:04:54 +00:00
.gitignore fix: export d.mts files 2024-08-27 15:40:55 +02:00
.gitlab-ci.yml fix: update references (GitLab migration) 2025-04-03 19:11:46 +02:00
.npmignore feat: eslint and prettier config 2024-08-26 17:20:02 +02:00
.npmrc fix: update references (GitLab migration) 2025-04-03 19:11:46 +02:00
.nvmrc chore(deps): update node.js to v24 2025-10-28 23:11:37 +00:00
.prettierignore fix: formatting 2024-09-02 14:20:12 +02:00
CHANGELOG.md chore(release): 1.5.6 2025-12-12 23:14:50 +00:00
CODEOWNERS chore: set CODEOWNERS 2025-04-22 00:25:15 +00:00
commitlint.config.ts feat: eslint and prettier config 2024-08-26 17:20:02 +02:00
eslint.config.mjs feat: flat config without compat 2025-11-27 13:06:44 +01:00
LICENSE chore: add LICENSE 2025-04-22 00:09:26 +00:00
nextjs.eslint.config.mjs chore: remove jsx-a11y it is already included 2025-11-27 14:33:32 +01:00
nextjs.prettier.config.mjs feat(Prettier): add Prettier config for NextJS projects that uses 2 spaces indents instead of 4 2024-09-13 13:52:22 +02:00
package-lock.json chore(release): 1.5.6 2025-12-12 23:14:50 +00:00
package.json chore(release): 1.5.6 2025-12-12 23:14:50 +00:00
prettier.config.mjs fix: override spaces 2024-09-03 16:58:42 +02:00
README.md chore: fix casing 2025-08-07 11:37:52 +02:00
renovate.json chore: npm install twice 2025-11-05 14:13:18 +00:00
tsconfig.dist.json feat: flat config without compat 2025-11-27 13:06:44 +01:00
tsconfig.json fix: export d.mts files 2024-08-27 15:40:55 +02:00

@nldoc/configs

pipeline status Latest Release

Shared TypeScript, ESLint, and Prettier configurations for NLdoc projects

Features

  • 🎯 ESLint Configuration - Strict TypeScript-first ESLint setup with recommended rules
  • 💅 Prettier Configuration - Consistent code formatting across all NLdoc projects
  • 🔧 Next.js Support - Specialized configurations for Next.js applications
  • 🛠️ Utility Functions - Helper functions for ESLint compatibility with legacy plugins
  • 📦 Zero Config - Works out of the box with sensible defaults
  • 🔄 ESLint 9+ Flat Config - Modern ESLint flat configuration format

Installation

Prerequisites

  • Node.js >= 22
  • npm or yarn
  • TypeScript project with tsconfig.json

Install the package

npm install @nldoc/configs --save-dev

Getting Started

Basic Setup

Create the following configuration files in your project root:

ESLint Configuration

Create eslint.config.mjs:

// @ts-check
import baseConfig from '@nldoc/configs/eslint.config.mjs'
import tseslint from 'typescript-eslint'

export default tseslint.config(...baseConfig, {
  // Add your custom rules here
})

Prettier Configuration

Create prettier.config.mjs:

// @ts-check
import baseConfig from '@nldoc/configs/prettier.config.mjs'

export default {
    ...baseConfig,
    // Add your custom rules here
}

Next.js Projects

For Next.js applications, use the specialized configurations:

Next.js ESLint Configuration

// eslint.config.mjs
// @ts-check
import baseConfig from '@nldoc/configs/nextjs.eslint.config.mjs'
import tseslint from 'typescript-eslint'

export default tseslint.config(...baseConfig, {
  // Add your custom rules here
})

Next.js Prettier Configuration

// prettier.config.mjs
// @ts-check
import baseConfig from '@nldoc/configs/nextjs.prettier.config.mjs'

export default {
    ...baseConfig,
    // Add your custom rules here
}

Configuration Details

ESLint Configuration

The base ESLint configuration includes:

  • TypeScript strict type checking
  • Stylistic rules for consistent code style
  • Promise plugin for async/await best practices
  • Prettier integration for formatting
  • Custom rules for common patterns

Prettier Configuration

Default formatting rules:

  • Tab width: 4 spaces
  • Print width: 120 characters
  • Single quotes
  • No semicolons
  • Trailing commas (ES5)

Next.js Configurations

The Next.js variants include:

  • JSX/React specific rules
  • Accessibility rules (jsx-a11y)
  • Next.js recommended settings
  • React Hooks rules

Available Scripts

Add these scripts to your package.json:

{
  "scripts": {
    "lint": "eslint . --cache",
    "lint:fix": "eslint . --cache --fix",
    "format": "prettier . --write",
    "format:check": "prettier . --check",
    "typecheck": "tsc --noEmit"
  }
}

Troubleshooting

ESLint Legacy Plugin Compatibility

If you're using ESLint plugins that haven't been updated for ESLint 9's flat config format, use the provided utility functions:

import { fixCompatibility } from '@nldoc/configs/eslint.utils.mjs'

// Use fixCompatibility to wrap legacy configs
const legacyConfigs = fixCompatibility('plugin:some-legacy-plugin/recommended')

Documentation

License

This project is licensed under the European Union Public License 1.2 - see LICENSE for details.

Acknowledgements