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.
- Applies to all
-
Plugins Used:
- Integrates plugins from
eslint-config-love
,eslint-plugin-eslint-comments
,@typescript-eslint/eslint-plugin
, and@stylistic/eslint-plugin
.
- Integrates plugins from
-
Parser:
- Uses
@typescript-eslint/parser
for parsing TypeScript files.
- Uses
-
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 theany
type is used, promoting type safety.@typescript-eslint/no-floating-promises
: Allows floating promises without handling.@typescript-eslint/no-var-requires
: Permits usingrequire
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 ofeslint-disable
andeslint-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.