Skip to content

⚙️ Eslint configuration for help you to identify and fix these errors before they cause problems in your code. It can also help you to develop good coding habits that will make your code easier to maintain in the long run.

Notifications You must be signed in to change notification settings

TheElegantCoding/eslint-config-elegant-coding

Repository files navigation

Eslint elegant coder configuration


  📦 SETUP⚙️ CONFIGURATION️️️🛰️ FEATURES


       

About

This GitHub repository offers a powerful ESLint configuration to elevate your coding experience. Proactively identify and fix potential errors before they cause issues, preventing runtime failures and streamlining your development workflow.

The configuration enforces consistent coding style and best practices, making your codebase easier to understand, modify, and collaborate on in the long run. It's built to be adaptable, allowing you to fine-tune the rules to your project's specific needs. Leverage a curated set of pre-configured ESLint rules, easily add or remove rules for further customization, and benefit from clear documentation that explains the reasoning behind each rule.

( Back to top )


Table of content

( Back to top )


Features

  • Eslint - Eslint linter
  • Astro - Catch errors and write awesome Astro components!
  • Html - Keep your HTML files tidy and consistent.
  • Import - Make your imports easy to find and manage.
  • Javascript - Write clean and maintainable JavaScript code.
  • Json - Ensure your JSON data is well-structured.
  • Node - Follow recommended practices for Node.js environments.
  • Perfectionist - Go beyond the basics with stricter code quality checks.
  • Regex - Craft powerful and maintainable regular expressions.
  • Solid - Write robust Solid components with confidence.
  • Stylistic - Improve readability and maintainability with stylistic rules.
  • Typescript - Enforce type safety and keep your code clear.
  • Unicorn - Leverage advanced rules for an extra quality boost.
  • Yaml - Keep your YAML files clean and consistent.

( Back to top )


Requirements

  • node >= 20.10.0
  • eslint >= 9.12

( Back to top )


Installation

Run this command to install eslint and the plugin.

Bun

bun i -D eslint eslint-config-elegant-coding

Pnpm

pnpm i -D eslint eslint-config-elegant-coding

Yarn

yarn i -D eslint eslint-config-elegant-coding

Npm

npm i -D eslint eslint-config-elegant-coding

( Back to top )


Usage

To use this plugin put in your repositorie you need to create an eslint.config.js file and add this lines of code.

  import elegantCoding from 'eslint-config-elegant-coding';

  export default elegantCoding();

( Back to top )


Configuration

Extra settings that can be added.

  import elegantCoding from 'eslint-config-elegant-coding';

  export default elegantCoding({
    // This line enables ESLint rules for YAML files.
    yml: true,

    // This line enables ESLint rules for HTML files.
    html: true,

    // This line enables ESLint rules for JSON files.
    json: true,

    // This line enables ESLint rules for Solid components.
    solid: true,

    // This line enables ESLint rules for Astro components.
    astro: true,

    // This line enables ESLint rules for tailwind classes.
    tailwind: true,

    // This line specifies a file to ignore from linting.
    // In this case, 'postcss.config.cjs' will not be processed by ESLint.
    ignore: [ 'postcss.config.cjs' ],

    // This line enables ESLint rules for stylistic concerns in your code.
    stylistic: true,

    // This line enables ESLint rules for TypeScript files.
    typescript: true,
  });

To add or override plugins and options, you can pass a second attribute to the function with an array like a normal configuration of eslint:

export default elegantCoding({
  stylistic: true,
  typescript: true
}, [
  {
    rules:
    {
      'style/indent': 'off'
    }
  },
  {
    plugin: 'customPlugin',
    rules:
    {
      // Extra rules...
    }
  }
]);

The list of the used plugins and the names are here:

New name Original Source
import import-x eslint-plugin-import-x
unicorn unicorn eslint-plugin-unicorn
perfectionist perfectionist eslint-plugin-perfectionist
node n eslint-plugin-n
regex regexp eslint-plugin-regexp
style @stylistic @stylistic/eslint-plugin
ts @typescript-eslint @typescript-eslint/eslint-plugin
html @html-eslint @html-eslint/eslint-plugin
json jsonc eslint-plugin-jsonc
yml yml eslint-plugin-yml
astro astro eslint-plugin-astro
tailwind tailwindcss eslint-plugin-tailwindcss

( Back to top )


  Copyright © All rights reserved,
  developed by ElegantCoder and

About

⚙️ Eslint configuration for help you to identify and fix these errors before they cause problems in your code. It can also help you to develop good coding habits that will make your code easier to maintain in the long run.

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published