npm package: @noxickon/codex
Description: Shared ESLint & Prettier configuration for noxickon projects
Author: noxickon
Latest version: 1.3.1

# @noxickon/codex

Shared ESLint and Prettier configuration for noxickon projects.

## Installation

### 1. Install the config package

```bash
npm install --save-dev @noxickon/codex
```

### 2. Install required peer dependencies

**All projects (base dependencies):**

```bash
npm install --save-dev \
  eslint \
  prettier \
  @eslint/js \
  typescript-eslint \
  globals \
  eslint-config-prettier \
  eslint-plugin-unicorn \
  eslint-plugin-perfectionist \
  eslint-plugin-sonarjs \
  eslint-plugin-regexp \
  eslint-plugin-sort-destructure-keys \
  eslint-plugin-unused-imports \
  prettier-plugin-tailwindcss
```

**React projects (additional dependencies):**

```bash
npm install --save-dev \
  @eslint-react/eslint-plugin \
  eslint-plugin-better-tailwindcss \
  eslint-plugin-react-compiler \
  eslint-plugin-react-refresh
```

**Node.js projects (additional dependencies):**

```bash
npm install --save-dev \
  eslint-plugin-n
```

### One-command installation (React projects)

```bash
npm install --save-dev \
  @noxickon/codex \
  eslint \
  prettier \
  @eslint/js \
  typescript-eslint \
  globals \
  eslint-config-prettier \
  eslint-plugin-unicorn \
  eslint-plugin-perfectionist \
  eslint-plugin-sonarjs \
  eslint-plugin-regexp \
  eslint-plugin-sort-destructure-keys \
  eslint-plugin-unused-imports \
  prettier-plugin-tailwindcss \
  @eslint-react/eslint-plugin \
  eslint-plugin-better-tailwindcss \
  eslint-plugin-react-compiler \
  eslint-plugin-react-refresh
```

## Usage

### ESLint

##### React projects:

###### eslint.config.js

```
import { createReactConfig } from '@noxickon/codex/eslint/react';

export default createReactConfig();
```

##### Node.js projects:

###### eslint.config.js

```
import { createNodeConfig } from '@noxickon/codex/eslint/node';

export default createNodeConfig();
```

##### Custom Tailwind CSS path:

###### eslint.config.js

```
import { createReactConfig } from '@noxickon/codex/eslint/react';

export default createReactConfig({
    tailwindEntryPoint: './styles/tailwind.css',
});
```

##### Disable Tailwind plugin:

###### eslint.config.js

```
import { createReactConfig } from '@noxickon/codex/eslint/react';

export default createReactConfig({
    tailwindEntryPoint: null,
});
```

### Prettier

##### Basic usage:

###### prettier.config.js

```
import { createPrettierConfig } from '@noxickon/codex/prettier';

export default createPrettierConfig();
```

##### Custom Tailwind configuration:

###### prettier.config.js

```
import { createPrettierConfig } from '@noxickon/codex/prettier';

export default createPrettierConfig({
    tailwindStylesheet: './styles/tailwind.css',
    tailwindFunctions: ['twMerge', 'twJoin', 'clsx', 'cn', 'customHelper'],
});
```

## Configuration Options

### ESLint (React / Base)

| Option             | Type           | Default              | Description                                                      |
| ------------------ | -------------- | -------------------- | ---------------------------------------------------------------- |
| tailwindEntryPoint | string or null | './src/tailwind.css' | Path to your Tailwind CSS file. Set to null to disable Tailwind. |
| enableTailwind     | boolean        | true                 | Enable or disable the Tailwind CSS plugin.                       |

### Prettier

| Option             | Type     | Default                             | Description                                         |
| ------------------ | -------- | ----------------------------------- | --------------------------------------------------- |
| tailwindStylesheet | string   | './src/tailwind.css'                | Path to your Tailwind CSS file for class sorting.   |
| tailwindFunctions  | string[] | ['twMerge', 'twJoin', 'clsx', 'cn'] | Custom helper functions for Tailwind class sorting. |

## Included Plugins

### ESLint

**Base (all projects):**

- TypeScript ESLint
- Unicorn (Modern JS/TS best practices)
- SonarJS (Code smells and bug detection)
- RegExp (Static RegExp analysis)
- Perfectionist (Auto-sorting)
- Unused Imports
- Sort Destructure Keys
- ESLint Config Prettier (Disables ESLint rules that conflict with Prettier)

**React (additional):**

- ESLint React (Rules of Hooks, JSX, DOM, RSC, Web API leak detection)
- React Compiler
- React Refresh (Vite)
- Better Tailwind CSS

**Node.js (additional):**

- eslint-plugin-n (Node.js best practices, deprecated APIs, missing imports)

### Prettier

- Prettier Plugin Tailwind CSS

## License

MIT