2.0.6 • Published 4 months ago

eslint-config-dolmios v2.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

eslint-config-dolmios

A comprehensive ESLint (9) setup using @typescript-eslint, integrated with Prettier and tailored TSConfig setups for modern JavaScript and TypeScript projects. This config is designed for my projects, but feel free to use it as a starting point for your own projects.

Install

pnpm  add  eslint-config-dolmios

Usage

This ESLint configuration is designed for use with ESLint v9, which uses a flat config format. Follow the steps below to integrate it into your project.

Setting Up ESLint

  1. Create an ESLint Configuration File: In the root of your project, create a file named eslint.config.js.

  2. Import and Extend the Configuration: Add the following content to eslint.config.js to use the eslint-config-dolmios configuration:

import dolmios from "eslint-config-dolmios";

export default [
  ...dolmios,
  // Add any project-specific overrides here
];

Features

  • TypeScript Support: Comprehensive TypeScript linting with strict type checking
  • React Best Practices: Rules for React and React Hooks
  • Accessibility: A11y rules to ensure your app is accessible
  • Next.js Optimization: Includes Next.js Core Web Vitals rules for performance optimization
  • Code Organization: Perfectionist plugin for consistent code organization
  • Modern JavaScript: Enforces modern JavaScript practices

Next.js Compatibility

This configuration automatically detects your Next.js project structure and adjusts accordingly:

  • App Router Support: Works with Next.js App Router projects
  • Pages Router Support: Works with Next.js Pages Router projects
  • Non-Next.js Projects: Works with regular React projects without Next.js

The configuration automatically detects:

  • If you're using Next.js (by checking for next.config.js)
  • If you're using App Router (by checking for an app directory)
  • If you're using Pages Router (by checking for pages or src/pages directories)

Rules like no-html-link-for-pages are only enabled when a Pages Router is detected.


Usage with Prettier

Prettier is configured to work seamlessly with this ESLint setup. To include Prettier, add the configuration to your package.json:

"prettier": "eslint-config-dolmios/configs/prettier"

Extending Prettier

If you need to extend the Prettier configuration, you can do so by creating a .prettierrc.js file and exporting your modifications:

For more details, refer to the Prettier documentation.

module.exports = {
  ...require("eslint-config-dolmios/configs/prettier"),
  parser: "babel",
};

Usage with TSConfig

This config also exports two TSConfig setups, base and lib respectively. The base config is generally suitable. To include either, extend your tsconfig.json.

"extends": "eslint-config-dolmios/configs/tsconfig"

Configurations

You can view the ESLint configuration in the reference notes: reference.txt.

Acknowledgments

This configuration leverages several third-party libraries to enhance linting and formatting capabilities:

License

This project is licensed under the MIT License.

2.0.6

4 months ago

2.0.3

4 months ago

2.0.2

4 months ago

2.0.5

4 months ago

2.0.4

4 months ago

2.0.1

4 months ago

2.0.0

4 months ago

1.11.0

10 months ago

1.11.1

10 months ago

1.10.1

1 year ago

1.10.0

1 year ago

1.9.0

2 years ago

1.8.6

2 years ago

1.8.5

2 years ago

1.8.2

2 years ago

1.8.4

2 years ago

1.8.3

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.6.2

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.4.5

2 years ago

1.5.0

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.3.10

3 years ago

1.3.11

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.1.0

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago