frmscoe / docs

This is the main directory for all project documentation files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Review documentation on Linting rules

Sandy-at-Tazama opened this issue · comments

Create a short doc to explain our new linting rules and approach - verify this

Certainly! Here's the documentation of your ESLint configuration in Markdown format:

ESLint Configuration Documentation

This document details the ESLint configuration for TypeScript files as specified in the eslint.config.mjs file. The configuration integrates multiple plugins to enforce style and quality standards.

Configuration Overview

  • Files Targeted:

    • Applies to all .ts files across the project.
  • Plugins Used:

    • Integrates plugins from eslint-config-love, eslint-plugin-eslint-comments, @typescript-eslint/eslint-plugin, and @stylistic/eslint-plugin.
  • Parser:

    • Uses @typescript-eslint/parser for parsing TypeScript files.
  • ECMA Version:

    • Configured for ECMAScript 2022 to support modern JavaScript features.
  • Source Type:

    • Files are treated as ECMAScript modules.

Rules Summary

Standard and Plugin Rules

  • Inherits rules from eslint-config-love.
  • Incorporates recommended rules from eslint-plugin-eslint-comments.

TypeScript Specific Rules

  • @typescript-eslint/restrict-template-expressions: Errors on unsafe usage in template literals.
  • @typescript-eslint/no-non-null-assertion: Disabled.
  • @typescript-eslint/strict-boolean-expressions: Disabled to allow any type in conditions.
  • @typescript-eslint/no-explicit-any: Errors when the any type is used, promoting type safety.
  • @typescript-eslint/no-floating-promises: Allows floating promises without handling.
  • @typescript-eslint/no-var-requires: Permits using require statements in TypeScript.
  • @typescript-eslint/no-use-before-define: Disabled to allow hoisting.
  • @typescript-eslint/prefer-optional-chain: Does not enforce using optional chaining.

Stylistic Rules (Custom Plugin)

  • @stylistic/indent: Enforces 2 spaces for indentation.
  • @stylistic/semi: Requires semicolons at the end of statements, warning level.
  • @stylistic/quotes: Enforces single quotes for strings.
  • @stylistic/quote-props: Requires quotes around object properties when necessary.
  • @stylistic/arrow-parens: Requires parentheses around arrow function arguments.

ESLint Comments Plugin

  • eslint-comments/require-description: Warns if ESLint directive comments lack a description.
  • eslint-comments/disable-enable-pair: Warns to ensure proper use of eslint-disable and eslint-enable pairs.

Ignored Files and Directories

  • Ignored Locations:
    • **/build/** or **/lib/** // tsc output directory (project)
    • **/node_modules/**
    • **/docs/**
    • **/__tests__/**
    • **/coverage/** // jest coverage
    • **/jest.config.ts // jest main config
    • **/jest.testEnv.ts // jest env config

This setup ensures a robust framework for maintaining high code quality and consistency in TypeScript projects, leveraging ESLint's core capabilities and additional style rules from external plugins.